Originally posted by: Sandeep.chauhan
dvar int xy; // in order to find all solutions
range I = 1..10;
dvar int+ x[I];
dvar int+ y[I];
maximize xy;
subject to
{
forall (i in I){
x[i] + y[i] == 10;
}
xy==sum(i in I)(x[i]+y[i]);
}
execute
{
writeln("x=",x," and y=",y);
}
main {
var nbsol=0;
thisOplModel.generate();
while (1==cplex.solve())
{
thisOplModel.postProcess();
nbsol++;
thisOplModel.xy.UB=thisOplModel.xy.solutionValue-1;
}
writeln("nb solutions = ",nbsol);
}
I am getting only
x= [10 10 10 10 10 10 10 10 10 10] and y= [0 0 0 0 0 0 0 0 0 0]
nb solutions = 1
But I am expecting other results also like
x= [0 10 10 10 10 10 10 10 10 10] and y= [10 0 0 0 0 0 0 0 0 0]
x= [0 0 10 10 10 10 10 10 10 10] and y= [10 10 0 0 0 0 0 0 0 0]
Please help!
#DecisionOptimization#OPLusingCPLEXOptimizer