Question

I want to reoptimize a model only, if the current model has not been optimized including all its components.

It tried with the following code:

if (masterProblem.getStatus() == IloCplex.Status.Optimal) {
  // do something
} else {
  // re-optimize
}

This seems to be wrong, because

masterProblem.getStatus() == IloCplex.Status.Optimal

yields true, after I added new columns to the model. I want a statement, that is true, iff the problem is optimized with all its elements.

Was it helpful?

Solution 2

The problem here was that I used

getStatus()

instead of

getCplexStatus()

OTHER TIPS

Although, in the manual, the description of lots of functions (e.g., IloObjective::setLinearCoef, IloRange::setExpr, etc.) state that

... and it creates the appropriate instance of the undocumented class IloChange to notify algorithms about this change of an extractable object in the model.

Note: The member function ... notifies Concert Technology algorithms about this change of this invoking object.

Since, IloChange is undocumented (and the headers does not give any clue) there seems to be no viable way but keeping a boolean variable which states whether the model is modified after the last optimization (e.g. bool isThereAnyChangeOnModel = true;).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top