2
$\begingroup$

I have the following constraint and would like to know if it can be modelled like this.

$$\sum_{t\in T}\sum_{j=k}^{k+5}q_{itj}\geq 3\cdot\left( 1-\sum_{j=k}^{k+5}r_{ij} \right) \forall i\in I, k\geq K_i^{init}$$

I have the set $I$ (persons), $T$ (machine) and $K$ (day). $q_{itk}$ indicates whether the machine is worked on by the person on the day ($q_{itk}=1$). $r_{ik}$ indicates whether the person has worked for the last time on this day ($r_{ik}=1$ if yes). Now I want to make sure that as long as the person has not worked for the last time, they work at least 3 times within a 6-day window. In doing so, $r_{ik}$ can only have the value 1 once, so $\sum_{k\in K}r_{ik}=1 \forall i \in I$. In addition, each worker has a first working day $K_i^{init}$, so it should only apply to this and all subsequent days. Is the modelling correct?

$\endgroup$
1
  • 3
    $\begingroup$ You seem be using the task index $k$ in several places that should instead involve days. Before writing the linear constraint, I recommend first writing the logical implication that you want to enforce. $\endgroup$
    – RobPratt
    Commented Nov 7 at 15:53

1 Answer 1

0
$\begingroup$

I think it's very close, but the summation for $r$ needs to go back to $K_i^{init}$ otherwise you'll drop consideration of the fact that they may have worked for the last time prior to the beginning of the 6-day window.

For example, suppose you have a 16-day period. They satisfy the constraint over the first two 6-day periods and stop work on day 9. For the constraint with a start day of $k=10$, your current formulation would not sum over $r_{i,9}$, and would start re-enforcing the constraint.

I think this would be better: $$ \sum_{t \in T} \sum_{j=k}^{k+5} q_{itj} \geq 3\left(1-\sum_{j=K_i^{init}}^{k+5} r_{ij}\right) \quad \forall i \in I,\,k \geq K_i^{init}$$

The only other thing I'd recommend considering is whether $r_{ik}=1$ means that the constraint shouldn't apply over the period ending on on day $k$ or the period ending on day $k+1$. The way you stated that it meant they 'worked for the last time on this day' makes it sound like they are in fact working on day $k$ and that the constraint should apply to that period and then stop applying on the day after. But that's just a question of how you choose to define the variable and how you use it in the rest of the formulation.

$\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.