| 49 | // This set is likely to progressively enlarge... |
| 50 | |
| 51 | int main() { |
| 52 | unsigned long int nodes; |
| 53 | unsigned long int steps; |
| 54 | |
| 55 | // Ax in 1..3 [] -> x=1 |
| 56 | int sc1[] = {1}; |
| 57 | bool q1[] = {QECODE_UNIVERSAL}; |
| 58 | Qcop test1(1,q1,sc1); |
| 59 | test1.QIntVar(0,1,3); |
| 60 | IntVarArgs b1(1); |
| 61 | b1[0] = test1.var(0); |
| 62 | branch(*(test1.space()),b1,INT_VAR_SIZE_MIN(),INT_VAL_MIN()); |
| 63 | test1.nextScope(); |
| 64 | rel(*(test1.space()),test1.var(0) == 1); |
| 65 | test1.makeStructure(); |
| 66 | QCSP_Solver s1(&test1); |
| 67 | nodes=0; |
| 68 | Strategy ret1=s1.solve(nodes,INT_MAX,true); |
| 69 | cout<<"Problem 1 : result = "<<(ret1.isFalse()?"FALSE":"TRUE")<<", sould be FALSE."<<endl; |
| 70 | cout<<nodes<<" nodes."<<endl; |
| 71 | printStr(ret1); |
| 72 | |
| 73 | //Ex in 1..3 [] st x=1 |
| 74 | int sc2[] = {1}; |
| 75 | bool q2[] = {QECODE_EXISTENTIAL}; |
| 76 | Qcop test2(1,q2,sc2); |
| 77 | test2.QIntVar(0,1,3); |
| 78 | |
| 79 | IntVarArgs b2(1); |
| 80 | b2[0] = test2.var(0); |
| 81 | branch(*(test2.space()),b2,INT_VAR_SIZE_MIN(),INT_VAL_MIN()); |
| 82 | |
| 83 | test2.nextScope(); |
| 84 | rel(*(test2.space()),test2.var(0) == 1); |
| 85 | test2.makeStructure(); |
| 86 | QCSP_Solver s2(&test2); |
| 87 | nodes=0; |
| 88 | Strategy ret2=s2.solve(nodes,INT_MAX,true); |
| 89 | cout<<"Problem 2 : result = "<<(ret2.isFalse()?"FALSE":"TRUE")<<", sould be TRUE."<<endl; |
| 90 | cout<<nodes<<" nodes."<<endl; |
| 91 | printStr(ret2); |
| 92 | |
| 93 | |
| 94 | |
| 95 | //Ax in 1..3 [x=1] -> x=2 |
| 96 | int sc3[] = {1}; |
| 97 | bool q3[] = {QECODE_UNIVERSAL}; |
| 98 | Qcop test3(1,q3,sc3); |
| 99 | test3.QIntVar(0,1,3); |
| 100 | rel(*(test3.space()),test3.var(0) == 1); |
| 101 | |
| 102 | IntVarArgs b3(1); |
| 103 | b3[0] = test3.var(0); |
| 104 | branch(*(test3.space()),b3,INT_VAR_SIZE_MIN(),INT_VAL_MIN()); |
| 105 | |
| 106 | test3.nextScope(); |
| 107 | rel(*(test3.space()),test3.var(0) == 2); |
| 108 | test3.makeStructure();; |
nothing calls this directly
no test coverage detected