Вопрос

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.

Это было полезно?

Решение 2

The problem here was that I used

getStatus()

instead of

getCplexStatus()

Другие советы

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;).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top