From: Hamed Gorjiara Date: Wed, 25 Jul 2018 05:20:32 +0000 (-0700) Subject: changing API for nqueens X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ac0383468e89e2faece84328ff156113fd8fd845;p=Benchmarks_CSolver.git changing API for nqueens --- diff --git a/nqueens/nqueens.cc b/nqueens/nqueens.cc index f76ca059..d3317081 100644 --- a/nqueens/nqueens.cc +++ b/nqueens/nqueens.cc @@ -167,13 +167,13 @@ void csolverNQueens(int N){ Ys.push_back(solver->getElementVar(domainSet)); } Set *d1[] = {domainSet, domainSet}; - Function *sub = solver->createFunctionOperator(SATC_SUB, d1, 2, rangeSet, SATC_NOOVERFLOW); + Function *sub = solver->createFunctionOperator(SATC_SUB, rangeSet, SATC_NOOVERFLOW); //X shouldn't be equal for(int i=0; icreatePredicateOperator(SATC_EQUALS, d1, 2); + Predicate *eq = solver->createPredicateOperator(SATC_EQUALS); Element *inputs2 [] = {e1x, e2x}; BooleanEdge equals = solver->applyPredicate(eq, inputs2, 2); solver->addConstraint(solver->applyLogicalOperation(SATC_NOT, equals)); @@ -184,7 +184,7 @@ void csolverNQueens(int N){ for(int j=i+1; jcreatePredicateOperator(SATC_EQUALS, d1, 2); + Predicate *eq = solver->createPredicateOperator(SATC_EQUALS); Element *inputs2 [] = {e1y, e2y}; BooleanEdge equals = solver->applyPredicate(eq, inputs2, 2); solver->addConstraint(solver->applyLogicalOperation(SATC_NOT, equals)); @@ -199,12 +199,12 @@ void csolverNQueens(int N){ Element *e2y = Ys[j]; Element *e1x = Xs[i]; Element *e2x = Xs[j]; - Function *f1 = solver->createFunctionOperator(SATC_SUB, d1, 2, rangeSet, SATC_IGNORE); + Function *f1 = solver->createFunctionOperator(SATC_SUB, rangeSet, SATC_IGNORE); Element *in1[] = {e1x, e2x}; Element *subx = solver->applyFunction(f1, in1, 2, overflow); Element *in2[] = {e1y, e2y}; Element *suby = solver->applyFunction(f1, in2, 2, overflow); - Predicate *eq = solver->createPredicateOperator(SATC_EQUALS, d2, 2); + Predicate *eq = solver->createPredicateOperator(SATC_EQUALS); Element *inputs2 [] = {subx, suby}; BooleanEdge equals = solver->applyPredicate(eq, inputs2, 2); solver->addConstraint(solver->applyLogicalOperation(SATC_NOT, equals)); @@ -231,7 +231,7 @@ void csolverNQueens(int N){ int main(int argc, char * argv[]){ if(argc < 2){ - printf("Two arguments are needed\n./nqueen \n"); + printf("Two arguments are needed\n./nqueen [-csolver]\n"); exit(-1); } int N = atoi(argv[1]); @@ -243,4 +243,4 @@ int main(int argc, char * argv[]){ csolverNQueens(N); } return 0; -} \ No newline at end of file +}