Originally posted by: deadlock_
What I'm trying to do is to solve a model once with a given input, and then a second time with another input. The two resulting objective values should be printed on the console. Here's what I have tried so far:
dvar int x;
int y[1..1];
minimize x;
subject to {
x >= y[1];
}
main
{
thisOplModel.y[1] = 10;
thisOplModel.generate();
cplex.solve();
writeln(cplex.getObjValue());
cplex.clearModel();
var newModel = new IloOplModel(thisOplModel.modelDefinition, cplex);
var newData = thisOplModel.dataElements;
newData.y[1] = 11;
newModel.addDataSource(newData);
newModel.generate();
cplex.solve();
writeln(cplex.getObjValue());
}
However, I currently get the following error:
Scripting runtime error: Data element "y" does not exist.
The error seems to occur in the following line:
newData.y[1] = 11;
So it seems that addDataSource() does not work as intended.
Any help is appreciated.
#DecisionOptimization#OPLusingCPLEXOptimizer