Setting Alloy before adding constraints...
[Benchmarks_CSolver.git] / nqueens / nqueens.cc
index 9550f161a51137c7941df7c8959794e4e1bfd929..a90c7fa422bd8f63b01444b6775961224b07a483 100644 (file)
@@ -466,6 +466,10 @@ void csolverNQueens(int N, SolverType stype = CSOLVER){
                return;
        }
        CSolver *solver = new CSolver();
+       if(stype = ALLOY){
+               solver->setAlloyEncoder();
+       }
+
        uint64_t domain[N];
        for(int i=0; i<N; i++){
                domain[i] = i;
@@ -482,10 +486,7 @@ void csolverNQueens(int N, SolverType stype = CSOLVER){
 //     solver->printConstraints();
        if(stype == DUMP){
                solver->serialize();
-       } else if(stype = ALLOY){
-               solver->setAlloyEncoder();
-       }
-       if (solver->solve() != 1){
+       } if (solver->solve() != 1){
                printf("Problem is Unsolvable ...\n");
        }else {
                int table[N*N];