0
$\begingroup$

I would like to adjust my constraint so that the x are only ever added for the weekend of a week, i.e. days 6,7 and then 13,14 and 20,21 etc.. That would be my previous formulation, but how can I formulate it more beautifully?

$\sum_{i\in I}^{}x_{jit}\le 2~~~\forall j\in J,b\in B,t\in\{6,7\}\cup\{13,14\}\\ $

$\endgroup$

1 Answer 1

0
$\begingroup$

I would just define another set, $T^{Weekends} = \{t \in T | t\mod 7 =6 \;\vee t \mod 7=0\}$. Here I have assumed that you have a set $T$ with all relevant days.

Then you can write your constraint like this:

$\sum_{i\in I}^{}x_{jit}\le 2~~~\forall j\in J,t\in T^{Weekends}\\ $

I have removed $b\in B$, since $b$ is unused.

$\endgroup$
2
  • 1
    $\begingroup$ I think you meant that the $\mod 7$ values are $6$ and $0$. $\endgroup$
    – RobPratt
    Nov 19 at 12:25
  • $\begingroup$ @RobPratt , oh, sorry, yes. I will make an edit to my answer. $\endgroup$
    – gmn
    Nov 19 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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