To create a relaxed version of your model that contains only continuous variables and removes SOS and general constraints, use:

relax = model.relax()

This creates a new Model object and does not modify the original model.

Another option is to "relax" a model in place by iterating through the model variables and changing their type:

for v in model.getVars():

v.setAttr('vtype', 'C')

In addition, all nonlinear constraints must be removed from the model.

Yet another alternative to relaxing the model is to fix all integer variables to their value in the loaded solution:

fixed = model.fixed()

The "fixed" method returns a new model object that only contains continuous variables.

### Further information

## Comments

0 comments

Article is closed for comments.