From: Hamed Gorjiara Date: Sat, 4 Aug 2018 21:59:45 +0000 (-0700) Subject: Adding the symmetry breaking constraint to the original encoding X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=94f8fac018d5abd8afcb9590e6ac3d19587ed47a;p=Benchmarks_CSolver.git Adding the symmetry breaking constraint to the original encoding --- diff --git a/nqueens/nqueens.cc b/nqueens/nqueens.cc index 24f45233..e4eb1ab3 100644 --- a/nqueens/nqueens.cc +++ b/nqueens/nqueens.cc @@ -30,6 +30,29 @@ void EqualOneToCNF(vector literals, vector< vector > & cnf){ } } +void verticalSymmetryBreaking(vector col1, vector colN, vector > &cnf){ + vector dnf; + for(int i=0; i literals, vector > & cnf){ + int N= literals.size(); + vector dnf; + for( int i=0; i literals, vector< vector > & cnf){ int N = literals.size(); vector dnf; @@ -186,7 +209,19 @@ void originalNqueensEncoding(int N){ LessEqualOneToCNF(vars, cnf); vars.clear(); } - + + //Symmetry breaking constraint + for (int i=0; i lastCol; + for(int i=0; i