Created
November 11, 2013 10:12
-
-
Save dvberkel/7410924 to your computer and use it in GitHub Desktop.
4-queens as a Constraint Satisfaction Problem
This file contains 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
CSP.problem = { | |
variables : { | |
v1 : [0, 1], | |
v2 : [0, 1], | |
v3 : [0, 1], | |
v4 : [0, 1], | |
v5 : [0, 1], | |
v6 : [0, 1], | |
v7 : [0, 1], | |
v8 : [0, 1], | |
v9 : [0, 1], | |
v10 : [0, 1], | |
v11 : [0, 1], | |
v12 : [0, 1], | |
v13 : [0, 1], | |
v14 : [0, 1], | |
v15 : [0, 1], | |
v16 : [0, 1], | |
}, | |
constraints : [ | |
"v1 + v2 + v3 + v4 <=1", "v5 + v6 + v7 + v8 <=1","v9 + v10 + v11 + v12 <=1", "v13 + v14 + v15 + v16 <=1", | |
"v1 + v5 + v9 + v13 <=1", "v2 + v6 + v10 + v14 <=1", "v3 + v7 + v11 + v15 <=1", "v4 + v8 + v12 + v16 <=1", | |
"v13 <= 1", "v9 + v14 <=1", "v5 + v10 +v15 <=1", "v1 +v6 +v11 +v16<=1","v2 + v7 + v12<=1", "v3 + v8<=1", | |
"v4<=1", | |
"v1 <= 1", "v2 + v5 <=1","v3 + v6 +v9 <=1","v4 +v7 +v10 +v13<=1","v8 + v11 + v14<=1","v12 + v15<=1", | |
"v16<=1", | |
"v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15 + v16 ==4", | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment