bundles / scipy latest / scipy / optimize / _linprog_util / _LPProblem
class
scipy.optimize._linprog_util:_LPProblem
source: /scipy/optimize/_linprog_util.py
Signature
class _LPProblem ( c , A_ub = None , b_ub = None , A_eq = None , b_eq = None , bounds = None , x0 = None , integrality = None ) Summary
Represents a linear-programming problem.
Attributes
c: 1D arrayThe coefficients of the linear objective function to be minimized.
A_ub: 2D array, optionalThe inequality constraint matrix. Each row of
A_ubspecifies the coefficients of a linear inequality constraint onx.b_ub: 1D array, optionalThe inequality constraint vector. Each element represents an upper bound on the corresponding value of
A_ub @ x.A_eq: 2D array, optionalThe equality constraint matrix. Each row of
A_eqspecifies the coefficients of a linear equality constraint onx.b_eq: 1D array, optionalThe equality constraint vector. Each element of
A_eq @ xmust equal the corresponding element ofb_eq.bounds: various valid formats, optionalThe bounds of
x, asminandmaxpairs. If bounds are specified for all N variables separately, valid formats are: * a 2D array (N x 2); * a sequence of N sequences, each with 2 values. If all variables have the same bounds, the bounds can be specified as a 1-D or 2-D array or sequence with 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). Absent lower and/or upper bounds can be specified as -numpy.inf (no lower bound), numpy.inf (no upper bound) or None (both).x0: 1D array, optionalGuess 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.integrality: 1-D array or int, optionalIndicates the type of integrality constraint on each decision variable.
0Continuous variable; no integrality constraint.1Integer variable; decision variable must be an integer withinbounds.2Semi-continuous variable; decision variable must be withinboundsor take value0.3Semi-integer variable; decision variable must be an integer withinboundsor take value0.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 toc.shapeusingnp.broadcast_to.This argument is currently used only by the
'highs'method and ignored otherwise.
Notes
This namedtuple supports 2 ways of initialization: >>> lp1 = _LPProblem(c=[-1, 4], A_ub=[[-3, 1], [1, 2]], b_ub=[6, 4]) >>> lp2 = _LPProblem([-1, 4], [[-3, 1], [1, 2]], [6, 4])
Note that only c is a required argument here, whereas all other arguments A_ub, b_ub, A_eq, b_eq, bounds, x0 are optional with default values of None. For example, A_eq and b_eq can be set without A_ub or b_ub: >>> lp3 = _LPProblem(c=[-1, 4], A_eq=[[2, 1]], b_eq=[10])
Aliases
-
scipy.optimize._linprog._LPProblem