Integer programming , a transport problem

93 Views Asked by At

A truck with a maximum capacity of 10 boxes must transport food boxes, medicine boxes and boxes of surgical supplies. You cannot transport more than 5 boxes of the same type and if you transport more than 3 boxes of medicine you must carry at least 4 boxes of food.


My work

Let $b:=\text{number of boxes of food}$

$a:=\text{number of boxes of medicines}$

$c:=\text{number of boxes of surgical suplies}$

Then $$a+b+c\leq 10$$ $$a\leq 5$$ $$b\leq 5$$ $$c \leq 5 $$ My question is how transform this $$\text{if}\;a>3\;\text{then } b\geq 4$$ in a restriction for the linear programming problem?

2

There are 2 best solutions below

6
On BEST ANSWER

You can model $a>3 \implies b\ge 4$ with one binary variable $\delta$ and two linear constraints: \begin{align} a - 3 &\le (5-3)\delta \tag1\\ 4 - b &\le (4-0)(1-\delta) \tag2 \end{align} Constraint $(1)$ enforces $a>3 \implies \delta=1$, and constraint $(2)$ enforces $\delta=1 \implies b\ge 4$.


If you also want to model the converse $b\ge 4 \implies a>3$, include these two linear constraints: \begin{align} b - 3 &\le (5-3)\delta \tag3\\ 4 - a &\le (4-0)(1-\delta) \tag4 \end{align} Constraint $(3)$ enforces $b \ge 4 \implies \delta=1$, and constraint $(4)$ enforces $\delta=1 \implies a > 3$.

4
On

Since $a \in \{0,1,2,3,4,5\}$, you can add binary variables $\delta_i$ such that $$ a= \delta_1 +2\delta_2 + 3\delta_3 + 4\delta_4 +5\delta_5 \\ \delta_0 + \delta_1 +\delta_2 +\delta_3 + \delta_4 +\delta_5 = 1 $$

Then, the constraint

(strictly) more than $3$ boxes of medecine $\Rightarrow$ at least $4$ boxes of food

can be modeled as follows:

$$ b\ge 4 \delta_4 \\ b\ge 4 \delta_5 \\ \delta_i \in \{0,1\} $$

For example, if $\delta_4 = 1$, then $a=4$, and you have $b\ge 4$. If $\delta_1 =1$, then $a=1$, and $b$ is unconstrained.