How to assign other variables based on the range of decision variables
AnsweredSuppose there is a decision variable time_arrive[i] with value b, I think rate[t,i]=1 when t is at time_arrive[i] and time_arrive[i]+b.
Since time_arrive[i] is a decision variable, it is difficult to implement.
it's like
for t in range(T):
for i in range(I):
if time_arrive[i]<=t<=time_arrive[i]+b:
rate[t,i]=1
0

We discuss how to model conditional statements in the Knowledge Base article How do I model conditional statements in Gurobi? Please note that in your case, since you do not need a strict inequality, you do not have to introduce a positive threshold \(\epsilon\).
In addition to the conditional statements \(ta \leq t\) and \(t \leq ta+b\) you will have to use the addGenConstrAnd method to model the "and" relation.
0 
Thank you very much and have a great weekend.
0
Please sign in to leave a comment.
Comments
2 comments