bundles / scipy latest / scipy / optimize / _linprog_util / _postsolve
function
scipy.optimize._linprog_util:_postsolve
source: build-install/usr/lib/python3.14/site-packages/scipy/optimize/_linprog_util.py:1314
Signature
def _postsolve(x, postsolve_args, complete = False)Summary
Given solution x to presolved, standard form linear program x, add fixed variables back into the problem and undo the variable substitutions to get solution to original linear program. Also, calculate the objective function value, slack in original upper bound constraints, and residuals in original equality constraints.
Parameters
x: 1-D arraySolution vector to the standard-form problem.
postsolve_args: tupleData needed by _postsolve to convert the solution to the standard-form problem into the solution to the original problem, including:
lp: A `scipy.optimize._linprog_util._LPProblem` consisting of the following fields:c
The coefficients of the linear objective function to be minimized.
A_ub
The inequality constraint matrix. Each row of
A_ubspecifies the coefficients of a linear inequality constraint onx.b_ub
The inequality constraint vector. Each element represents an upper bound on the corresponding value of
A_ub @ x.A_eq
The equality constraint matrix. Each row of
A_eqspecifies the coefficients of a linear equality constraint onx.b_eq
The equality constraint vector. Each element of
A_eq @ xmust equal the corresponding element ofb_eq.bounds
The bounds of
x, lower bounds in the 1st column, upper bounds in the 2nd column. The bounds are possibly tightened by the presolve procedure.x0
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.
revstack: list of functionsthe functions in the list reverse the operations of _presolve() the function signature is x_org = f(x_mod), where x_mod is the result of a presolve step and x_org the value at the start of the step
complete: boolWhether the solution is was determined in presolve (
Trueif so)
Returns
x: 1-D arraySolution vector to original linear programming problem
: fun: floatoptimal objective value for original problem
slack: 1-D arrayThe (non-negative) slack in the upper bound constraints, that is,
b_ub - A_ub @ xcon: 1-D arrayThe (nominally zero) residuals of the equality constraints, that is,
b - A_eq @ x
Aliases
scipy.optimize._linprog._postsolve