Let's say I have 2 decision variables a, b and 2 constants constant_a, constant_b. I want to maximize a and b but add a penalty whenever a is superior to constant_a or b is superior to constant_b.
The penalty should be -0.05 * (a - constant_a) (and an equal setup for b).
How may i implement this in PuLP? Note that this is a simplified version of my actual linear optimization problem.
I tried elastic constraints but this way I may only specifiy a fixed penalty value (and not -0.05 * (decision variable - constant)).
I will answer the immediate question of how to construct such a penalty, but in context I will maintain that it still probably doesn't accomplish what OP imagines it will.
The penalty variables have a lower bound of 0 (taken when the associated variables are below the penalty limit), no upper bound, and a constraint that they have a lower limit of the penalty value when subtracted from the constraint limit.