I'm working on a vehicle routing problem, in which a vehicle need to pick up amounts of things in some nodes. I'm trying to solve it by Gurobi optimizer. Except for meeting the time windows of each nodes, it is also required that the capacity of the vehicle is limited, which causes a big problem for me. Every time when the vehicle leaves a node, it checks whether the remaining capacity can load the amount in the next node. If not, the vehicle need to unload first and then go to the next node (the unloading time can be neglected). my model for the capacity constraints are like: enter image description here

As you can see, there are 4 indicator constraints, each of them has two conditions in "if" line. Does anyone know how to deal with such format of constraints in Gurobi? Or do we have more smarter modeling method to list some constraints that is easier to input in Gurobi optimizer?

Besides, since Gurobi doesn't support strict comparison signs like < and >, how do we deal with such a problem if we find a way to input the above constraint? I mean, if strict comparison sign is not supported then we have constraints like if x <= 0, y =1; if x >= 0, y = 0, in which the value of x has some overlap and it may cause problems.

  • 2
    $\begingroup$ First, I think your conditions should be $Totalload_i + q_j \le Q$ (similarly for the other one). Second, there are many questions on the site about how to formulate if-then conditions (e.g. use BigM method) and also, questions about how to formulate strict inequality (e.g. add an $\epsilon$ to the $Q$ and use $\ge$). Lastly, please edit your question and use MathJax for formulations. Using that and avoiding images, will increase the searchability of the questions as well. $\endgroup$
    – EhsanK
    Commented Jul 17, 2021 at 14:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.