9ffcab56c91acf7efab1f200e02b9a021451c881
[satune.git] / src / Test / ordertest.cc
1
2 #include "csolver.h"
3 /**
4  * TotalOrder(5, 1, 4)
5  * 5 => 1
6  * 1 => 4
7  * Result: O(5,1)=0 O(1,4)=0 O(5,4)=0 O(1,5)=1 O(1111,5)=2
8  */
9 int main(int numargs, char **argv) {
10         CSolver *solver = new CSolver();
11         uint64_t set1[] = {5, 1, 4};
12         Set *s = solver->createSet(0, set1, 3);
13         Order *order = solver->createOrder(SATC_TOTAL, s);
14         BooleanEdge b1 =  solver->orderConstraint(order, 5, 1);
15         BooleanEdge b2 =  solver->orderConstraint(order, 1, 4);
16         solver->addConstraint(b1);
17         solver->addConstraint(b2);
18         solver->serialize();
19         if (solver->solve() == 1){
20                 printf("SAT\n");
21                 printf("O(5,1)=%d O(1,4)=%d O(5,4)=%d O(1,5)=%d\n", 
22                         solver->getOrderConstraintValue(order, 5, 1), 
23                         solver->getOrderConstraintValue(order, 1, 4),
24                         solver->getOrderConstraintValue(order, 5, 4),
25                         solver->getOrderConstraintValue(order, 1, 5));
26         } else {
27                 printf("UNSAT\n");
28         }
29         delete solver;
30 }