Modifying and re-optimizing in the CPLEX Python API

Modify a model and re-optimize in the CPLEX Python API to see the effect.

In many situations, the solution to a model is only the first step. One of the important features of the CPLEX Python API is the ability to modify and then re-optimize the model even after it has been created and solved one or more times.

After CPLEX solves a problem, you can add, remove, or modify constraints to produce a different but related model. When you modify a problem, CPLEX tries to maintain as much information from the previous solution as reasonable and possible, in order to have a better start when it solves the modified problem. In particular, when solving LPs or QPs with a simplex optimizer, CPLEX attempts to maintain a basis which will be used the next time the method solve is invoked, with the aim of making subsequent solves go faster.