}
}
+void verticalSymmetryBreaking(vector<int> col1, vector<int> colN, vector<vector<int> > &cnf){
+ vector<int> dnf;
+ for(int i=0; i<col1.size(); i++){
+ dnf.push_back(-col1[i]);
+ for(int j=i+1; j<colN.size(); j++){
+ dnf.push_back(colN[j]);
+ }
+ cnf.push_back(dnf);
+ dnf.clear();
+ }
+
+
+}
+
+void Or( vector<int> literals, vector<vector<int> > & cnf){
+ int N= literals.size();
+ vector<int> dnf;
+ for( int i=0; i<N; i++){
+ dnf.push_back(literals[i]);
+ }
+ cnf.push_back(dnf);
+}
+
void LessEqualOneToCNF(vector<int> literals, vector< vector<int> > & cnf){
int N = literals.size();
vector<int> dnf;
LessEqualOneToCNF(vars, cnf);
vars.clear();
}
-
+
+ //Symmetry breaking constraint
+ for (int i=0; i<N/2; i++){
+ vars.push_back(VarName[0][i]);
+ }
+ Or(vars, cnf);
+ vector<int> lastCol;
+ for(int i=0; i<N; i++){
+ lastCol.push_back(VarName[N-1][i]);
+ }
+ verticalSymmetryBreaking(vars, lastCol, cnf);
+ vars.clear();
+ //That's it ... Let's solve the problem ...
IncrementalSolver *solver =allocIncrementalSolver();
for (int i=0; i<cnf.size(); i++){