2.1 KiB
pulp: Pulp classes
pulp
pulp
LpProblem LpVariable LpAffineExpression LpConstraint LpConstraint.makeElasticSubProblem FixedElasticSubProblem
LpFractionConstraint, FractionElasticSubProblem
The LpProblem Class
LpProblem
Three important attributes of the problem are:
objective
The objective of the problem, an LpAffineExpression
constraints
An ordered dictionary<odict.OrderedDict> of constraints<LpConstraint> of the problem -
indexed by their names.
status
The return status <pulp.constants.LpStatus> of the problem
from the solver.
Some of the more important methods:
solve
roundSolution
setObjective
writeLP
Variables and Expressions
LpElement
LpVariable
Example:
>>> x = LpVariable('x',lowBound = 0, cat='Continuous') >>> y = LpVariable('y', upBound = 5, cat='Integer')
gives x ∈ [0, ∞), y ∈ ( − ∞, 5], an integer.
LpAffineExpression
In brief, LpAffineExpression([(x[i],a[i]) for i in I]) = ∑i ∈ Iaixi where (note the order):
x[i]is anLpVariablea[i]is a numerical coefficient.
lpSum
Constraints
LpConstraint
FixedElasticSubProblem
Combinations and Permutations
combination
allcombinations
permutation
allpermutations
value