Last active
August 29, 2015 14:20
-
-
Save teh/c23e251414b267309055 to your computer and use it in GitHub Desktop.
puzzle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "globals.mzn"; | |
set of 1..5: a = 1..5; % Nicola, Ed, David, Nick, Nigel | |
set of 1..5: b = 1..5; % Guinea, Squirrel, Pitbull, Badger, Fish | |
set of 1..5: c = 1..5; % Moccachino, FlatWhite, Chai, Double Espresso, Decaf | |
set of 1..5: d = 1..5; % Car, Bike, Train, Plane, Walk | |
set of 1..5: e = 1..5; % Tartan, Paisly, Gingham, Striped, Polka | |
array[a] of var a: A; | |
array[b] of var b: B; | |
array[c] of var c: C; | |
array[d] of var d: D; | |
array[e] of var e: E; | |
solve satisfy; | |
constraint | |
all_different(A) /\ | |
all_different(B) /\ | |
all_different(C) /\ | |
all_different(D) /\ | |
all_different(E) /\ | |
A[1] = E[1] /\ | |
A[2] = B[1] /\ | |
A[3] = C[1] /\ | |
E[2] + 1 = E[3] /\ | |
E[2] = C[2] /\ | |
D[1] = B[2] /\ | |
E[4] = D[2] /\ | |
C[4] = 3 /\ | |
A[4] = 1 /\ | |
(D[3] = B[3]+1 \/ D[3] = B[3]-1) /\ | |
(B[4] = D[2]+1 \/ B[4] = D[2]-1) /\ | |
D[4] = C[3] /\ | |
A[5] = D[5] /\ | |
(A[4] = E[5]+1 \/ A[4] = E[5]-1) /\ | |
(D[3] = C[5]+1 \/ D[3] = C[5]-1) | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> [ Problem Stats ] | |
> Parsing input. | |
>>> Search start | |
> Conflicts | ORIGINAL | LEARNT | Progress | |
> | Vars Clauses Literals | Limit Clauses Lit/Cl | | |
> restarts : 1 | |
> decisions : 3 (0 % random) | |
> conflicts : 1 | |
> propagations : 633 | |
> conflict literals : 3 (0 % deleted) | |
A = array1d(1..5,[3,5,2,1,4]); | |
B = array1d(1..5,[5,3,1,2,4]); | |
C = array1d(1..5,[2,4,5,3,1]); | |
D = array1d(1..5,[3,1,2,5,4]); | |
E = array1d(1..5,[3,4,5,1,2]); | |
---------- | |
> 1 model found | |
>>> Search done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment