SHARE
TWEET

Modelo Zebra

cardel Jun 18th, 2019 121 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include "alldifferent.mzn";
  2.  
  3. var 1..5: english; var 1..5: spanish; var 1..5: japones; var 1..5: italian; var 1..5: nor;
  4. var 1..5: dog; var 1..5: snail; var 1..5: fox; var 1..5: horse; var 1..5: zebra;
  5. var 1..5: pintor; var 1..5: esculptor; var 1..5: diplomat; var 1..5: violinis; var 1..5: doctor;
  6. var 1..5: tea; var 1..5: cofee; var 1..5: water; var 1..5: milk; var 1..5: juice;
  7. var 1..5: red; var 1..5: blue; var 1..5: white; var 1..5: green; var 1..5: yellow;
  8.  
  9. constraint alldifferent([english,spanish,japones,italian,nor]);
  10. constraint alldifferent([dog,snail,fox,horse,zebra]);
  11. constraint alldifferent([pintor,esculptor,diplomat,violinis,doctor]);
  12. constraint alldifferent([tea,cofee,water,milk,juice]);
  13. constraint alldifferent([red,blue,white,green,yellow]);
  14.  
  15. constraint english = red;
  16. constraint spanish = dog;
  17. constraint japones = pintor;
  18. constraint italian = tea;
  19. constraint nor = 1;
  20. constraint green = cofee;
  21. constraint green = white + 1;
  22. constraint esculptor = snail;
  23. constraint diplomat = yellow;
  24. constraint milk = 3;
  25. constraint abs(nor-blue) = 1;
  26. constraint violinis = juice;
  27. constraint abs(fox-doctor) = 1;
  28. constraint abs(horse-diplomat)=1;
  29.  
  30. solve satisfy;
  31.  
  32. output ["English=\(english)\t spanish=\(spanish)\t japones=\(japones)\t italian=\(italian)\t noruego=\(nor)\n"];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top