bundles / scipy 1.17.1 / scipy / optimize / _linprog_simplex / _solve_simplex
function
scipy.optimize._linprog_simplex:_solve_simplex
Signature
def _solve_simplex ( T , n , basis , callback , postsolve_args , maxiter = 1000 , tol = 1e-09 , phase = 2 , bland = False , nit0 = 0 ) Summary
Solve a linear programming problem in "standard form" using the Simplex Method. Linear Programming is intended to solve the following problem form:
Extended Summary
Minimize
c @ xSubject to
A @ x == b x >= 0
Parameters
T: 2-D arrayA 2-D array representing the simplex tableau, T, corresponding to the linear programming problem. It should have the form:
[[A[0, 0], A[0, 1], ..., A[0, n_total], b[0]],
[A[1, 0], A[1, 1], ..., A[1, n_total], b[1]], . . . [A[m, 0], A[m, 1], ..., A[m, n_total], b[m]], [c[0], c[1], ..., c[n_total], 0]]
for a Phase 2 problem, or the form:
[[A[0, 0], A[0, 1], ..., A[0, n_total], b[0]],
[A[1, 0], A[1, 1], ..., A[1, n_total], b[1]], . . . [A[m, 0], A[m, 1], ..., A[m, n_total], b[m]], [c[0], c[1], ..., c[n_total], 0], [c'[0], c'[1], ..., c'[n_total], 0]]
for a Phase 1 problem (a problem in which a basic feasible solution is sought prior to maximizing the actual objective.
Tis modified in place by_solve_simplex.
n: intThe number of true variables in the problem.
basis: 1-D arrayAn array of the indices of the basic variables, such that basis[i] contains the column corresponding to the basic variable for row i. Basis is modified in place by _solve_simplex
callback: callable, optionalIf a callback function is provided, it will be called within each iteration of the algorithm. The callback must accept a scipy.optimize.OptimizeResult consisting of the following fields:
x
x
fun
fun
success
success
slack
slack
con
con
phase
phase
status
status
nit
nit
message
message
postsolve_args: tupleData needed by _postsolve to convert the solution to the standard-form problem into the solution to the original problem.
maxiter: intThe maximum number of iterations to perform before aborting the optimization.
tol: floatThe 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.
phase: intThe phase of the optimization being executed. In phase 1 a basic feasible solution is sought and the T has an additional row representing an alternate objective function.
bland: boolIf True, choose pivots using Bland's rule [3]. In problems which fail to converge due to cycling, using Bland's rule can provide convergence at the expense of a less optimal path about the simplex.
nit0: intThe initial iteration number used to keep an accurate iteration total in a two-phase problem.
Returns
nit: intThe number of iterations. Used to keep an accurate iteration total in the two-phase problem.
status: intAn integer representing the exit status of the optimization
0 : Optimization terminated successfully 1 : Iteration limit reached 2 : Problem appears to be infeasible 3 : Problem appears to be unbounded 4 : Serious numerical difficulties encountered
Aliases
-
scipy.optimize._linprog_simplex._solve_simplex