Continuity Problem
OngoingHi, I need to model the following constraint:
The constraint basically ensures that a surgery must be done continuous over time. The variable x is BINARY and models if the surgery is been developed in a certain instant of time. Ther variable y is BINARY and models if a surgery starts in a certain instant of time. And t is the time of the surgery. I tried to put the constraint in code like this:
m.addConstrs((gp.quicksum(z[i,j,k,a] for a in range(l,l+tiempo[i]-1))==y[i,j,k,l]*tiempo[i] for i,j,k,l in pacientes_salas_cirujano_hora if l <=num_horas-tiempo[i]+1),name="c1")
However, in my results I'm obtaining values of 1 in y, but all my z are 0 and I don't understand why. I hope you can help me.
Thanks,
Sergio.
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Sergio,
could you generate an LP file by using the write() function to double check whether the constraints you construct are correct? I would recommend to reduce the number of elements in the sets \(P,S,C,H\) to keep the file manageable.
In case you need further help, feel free to share constraint lines of you LP file.
Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments