micom.duality#

Implements a fast dual formulation.

Module Contents#

Functions#

fast_dual(model, prefix='dual_')

Add dual formulation to the problem.

micom.duality.fast_dual(model, prefix='dual_')[source]#

Add dual formulation to the problem.

A mathematical optimization problem can be viewed as a primal and a dual problem. If the primal problem is a minimization problem the dual is a maximization problem, and the optimal value of the dual is a lower bound of the optimal value of the primal. For linear problems, strong duality holds, which means that the optimal values of the primal and dual are equal (duality gap = 0). This functions takes an optlang Model representing a primal linear problem and returns a new Model representing the dual optimization problem. The provided model must have a linear objective, linear constraints and only continuous variables. Furthermore, the problem must be in standard form, i.e. all variables should be non-negative. Both minimization and maximization problems are allowed.

micom.duality.model#

The model to be dualized.

Type

cobra.Model

micom.duality.prefix#

The string that will be prepended to all variable and constraint names in the returned dual problem.

Type

str

Returns

The coefficients for the new dual objective.

Return type

dict