Optlang provides high-level solver configuration via interface.Model.configuration.

class optlang.interface.Configuration(problem=None, *args, **kwargs)[source]

Bases: object

Optimization solver configuration. This object allows the user to change certain parameters and settings in the solver. It is meant to allow easy access to a few common and important parameters. For information on changing other solver parameters, please consult the documentation from the solver provider. Some changeable parameters are listed below. Note that some solvers might not implement all of these and might also implement additional parameters.


int from 0 to 3 – Changes the level of output.


int or None – The time limit in second the solver will use to optimize the problem.


Boolean or ‘auto’ – Tells the solver whether to use (solver-specific) pre-processing to simplify the problem. This can decrease solution time, but also introduces overhead. If set to ‘auto’ the solver will first try to solve without pre-processing, and only turn in on in case no optimal solution can be found.


str – Select which algorithm the LP solver uses, e.g. simplex, barrier, etc.

classmethod clone(config, problem=None, **kwargs)[source]

Turn pre-processing on or off. Set to ‘auto’ to only use presolve if no optimal solution can be found.


Timeout parameter (seconds).


Verbosity level.

0: no output 1: error and warning messages only 2: normal output 3: full output