Originally posted by: mathygirl
I have an OPL main script that generates an OPL model and performs feasopt on that model. I'd like to iteratively modify which binary decision variable values are fixed to 1, calling feasopt on each iteration. Between each call of feasopt, I need to reset the previous iteration's decision variables back to the original bounds and then modify the bounds for another set of variables. I'd like to do this without regenerating the OPL model.
I've isolated an example of what I am doing, but which is not working:
myModel.mod:
{string} mySet = {"dog", "cat", "pig", "raccoon", "iguana"};
dvar boolean D[mySet];
minimize 0;
subject to {
forall(o in mySet) fixToZero:
D[o] == 0;
}
main {
thisOplModel.generate();
var source = new IloOplModelSource("myModel.mod");
var def = new IloOplModelDefinition(source);
var opl = new IloOplModel(def, cplex);
opl.settings.relaxationLevel=1;
opl.generate();
for(var a in opl.mySet) {
opl.D[a].LB = 1;
var relaxIter = opl.relaxationIterator;
for(var c in relaxIter) {
var constr=c.ct;
writeln("Constraint name is ", constr.name);
}
opl.D[a].LB = 0;
}
}
I get the following error message:
*** ERROR[ENGINE_002] at 23:0 .\relaxationIterationExampleMain.mod: Exception from IBM ILOG CPLEX: CPLEX Error 1217: No
solution exists.
~ Anna
#DecisionOptimization#OPLusingCPLEXOptimizer