I am currently working on an optimization problem in which a lake has 150 units of water. I am paid 3$ for each unit of water sold, but I need to guarantee that 100 units of water will remain at the end of the month or pay 5$ for each unit below the threshold of 100. I know that rain will bring 125 units of water (later on I will add stochastic rain).
My model is as follows
!pip install cplex
!pip install docplex
from docplex.mp.model import Model
from docplex.mp.environment import Environment
env = Environment()
env.print_information()
mdl = Model()
x = mdl.continuous_var(lb=None, ub=None, name=None )
y = mdl.continuous_var(lb=None, ub=None, name=None )
r1=mdl.add_constraint( 150-x+y+125 >= 100 )
s = mdl.solve()
mdl.maximize( 3*x-5*y )
obj = mdl.objective_value
print(x.solution_value)
print(y.solution_value)
print("* best objective is: {:g}".format(obj))
mdl.export("modelo_determinista_bajo.lp")
where x is the amount of water sold and y is the amount of water below the 100 units mark.
The output of the model is zero for x, y and the benefit.
I cannot see what I am doing wrong. Can someone help me? Best regards.
from docplex.mp.model import Model
from docplex.mp.environment import Environment
env = Environment()
env.print_information()
mdl = Model()
x = mdl.continuous_var(lb=None, ub=None, name=None )
y = mdl.continuous_var(lb=None, ub=None, name=None )
r1=mdl.add_constraint( 150-x+y+125 >= 100 )
mdl.maximize( 3*x-5*y )
s = mdl.solve()
obj = mdl.objective_value
print(x.solution_value)
print(y.solution_value)
print("* best objective is: {:g}".format(obj))
mdl.export("modelo_determinista_bajo.lp")
gives
175.0
0
* best objective is: 525