Overlap constraints in java
AnsweredHi I am a total beginner in Gurobi and am using the Java library. I have a set of tasks that will be arranged in a schedule. Two tasks cannot run at once and so I wish to define some overlap constraints for the tasks such that for each combination of tasks i and j:
1) jobStart[i] + jobDuration[i] ≤ jobStart[j]
2) jobStart[j] + jobDuration[j] ≤ jobStart[i]
3) (1) + (2) = 1
The java library has brought me much frustrations as I am want to create two binary variables that would be influenced by equations 1 and 2 and then enforce the sum of these variables to equal to 1.
I am entirely lost as to how to accomplish this. Can someone point me in the right direction? Is my approach wrong?
-
Hi Sergei,
Have you looked into indicator constraints already? You could create a single binary variable. Then you create one indicator constraint saying if my binary is 0 then constraint 1 must hold. Similarly, you create a second indicator constraint saying if my binary is 1 then constraint 2 must hold.
If that doesn't work, could you share the relevant part of your code?
Kind regards,
Ronald0 -
It may also be useful to look at a paper showing different formulations for single machine scheduling. This looks more like a modelling problem than a java problem.
Keha, Ahmet B., Ketan Khowala, and John W. Fowler. "Mixed integer programming formulations for single machine scheduling problems." Computers & Industrial Engineering 56.1 (2009)
http://www.lab2.kuis.kyoto-u.ac.jp/~avis/courses/ci/2010/notes/KKF.pdf- Riley
0 -
Hi Ronald, Hi Riley.
Thanks for replying, indicator constraints is just the thing I needed!
I was so focused on trying to influence the binary variables through the expressions that I didn't consider influencing expressions through the variables.0
Please sign in to leave a comment.
Comments
3 comments