Elastic Constraints
A constraint
where
Define the constraint in two steps:
instantiate constraint (subclass of
LpConstraint
) with target. call its
makeElasticSubProblem()
method which returns an object of typeFixedElasticSubProblem
(subclass ofLpProblem
) - its objective is the minimization of the distance offrom .
constraint = LpConstraint(..., rhs = c)
elasticProblem = constraint.makeElasticSubProblem(
penalty = <penalty_value>,
proportionFreeBound = <freebound_value>,
proportionFreeBoundList = <freebound_list_value>,
)
- where:
<penalty_value>
is a real number<freebound_value>
specifies a symmetric target interval about<freebound_list_value> = [a,b]
, a list of proportions specifying an asymmetric target interval about
The penalty applies to the constraint at points <penalty_value>
can be assessed by examining
the final objective function in the .lp
file written by
LpProblem.writeLP()
.
Example:
>>> constraint_1 = LpConstraint('ex_1',sense=1,rhs=200)
>>> elasticProblem_1 = constraint_1.makeElasticSubproblem(penalty=1, proportionFreeBound = 0.01)
>>> constraint_2 = LpConstraint('ex_2',sense=0,rhs=500)
>>> elasticProblem_2 = constraint_2.makeElasticSubproblem(penalty=1,
proportionFreeBoundList = [0.02, 0.05])
constraint_1 has a penalty-free target interval of 1% either side of the rhs value, 200
constraint_2 has a penalty-free target interval of - 2% on left and 5% on the right side of the rhs value, 500

Following are the methods of the return-value: