9
$\begingroup$

I have an MIP problem where $n$ different types of cars are delivering packages. Sometimes multiple types of cars are required to go to a single location. For example if car $1$ makes two deliveries to location $z$, car $2$ needs to make an equal amount of deliveries as well.

In other words: if an integer variable $x_n$ is larger than $0$ it should be equal to all $x_n$ for all $x_n$ larger than $0$

How do I capture this in constraints in linear programming?

I think I need to create a new decision variable $b_i$ that is $1$ if a car makes $1$ or more deliveries, and $0$ if there are no deliveries. From there on I need to somehow set the $x_n$ values equal. But how?

$\endgroup$
  • $\begingroup$ It sounds like you are just saying $x_n = x_m$ for all $n$, $m$ -- is that correct? If one of them equals 0 then they all must equal 0, and if one of them equals something positive then they all must equal the same positive number? $\endgroup$ – LarrySnyder610 Nov 12 '19 at 13:36
  • 1
    $\begingroup$ Thanks, but that's incorrect. If one of them equals zero, others must still be able to be positive. However, all positive $x_n$ have to be equal. $\endgroup$ – Tim Nov 12 '19 at 13:41
  • $\begingroup$ Ah. Sorry. I missed that. Thanks for the clarification, and welcome to OR.SE! $\endgroup$ – LarrySnyder610 Nov 12 '19 at 13:42
11
$\begingroup$

Let $b_n$ be a binary indicator variable, and let integer variable $y$ be the common value of the positive $x_n$. Then you want to enforce $x_n=b_n y$, which you can linearize using the formulation given here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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