In some applications you may want to solve the modification of another model, in order, for example, to do scenario analysis or to make adaptations based on the solution of the first model. To do this, you do not have to start a new model from scratch, but instead you can take an existing model and change it to your needs. This is done by calling the modification methods of the individual modeling objects.
When an extracted model is modified, the modification is tracked in the cplex
object. This is done through notification. Whenever a modification method is called, cplex
objects that have extracted the model are notified about it. The cplex
objects then track the modification in their internal data structures.
Not only does ILOG CPLEX track all modifications of the model it has extracted, but also it tries to maintain as much solution information from a previous invocation of solve
() as is possible and reasonable.
We already encountered what is perhaps the most important modification method, that is, the method IloModel::add()
for adding modeling objects to a model. Conversely, you may call IloModel::remove()
to remove a modeling object from a model. Objective functions can be modified by changing their sense and by editing their expression, or by changing their expression completely. Similarly, the bounds of constraints and their expressions can be modified. For a complete list of supported modifications, see the documentation of the individual modeling objects in the ILOG Concert Reference Manual.