docplex.mp.relax_linear module¶
- class docplex.mp.relax_linear.LinearRelaxer[source]¶
Bases:
object
This class returns a linear relaxation for a MIP model.
- linear_relaxation(mdl, return_partial=False, **kwargs)[source]¶
Returns a continuous relaxation of the model.
Variable types are set to continuous (note that semi-xxx variables have their LB set to zero)
Some constructs are not relaxable, for example, piecewise-linear expressions, SOS sets, logical constraints… When a model contains at least one of these non-relaxable constructs, a message is printed and this method returns None.
By default, model parameters are not copied. If you want to copy them, pass the keyword argument copy_parameters=True
- Parameters:
mdl – the initial model
return_partial – if True, returns the partially relaxed model anyway, default is False, if an unrelaxable item is encountered, None is returned
- Returns:
a new model with continuous relaxation, if possible, else None.