1
$\begingroup$

$$\max \lbrace 0, q_i \rbrace \le L^r_i \le \min \lbrace Q^r,Q^r+q_i \rbrace \quad \forall i\in N,r\in R$$

I am not sure if this type of question is allowed here but I am stuck at modeling this constraints for the pickup dropoff problem with time window in Python using Gurobi API. Can anyone point me in the right direction or show an example?

$\endgroup$
3
  • $\begingroup$ This type of question is definitely allowed. I suggest that you edit your question though and use MathJax for your equation. And also, can you clarify in your question that $Q^r$ is a positive constant and $q_i$ and $L^r_{i}$ are variables (integer and continuous)? $\endgroup$
    – EhsanK
    Apr 8, 2022 at 13:33
  • $\begingroup$ Thanks Ehsan! yes Qr is positive continuous, qi can be negative parameter . Lri is variable. $\endgroup$
    – mars
    Apr 8, 2022 at 13:49
  • $\begingroup$ The good news is that max and min both appear convexly (i.e., all the constraints are convex), so no linearization, logic modeling, or introduction of binaries, etc should be needed. $\endgroup$ Apr 8, 2022 at 15:03

1 Answer 1

4
$\begingroup$

Something is greater than or equal to the maximum of several items if and only if it is greater than or equal to each individual item.

Something is less than or equal to the minimum of several items if and only if it is less than or equal to each individual item.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.