Originally posted by: MchelLeo
Hi Alex,
I would like to test a constraint to know how is correct or incorrect?. So, I give a example as follows:
tuple myTuple {
key int foo;
key int bar;
int ram;
}
{myTuple} myTuples = {
<1,1,1>,<1,2,1>,<1,3,2>,<2,1,3>,<2,2,1>,<2,3,2>
};;
range r1to5=1..5;
range r1to4=1..4;
int ramArray[r1to5][r1to4];
int ramArray2[foo in r1to5][bar in r1to4]=
(<foo,bar> in myTuples)?item(myTuples,<foo,bar>).ram:0;
execute
{
for(foo in r1to5){
for(bar in r1to4){
if(myTuples.find(foo,bar)) ramArray[foo][bar] = myTuples.find(foo,bar).ram;
else ramArray[foo][bar] = 0;
}
}
}
assert forall(foo in r1to5,bar in r1to4)
ramArray[foo][bar]==ramArray2[foo][bar];
Then, I get results:
But I don't see any other results from assert that created to check calculation steps.
Thanks,
Leo
#DecisionOptimization#OPLusingCPLEXOptimizer