bundles / scipy 1.18.0 / scipy / optimize / _linprog_util / _parse_linprog
function
scipy.optimize._linprog_util:_parse_linprog
Signature
def _parse_linprog(lp, options, meth)Summary
Parse the provided linear programming problem
Extended Summary
_parse_linprog employs two main steps _check_sparse_inputs and _clean_inputs. _check_sparse_inputs checks for sparsity in the provided constraints (A_ub and ``A_eq) and if these match the provided sparsity optional values.
_clean inputs checks of the provided inputs. If no violations are identified the objective vector, upper bound constraints, equality constraints, and simple bounds are returned in the expected format.
Parameters
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, asminandmaxpairs. If bounds are specified for all N variables separately, valid formats are: * a 2D array (2 x N or N x 2); * a sequence of N sequences, each with 2 values. If all variables have the same bounds, a single pair of values can be specified. Valid formats are: * a sequence with 2 scalar values; * a sequence with a single element containing 2 scalar values. If all variables have a lower bound of 0 and no upper bound, the bounds parameter can be omitted (or given as None).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
x0represents a basic feasible solution.
options: dictA dictionary of solver options. All methods accept the following generic options:
maxiter
Maximum number of iterations to perform.
disp
Set to True to print convergence messages.
For method-specific options, see
show_options('linprog').
Returns
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, asminandmaxpairs, one for each of the N elements ofx. The N x 2 array contains lower bounds in the first column and upper bounds in the 2nd. Unbounded variables have lower bound -np.inf and/or upper bound np.inf.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
x0represents a basic feasible solution.
options: dict, optionalA dictionary of solver options. All methods accept the following generic options:
maxiter
Maximum number of iterations to perform.
disp
Set to True to print convergence messages.
For method-specific options, see
show_options('linprog').
Aliases
scipy.optimize._linprog._parse_linprog