MIP with conditional constraints

binary-programmingconstraintsmixed-integer programmingoptimization

Sorry in advance, for the length of my question and if something seems vague, but this is my first question ever.

Here I got a MIP I tried to solve and is formulated as:

A set of binary decision variables:

$x_{i}$, $\ \ i=1:n$

$y_{i,j}$, $\ \ i=1:n \ \ \& \ \ j=1:d $

$z_{i,j,k}$, $\ \ i=1:n \ \ \& \ \ j=1:d \ \ \& \ \ k=1:s$

Objective function

$min \sum_{i}x_{i}$

which subjects to the following constraints:

$\sum_{i} z_{i,j,k} = R_{j,k} \ \ \forall j,k$

$\sum_{k} z_{i,j,k} \leqslant y_{i,j} \ \ \forall i,j$

$\sum_{j} y_{i,j} \leq x_{i}\cdot D_{max} \ \ \forall i=1:(n-b)$

$\sum_{j} y_{i,j} \geq x_{i}\cdot D_{min} \ \ \forall i=1:(n-b)$

$\sum_{j} y_{i,j} \leq x_{i}\cdot Q_{max} \ \ \forall i=(n-b+1):n$

There is a reasonance behind this and I will try to give some hints by how this problem can be defined with real world terms.

Lets say that we have to allocate a weekly shift schedule of a store. This store operates 7 days a week with 3 shift each. (hence k = 3 and d = 7).

For a given schedule we need to return the minimum number of staff. Those should fullfil the below constraint (Kept the same order for consistency):

  1. Comply with the shift schedule.
  2. Each employee should cover only one shift per day (Full Time employees)
  3. Each employee should not work more than $D_{max}$ 6 days – (Full Time employees)
  4. Each employee should work at least $D_{min}$ 5 days (Full Time employees)
  5. Each employee should work at most $Q_{max}$ 3 days (Part Time employees)

What I want to achieve is to utilize part time employees only if an adequate number of full time employees are fully utilized (6 days).

So, for a constant number of required shifts per day ($R_{j,k}$) at the level of 6, 21 employees is the optimal solution. If we increase the schedule for one single day by an extra shift the optimal solution is 22 employess this breaks down to 17 employees who must work for 6 days and 5 employees for 5 days. Only for specific schedules, part time employees are utilized and this is because no other combinations can comply with constraints 3,4.

If you still reading this post here is the main question. Is it possible to formulate the following: enable the last constraint (5) only if for all i's $i=1:(n-b)$ – full time employees – the condition $\sum y_{i,j} = x_{i}\cdot D_{max}$ is meet. Any suggestions are welcome.

Best Answer

If I understand correctly, you want to enforce the following logical proposition: $$\left(\bigvee_{i=n-b+1}^n x_i\right) \implies \bigwedge_{i=1}^{n-b} \left(\sum_j y_{i,j} \ge D_\max\right)$$ In words: if any part-time worker is used, then every full-time worker must be used fully. To enforce this, introduce linear constraints $$x_p \cdot D_\max \le \sum_j y_{f,j}$$ for all $p\in\{n-b+1,\dots,n\}$ and $f\in\{1,\dots,n-b\}$.

Alternatively, if you introduce a binary variable $w$, you can reduce to only $n$ additional constraints (instead of $b(n-b)$): \begin{align} x_p &\le w &&\text{for all $p\in\{n-b+1,\dots,n\}$}\\ w \cdot D_\max &\le \sum_j y_{f,j} &&\text{for all $f\in\{1,\dots,n-b\}$} \end{align}

Related Question