On T esting C onstraint P rograms Nadjib LAZAAR* , Arnaud GOTLIEB*, Yahia LEBBAH** *INRIA Rennes Bretagne Atlantique ** Université d'Oran Es-Senia CP’2010 St -Andrews, Scotland 08 september 1 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) Refinement in CP 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) Refinement in CP SPEC 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) Refinement in CP SPEC 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) Refinement in CP SPEC 2 /21
Motivations Numerous CP modeling languages and platforms have been developed (OPL, SICStus Prolog, ZINC, GECODE, CHOCO…) for solving combinatorial problems that arise in optimization, planning, scheduling… CP programs begin to be used in business-critical systems (e.g., combinatorial auctions) Refinement in CP SPEC 2 /21
Golomb Rulers 3 /21
Golomb Rulers 3 /21
Golomb Rulers in O ptimization P rogramming L anguage M using CP; int m=...; dvar int x[1..m] in 0..m*m; minimize x[m]; subject to { (1) forall (i in 1..m-1) x[i] < x[i+1]; (2) forall (i in 1..m, j in 1..m, k in 1..m, l in 1..m: (i < j, k < l)) x[j] - x[i] != x[l] - x[k]; } 4 /21
Golomb Rulers in O ptimization P rogramming L anguage M P using CP; using CP; int m=...; int m=...; tuple indexerTuple {int i; dvar int x[1..m] in 0..m*m; int j;} {indexerTuple} indexes1 = {<i, j> | ordered i,j in 1..m}; minimize x[m]; {indexerTuple} indexes2 = {<i, j> | ordered i,j in 1..m div 2}; subject to { dvar int x[1..m] in 0..m*m; (1) forall (i in 1..m-1) dvar int d[indexes1]; x[i] < x[i+1]; (2) forall (i in 1..m, j in 1..m, minimize x[m]; k in 1..m, l in 1..m: (i < j, k < l)) subject to { x[j] - x[i] != x[l] - x[k]; (1) x[1]==0; } (2) forall (i in (1)..m-1) x[i] < x[i+1]; (3) forall(ind in indexes1) d[ind] == x[ind.i]-x[ind.j]; (4) x[m] >= (m * (m - 1)) / 2; (5) x[2] <= x[m]-x[m-1]; (6) forall(ind1,ind2,ind3:(ind1.i==ind2.i)&&(ind2.j==ind3.i)&& (ind1.j==ind3.j)&&( ind1.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]; (7) forall(ind1,ind2,ind3,ind4 in indexes2 : (ind1.i==ind2.i)&&(ind1.j==ind3.j)&&(ind2.j==ind4.j) &&(ind3.i==ind4.i)&&(ind1.i<m-1)&&(3<ind1.j<m+1) &&(2<ind2.j<m)&&(1<ind3.i<m-1)&& (ind1.i < ind3.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]-d[ind4]; (8) forall(ind in indexes2, k in 1..m div 2) x[ind.i+1]==x[ind.i]+k => x[ind.j+1] != x[ind.j]+k; } 4 /21
Golomb Rulers in O ptimization P rogramming L anguage M P using CP; using CP; int m=...; int m=...; tuple indexerTuple {int i; dvar int x[1..m] in 0..m*m; int j;} {indexerTuple} indexes1 = {<i, j> | ordered i,j in 1..m}; minimize x[m]; {indexerTuple} indexes2 = {<i, j> | ordered i,j in 1..m div 2}; subject to { dvar int x[1..m] in 0..m*m; (1) forall (i in 1..m-1) dvar int d[indexes1]; x[i] < x[i+1]; (2) forall (i in 1..m, j in 1..m, minimize x[m]; k in 1..m, l in 1..m: (i < j, k < l)) subject to { x[j] - x[i] != x[l] - x[k]; (1) x[1]==0; } (2) forall (i in (1)..m-1) x[i] < x[i+1]; (3) forall(ind in indexes1) d[ind] == x[ind.i]-x[ind.j]; (4) x[m] >= (m * (m - 1)) / 2; (5) x[2] <= x[m]-x[m-1]; Does P conform to M (6) forall(ind1,ind2,ind3:(ind1.i==ind2.i)&&(ind2.j==ind3.i)&& (ind1.j==ind3.j)&&( ind1.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]; (7) forall(ind1,ind2,ind3,ind4 in indexes2 : (ind1.i==ind2.i)&&(ind1.j==ind3.j)&&(ind2.j==ind4.j) &&(ind3.i==ind4.i)&&(ind1.i<m-1)&&(3<ind1.j<m+1) &&(2<ind2.j<m)&&(1<ind3.i<m-1)&& (ind1.i < ind3.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]-d[ind4]; (8) forall(ind in indexes2, k in 1..m div 2) x[ind.i+1]==x[ind.i]+k => x[ind.j+1] != x[ind.j]+k; } 4 /21
Golomb Rulers in O ptimization P rogramming L anguage M P using CP; using CP; int m=...; int m=...; tuple indexerTuple {int i; dvar int x[1..m] in 0..m*m; int j;} {indexerTuple} indexes1 = {<i, j> | ordered i,j in 1..m}; minimize x[m]; {indexerTuple} indexes2 = {<i, j> | ordered i,j in 1..m div 2}; subject to { dvar int x[1..m] in 0..m*m; (1) forall (i in 1..m-1) dvar int d[indexes1]; x[i] < x[i+1]; (2) forall (i in 1..m, j in 1..m, minimize x[m]; k in 1..m, l in 1..m: (i < j, k < l)) subject to { x[j] - x[i] != x[l] - x[k]; (1) x[1]==0; } (2) forall (i in (1)..m-1) x[i] < x[i+1]; (3) forall(ind in indexes1) d[ind] == x[ind.i]-x[ind.j]; (4) x[m] >= (m * (m - 1)) / 2; (5) x[2] <= x[m]-x[m-1]; Does P conform to M (6) forall(ind1,ind2,ind3:(ind1.i==ind2.i)&&(ind2.j==ind3.i)&& (ind1.j==ind3.j)&&( ind1.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]; m=8 (7) forall(ind1,ind2,ind3,ind4 in indexes2 : (ind1.i==ind2.i)&&(ind1.j==ind3.j)&&(ind2.j==ind4.j) &&(ind3.i==ind4.i)&&(ind1.i<m-1)&&(3<ind1.j<m+1) &&(2<ind2.j<m)&&(1<ind3.i<m-1)&& X= [0 1 3 6 10 26 27 28] (ind1.i < ind3.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]-d[ind4]; (8) forall(ind in indexes2, k in 1..m div 2) x[ind.i+1]==x[ind.i]+k => x[ind.j+1] != x[ind.j]+k; } 4 /21
Golomb Rulers in O ptimization P rogramming L anguage M P using CP; using CP; int m=...; int m=...; tuple indexerTuple {int i; dvar int x[1..m] in 0..m*m; int j;} {indexerTuple} indexes1 = {<i, j> | ordered i,j in 1..m}; minimize x[m]; {indexerTuple} indexes2 = {<i, j> | ordered i,j in 1..m div 2}; subject to { dvar int x[1..m] in 0..m*m; (1) forall (i in 1..m-1) dvar int d[indexes1]; x[i] < x[i+1]; (2) forall (i in 1..m, j in 1..m, minimize x[m]; k in 1..m, l in 1..m: (i < j, k < l)) subject to { x[j] - x[i] != x[l] - x[k]; (1) x[1]==0; } (2) forall (i in (1)..m-1) x[i] < x[i+1]; (3) forall(ind in indexes1) d[ind] == x[ind.i]-x[ind.j]; (4) x[m] >= (m * (m - 1)) / 2; (5) x[2] <= x[m]-x[m-1]; Does P conform to M (6) forall(ind1,ind2,ind3:(ind1.i==ind2.i)&&(ind2.j==ind3.i)&& (ind1.j==ind3.j)&&( ind1.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]; m=8 (7) forall(ind1,ind2,ind3,ind4 in indexes2 : (ind1.i==ind2.i)&&(ind1.j==ind3.j)&&(ind2.j==ind4.j) &&(ind3.i==ind4.i)&&(ind1.i<m-1)&&(3<ind1.j<m+1) &&(2<ind2.j<m)&&(1<ind3.i<m-1)&& X= [0 1 3 6 10 26 27 28] (ind1.i < ind3.i < ind2.j < ind1.j)) d[ind1]==d[ind2]+d[ind3]-d[ind4]; 1 1 (8) forall(ind in indexes2, k in 1..m div 2) x[ind.i+1]==x[ind.i]+k => x[ind.j+1] != x[ind.j]+k; Fault detected in P ! } 4 /21
Contributions • A first framework for testing constraint programs Definitions of testing notions Conformity relations: • Constraint solving problem • Optimization problem • A method and a tool, called CPTEST to detect non- conformities ( e.g., X= [0 1 3 6 10 26 27 28] ) • An experimental validation on two classical benchmarks (Golomb rulers, car sequencing) 5 /21
Notations Model- Oracle M x (k ) 6 /21
Notations Model- CPUT Oracle P z (k) M x (k ) 6 /21
Notations Model- CPUT Oracle Conformity Relation P z (k) M x (k ) 6 /21
Conformity relation in constraint solving problem One Solution (conf k one ) 7 /21
Conformity relation in constraint solving problem One Solution (conf k one ) non-conform M : solutions set of M P : solutions set of P 7 /21
Conformity relation in constraint solving problem One Solution (conf k one ) non-conform M : solutions set of M P : solutions set of P 7 /21
Conformity relation in constraint solving problem One Solution (conf k one ) non-conform M : solutions set of M P : solutions set of P 7 /21
Recommend
More recommend