Linear programming: minimize a linear objective function subject to linear equality and inequality constraints using one of the HiGHS solvers.
Linear programming solves problems of the following form:
\[\begin{split}\min_x \ & c^T x \\ \mbox{such that} \ & A_{ub} x \leq b_{ub},\\ & A_{eq} x = b_{eq},\\ & l \leq x \leq u ,\end{split}\]
where \(x\) is a vector of decision variables; \(c\), \(b_{ub}\), \(b_{eq}\), \(l\), and \(u\) are vectors; and \(A_{ub}\) and \(A_{eq}\) are matrices.
Alternatively, thatâs:
minimize:
such that:
A_ub @ x <= b_ub A_eq @ x == b_eq lb <= x <= ub
Note that by default lb = 0
and ub = None
unless specified with bounds
.
The coefficients of the linear objective function to be minimized.
The inequality constraint matrix. Each row of A_ub
specifies the coefficients of a linear inequality constraint on x
.
The inequality constraint vector. Each element represents an upper bound on the corresponding value of A_ub @ x
.
The equality constraint matrix. Each row of A_eq
specifies the coefficients of a linear equality constraint on x
.
The equality constraint vector. Each element of A_eq @ x
must equal the corresponding element of b_eq
.
A sequence of (min, max)
pairs for each element in x
, defining the minimum and maximum values of that decision variable. Use None
to indicate that there is no bound. By default, bounds are (0, None)
(all decision variables are non-negative). If a single tuple (min, max)
is provided, then min
and max
will serve as bounds for all decision variables.
This is the method-specific documentation for âhighsâ, which chooses automatically between âhighs-dsâ and âhighs-ipmâ. âinterior-pointâ (default), ârevised simplexâ, and âsimplexâ (legacy) are also available.
Indicates the type of integrality constraint on each decision variable.
0
: Continuous variable; no integrality constraint.
1
: Integer variable; decision variable must be an integer within bounds.
2
: Semi-continuous variable; decision variable must be within bounds or take value 0
.
3
: Semi-integer variable; decision variable must be an integer within bounds or take value 0
.
By default, all variables are continuous.
For mixed integrality constraints, supply an array of shape c.shape. To infer a constraint on each decision variable from shorter inputs, the argument will be broadcast to c.shape using np.broadcast_to.
This argument is currently used only by the 'highs'
method and ignored otherwise.
A scipy.optimize.OptimizeResult
consisting of the fields:
The values of the decision variables that minimizes the objective function while satisfying the constraints.
The optimal value of the objective function c @ x
.
The (nominally positive) values of the slack, b_ub - A_ub @ x
.
The (nominally zero) residuals of the equality constraints, b_eq - A_eq @ x
.
True
when the algorithm succeeds in finding an optimal solution.
An integer representing the exit status of the algorithm.
0
: Optimization terminated successfully.
1
: Iteration or time limit reached.
2
: Problem appears to be infeasible.
3
: Problem appears to be unbounded.
4
: The HiGHS solver ran into a problem.
A string descriptor of the exit status of the algorithm.
The total number of iterations performed. For the HiGHS simplex method, this includes iterations in all phases. For the HiGHS interior-point method, this does not include crossover iterations.
The number of primal/dual pushes performed during the crossover routine for the HiGHS interior-point method. This is 0
for the HiGHS simplex method.
Solution and sensitivity information corresponding to the inequality constraints, b_ub. A dictionary consisting of the fields:
The (nominally positive) values of the slack variables, b_ub - A_ub @ x
. This quantity is also commonly referred to as âslackâ.
The sensitivity (partial derivative) of the objective function with respect to the right-hand side of the inequality constraints, b_ub.
Solution and sensitivity information corresponding to the equality constraints, b_eq. A dictionary consisting of the fields:
The (nominally zero) residuals of the equality constraints, b_eq - A_eq @ x
.
The sensitivity (partial derivative) of the objective function with respect to the right-hand side of the equality constraints, b_eq.
Solution and sensitivity information corresponding to the lower and upper bounds on decision variables, bounds.
The (nominally positive) values of the quantity x - lb
(lower) or ub - x
(upper).
The sensitivity (partial derivative) of the objective function with respect to the lower and upper bounds.
The maximum number of iterations to perform in either phase. For âhighs-ipmâ, this does not include the number of crossover iterations. Default is the largest possible value for an int
on the platform.
False
)
Set to True
if indicators of optimization status are to be printed to the console during optimization.
True
)
Presolve attempts to identify trivial infeasibilities, identify trivial unboundedness, and simplify the problem before sending it to the main solver. It is generally recommended to keep the default setting True
; set to False
if presolve is to be disabled.
The maximum time in seconds allotted to solve the problem; default is the largest possible value for a double
on the platform.
Dual feasibility tolerance for âhighs-dsâ. The minimum of this and primal_feasibility_tolerance
is used for the feasibility tolerance of âhighs-ipmâ.
Primal feasibility tolerance for âhighs-dsâ. The minimum of this and dual_feasibility_tolerance
is used for the feasibility tolerance of âhighs-ipmâ.
1e-08
)
Optimality tolerance for âhighs-ipmâ. Minimum allowable value is 1e-12.
Strategy for simplex dual edge weights. The default, None
, automatically selects one of the following.
'dantzig'
uses Dantzigâs original strategy of choosing the most negative reduced cost.
'devex'
uses the strategy described in [15].
steepest
uses the exact steepest edge strategy as described in [16].
'steepest-devex'
begins with the exact steepest edge strategy until the computation is too costly or inexact and then switches to the devex method.
Currently, None
always selects 'steepest-devex'
, but this may change as new options become available.
Termination criterion for MIP solver: solver will terminate when the gap between the primal objective value and the dual objective bound, scaled by the primal objective value, is <= mip_rel_gap.
Optional arguments not used by this particular solver. If unknown_options
is non-empty, a warning is issued listing all unused options.
Notes
Method âhighs-dsâ is a wrapper of the C++ high performance dual revised simplex implementation (HSOL) [13], [14]. Method âhighs-ipmâ is a wrapper of a C++ implementation of an interior-point method [13]; it features a crossover routine, so it is as accurate as a simplex solver. Method âhighsâ chooses between the two automatically. For new code involving linprog
, we recommend explicitly choosing one of these three method values instead of âinterior-pointâ (default), ârevised simplexâ, and âsimplexâ (legacy).
The result fields ineqlin, eqlin, lower, and upper all contain marginals, or partial derivatives of the objective function with respect to the right-hand side of each constraint. These partial derivatives are also referred to as âLagrange multipliersâ, âdual valuesâ, and âshadow pricesâ. The sign convention of marginals is opposite that of Lagrange multipliers produced by many nonlinear solvers.
References
[13] (1,2)Huangfu, Q., Galabova, I., Feldmeier, M., and Hall, J. A. J. âHiGHS - high performance software for linear optimization.â https://highs.dev/
[14]Huangfu, Q. and Hall, J. A. J. âParallelizing the dual revised simplex method.â Mathematical Programming Computation, 10 (1), 119-142, 2018. DOI: 10.1007/s12532-017-0130-5
[15]Harris, Paula MJ. âPivot selection methods of the Devex LP code.â Mathematical programming 5.1 (1973): 1-28.
[16]Goldfarb, Donald, and John Ker Reid. âA practicable steepest-edge simplex algorithm.â Mathematical Programming 12.1 (1977): 361-371.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4