I've initialised my LpVariable like so:
x = LpVariable('x', None, None)
At this point, my variable has upper and lower bounds as float('inf')
and float('-inf')
. Now based on some parameters of my logic, I want to bound the upper limit of this variable to, say, any x < 20
.
Can I only do this by adding in an LpProblem and modifying the Variable using the problem parameters?
y = LpProblem('Minimizing Problem', LpMinimize)
y += x < 20
Or is there another way to manipulate the variable? Changing x.upBound
doesn't seem to work. I can still set invalid integers/floats as the solution (ie. values > 20
) and it accepts them.