I am not really sure where to post about Linear Programming. I am trying to program an LP problem using PuLP, as I am very familiar with Python.
I faced the issue of having decision variables which can take negative value,
i.e. they are bound between -k1 and K2. I have seen the advice of introducing
a new variable into the problem, so the original cosntraint is shifted in
order for the new variable to be non-negative only. I'd guess that the
substitution has to be carried out throughout the problem, i.e anywhere the
original variable appears (including objective function) but I would be
grateful if someone could confirm this.
Below I have written a simple problem and the reformulated proble.
I would like to know:
- is what I am doing correct?
- is there a better approach to this problem?
Many Thanks in advance
Max -p1x1 - p2x2
x1 >= -10
x1 <= 20
x2 >= -30
x2 <= 40
Inv + x1 >= 0
Inv + x1 + x2 >= 0
Inv + x1 <= TC
Inv + x1 + x2 <= TC
with TC and Inv being positive constants
now rewrite the problem replacing x1 by (y1-10) and x2 by (y2-30) throughout.