Skip to content Skip to sidebar Skip to footer

How Do I Make A Constraint Elastic In Pulp?

I am working on a production allocation problem, whereby sales orders have to be allocated over three production plants. I am using PuLP in Python, and this works fine until I try

Solution 1:

I prefer to do this explicitly. That makes it less of a black box.

Your constraint looks like

sum(s, a[s,l]) <= cap[l]

Now add a variable overcap[l] with bounds [0,20%*cap[l]] and write:

sum(s, a[s,l]) <= cap[l] + overcap[l]

and add a penalty to the objective (maximization so use -):

  .... - sum(l,penalty[l]*overcap[l])     

Finally, report nonzero values of overcap[l] to the user.

Post a Comment for "How Do I Make A Constraint Elastic In Pulp?"