Hello,
I'm interested in solving an IP problem, laid out as follows:
>>> prob = LpProblem("test", LpMinimize)
>>> x = LpVariable.dict("choice", range(1,10), lowbound=0, upbound=1, LpInteger)
>>> prob += sum(c[i]*x[i] for i in range(1,10)), "objective"
I would like to add an elastic constraint to prob, which is necessary for ensuring feasibility. Is it correct to "add" it as prob += elastic_contraint?
Based on the documentation, I've tried the following:
>>> e = LpAffineExpression([(x[i],a[i]) for i in range(1,10)])
>>> c = LpConstraint(e, "constraint", sense=0, rhs=b)
>>> prob += c.makeElasticSubproblem(penalty=0, proportionFreeBound=0.05)
I just need some clarity on the last line, which produces the following error:
TypeError: Can only add LpConstraintVar, LpConstraint, LpAffineExpression or True objects
Thanks!