Originally posted by: SystemAdmin
[afleischer said:]
Hi,
to do that I think you could use a main block and change the LB of the presence you want to set.
For example
using CP;
dvar boolean p[1..10];
dvar interval act[1..10] optional in 0..10;
minimize sum(a in 1..10) presenceOf(act[a]);
subject to
{
forall(a in 1..10) p[a]==presenceOf(act[a]);
}
execute
{
writeln(p);
}
main
{
thisOplModel.generate();
for(var a=1;a<=10;a++)<br />{
thisOplModel.p[a].LB=1;
cp.solve();
thisOplModel.postProcess();
thisOplModel.p[a].LB=0;
}
gives
[1 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0]
[0 0 0 0 0 1 0 0 0 0]
[0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 0 0 1]
Alex
#DecisionOptimization#OPLusingCPOptimizer