Linear programming: minimize a linear objective function subject to linear equality and inequality constraints using the revised simplex method.
Deprecated since version 1.9.0: method=ârevised simplexâ will be removed in SciPy 1.11.0. It is replaced by method=âhighsâ because the latter is faster and more robust.
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 ârevised simplexâ. âhighsâ, âhighs-dsâ, âhighs-ipmâ, âinterior-pointâ (default), and âsimplexâ (legacy) are also available.
Callback function to be executed once per iteration.
Guess values of the decision variables, which will be refined by the optimization algorithm. This argument is currently used only by the ârevised simplexâ method, and can only be used if x0 represents a basic feasible solution.
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 variables, 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 limit reached.
2
: Problem appears to be infeasible.
3
: Problem appears to be unbounded.
4
: Numerical difficulties encountered.
5
: Problem has no constraints; turn presolve on.
6
: Invalid guess provided.
A string descriptor of the exit status of the algorithm.
The total number of iterations performed in all phases.
The maximum number of iterations to perform in either phase.
Set to True
if indicators of optimization status are to be printed to the console each iteration.
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 tolerance which determines when a solution is âclose enoughâ to zero in Phase 1 to be considered a basic feasible solution or close enough to positive to serve as an optimal solution.
Set to True
to automatically perform equilibration. Consider using this option if the numerical values in the constraints are separated by several orders of magnitude.
Set to False
to disable automatic redundancy removal.
The maximum number of updates performed on the LU factorization. After this many updates is reached, the basis matrix is factorized from scratch.
Minimize Amortized Solve Time. If enabled, the average time to solve a linear system using the basis factorization is measured. Typically, the average solve time will decrease with each successive solve after initial factorization, as factorization takes much more time than the solve operation (and updates). Eventually, however, the updated factorization becomes sufficiently complex that the average solve time begins to increase. When this is detected, the basis is refactorized from scratch. Enable this option to maximize speed at the risk of nondeterministic behavior. Ignored if maxupdate
is 0.
Pivot rule: Minimum Reduced Cost (âmrcâ) or Blandâs rule (âblandâ). Choose Blandâs rule if iteration limit is reached and cycling is suspected.
Optional arguments not used by this particular solver. If unknown_options is non-empty a warning is issued listing all unused options.
Notes
Method revised simplex uses the revised simplex method as described in [9], except that a factorization [11] of the basis matrix, rather than its inverse, is efficiently maintained and used to solve the linear systems at each iteration of the algorithm.
References
[9]Bertsimas, Dimitris, and J. Tsitsiklis. âIntroduction to linear programming.â Athena Scientific 1 (1997): 997.
[11]Bartels, Richard H. âA stabilization of the simplex method.â Journal in Numerische Mathematik 16.5 (1971): 414-434.
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