Skip to main content
added 392 characters in body
Source Link
RobPratt
  • 34.3k
  • 2
  • 47
  • 90

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Similarly, if you want to avoid delivering on both Saturday and Monday but not SundayMore generally, for any pair $\{i,j\}$ of days that iscannot both have a delivery, avoid $$(x_7,x_1,x_2)=(1,0,1),$$ you want to enforce $$\lnot (x_7 \land \lnot x_1 \land x_2).$$ Rewriting in conjunctive normal form yields $$\lnot x_7 \lor x_1 \lor \lnot x_2.$$ Soimpose the desired"conflict" constraint is $$(1 - x_7) + x_1 + (1 - x_2) \ge 1,$$ equivalently, $$x_7-x_1+x_2 \le 1.$$$x_i+x_j \le 1$. The model in the linked answer here strengthens these conflict constraints to "clique" constraints.

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Similarly, if you want to avoid delivering on both Saturday and Monday but not Sunday, that is, avoid $$(x_7,x_1,x_2)=(1,0,1),$$ you want to enforce $$\lnot (x_7 \land \lnot x_1 \land x_2).$$ Rewriting in conjunctive normal form yields $$\lnot x_7 \lor x_1 \lor \lnot x_2.$$ So the desired constraint is $$(1 - x_7) + x_1 + (1 - x_2) \ge 1,$$ equivalently, $$x_7-x_1+x_2 \le 1.$$

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

More generally, for any pair $\{i,j\}$ of days that cannot both have a delivery, impose the "conflict" constraint $x_i+x_j \le 1$. The model in the linked answer here strengthens these conflict constraints to "clique" constraints.

added 392 characters in body
Source Link
RobPratt
  • 34.3k
  • 2
  • 47
  • 90

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Similarly, if you want to avoid delivering on both Saturday and Monday but not Sunday, that is, avoid $$(x_7,x_1,x_2)=(1,0,1),$$ you want to enforce $$\lnot (x_7 \land \lnot x_1 \land x_2).$$ Rewriting in conjunctive normal form yields $$\lnot x_7 \lor x_1 \lor \lnot x_2.$$ So the desired constraint is $$(1 - x_7) + x_1 + (1 - x_2) \ge 1,$$ equivalently, $$x_7-x_1+x_2 \le 1.$$

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Similarly, if you want to avoid delivering on both Saturday and Monday but not Sunday, that is, avoid $$(x_7,x_1,x_2)=(1,0,1),$$ you want to enforce $$\lnot (x_7 \land \lnot x_1 \land x_2).$$ Rewriting in conjunctive normal form yields $$\lnot x_7 \lor x_1 \lor \lnot x_2.$$ So the desired constraint is $$(1 - x_7) + x_1 + (1 - x_2) \ge 1,$$ equivalently, $$x_7-x_1+x_2 \le 1.$$

Post Undeleted by RobPratt
added 270 characters in body
Source Link
RobPratt
  • 34.3k
  • 2
  • 47
  • 90

Apply the constraint in this recent answer withTo disallow any given pattern of $w=1$:$0$ and optimize days between work shift$1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Apply the constraint in this recent answer with $w=1$: optimize days between work shift

To disallow any given pattern of $0$ and $1$, you can impose "no-good" constraints. For example, if you want to avoid delivering on both Tuesday and Wednesday, that is, avoid $$(x_3,x_4)=(1,1),$$ you want to enforce $$\lnot (x_3 \land x_4).$$ Rewriting in conjunctive normal form yields $$\lnot x_3 \lor \lnot x_4.$$ So the desired constraint is $$(1 - x_3) + (1 - x_4) \ge 1,$$ equivalently, $$x_3+x_4 \le 1.$$

Post Deleted by RobPratt
Source Link
RobPratt
  • 34.3k
  • 2
  • 47
  • 90
Loading