1
$\begingroup$

I am trying to express the constraints for the 'Tents and trees' puzzle in minizinc but I am a bit stuck...

  1. I can express that each tent must be attached to at least one tree
  2. That a tree must be attached to at least one tent
  3. That no tent can touch another tent

However, I cannot express that 'each tent/tree must be attached to only one tree/tent' and get incorrect solutions generated such as 'tent-tree-tent'

Any help appreciated.

$\endgroup$
2
  • $\begingroup$ Assuming for you $x_i = 1$ is tent on index $i$, $0$ implies tree then constraint may be $x_i + x_{i+1} = 1$. Then you'd get $1,0,1$ or $0,1,0$ $\endgroup$ Commented Jan 9 at 21:01
  • $\begingroup$ The answer will depend on how you write your CP model. If you edit the question to show the CP model, we may be able to provide a more definitive answer. $\endgroup$
    – prubin
    Commented Jan 9 at 21:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.