This may seem like a bit of a funny question, but is there a way to program a LP equation with two 'lower' bounds?
Basically my problem is, rather than having conventional bounds (0,x) for some variable 'a', i want to have bounds ((0 or i),x) where i and x is a range of floats. So if zeroing it out doesn't optimize it, it finds the optimal value between i and x; e.g. (0,5,100) where optimal value can either be zero or a float somewhere between 5 and 100.
Is there a way of programming this in scipy linprog or PuLP? or is there a more sophisticated solver that can handle such constraints?
The exact scenario you describe is not possible using only LP (so you wouldn't be able to solve this with linprog), but you can do something like this with MILP. You would introduce a binary variable, say b
, which would be 0 if the lower and upper bound is 0 and 1 if you have the other bound, then you would add constraints b*i <= a
and a <= b*x
. This way when b
is zero, a
must be zero and when b
is 1, you recover your bound of i <= a <= x
. You would be able to solve this with Pulp.