10
$\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$
3
  • $\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$ Commented Nov 12, 2019 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
    Commented Nov 12, 2019 at 13:41
  • $\begingroup$ Ah. Sorry. I missed that. Thanks for the clarification, and welcome to OR.SE! $\endgroup$ Commented Nov 12, 2019 at 13:42

1 Answer 1

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 and acknowledge you have read our privacy policy.

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