Skip to main content
added 185 characters in body
Source Link
RobPratt
  • 5.4k
  • 1
  • 15
  • 25

You can solve the problem via integer linear programming as follows. For $i\in\{1,\dots,115\}$, let binary decision variable $x_i$ indicate whether $i$ is selected. For $i\in\{1,\dots,111\}$, let binary decision variable $y_i$ represent $x_i x_{i+4}$. The problem is to minimize $\sum_{i=1}^{114} y_i$$\sum_{i=1}^{111} y_i$ subject to \begin{align} \sum_{i=1}^{115} x_i = 60 \tag1 \\ x_i + x_{i+4} - 1 &\le y_i &&\text{for $i\in\{1,\dots,111\}$} \tag2 \end{align} Constraint $(1)$ selects $60$ elements. Constraint $(2)$ enforces $x_i \land x_{i+4} \implies y_i$.

The minimum turns out to be $1$, even if you relax integrality, and the linear programming dual variables provide a certificate of optimality.


For the clarified interpretation of four apart, change $4$ to $5$ and $111$ to $110$ above. The resulting minimum is instead $0$, as in @TonyHuynh's counterexample.

You can solve the problem via integer linear programming as follows. For $i\in\{1,\dots,115\}$, let binary decision variable $x_i$ indicate whether $i$ is selected. For $i\in\{1,\dots,111\}$, let binary decision variable $y_i$ represent $x_i x_{i+4}$. The problem is to minimize $\sum_{i=1}^{114} y_i$ subject to \begin{align} \sum_{i=1}^{115} x_i = 60 \tag1 \\ x_i + x_{i+4} - 1 &\le y_i &&\text{for $i\in\{1,\dots,111\}$} \tag2 \end{align} Constraint $(1)$ selects $60$ elements. Constraint $(2)$ enforces $x_i \land x_{i+4} \implies y_i$.

The minimum turns out to be $1$, even if you relax integrality, and the linear programming dual variables provide a certificate of optimality.

You can solve the problem via integer linear programming as follows. For $i\in\{1,\dots,115\}$, let binary decision variable $x_i$ indicate whether $i$ is selected. For $i\in\{1,\dots,111\}$, let binary decision variable $y_i$ represent $x_i x_{i+4}$. The problem is to minimize $\sum_{i=1}^{111} y_i$ subject to \begin{align} \sum_{i=1}^{115} x_i = 60 \tag1 \\ x_i + x_{i+4} - 1 &\le y_i &&\text{for $i\in\{1,\dots,111\}$} \tag2 \end{align} Constraint $(1)$ selects $60$ elements. Constraint $(2)$ enforces $x_i \land x_{i+4} \implies y_i$.

The minimum turns out to be $1$, even if you relax integrality, and the linear programming dual variables provide a certificate of optimality.


For the clarified interpretation of four apart, change $4$ to $5$ and $111$ to $110$ above. The resulting minimum is instead $0$, as in @TonyHuynh's counterexample.

Source Link
RobPratt
  • 5.4k
  • 1
  • 15
  • 25

You can solve the problem via integer linear programming as follows. For $i\in\{1,\dots,115\}$, let binary decision variable $x_i$ indicate whether $i$ is selected. For $i\in\{1,\dots,111\}$, let binary decision variable $y_i$ represent $x_i x_{i+4}$. The problem is to minimize $\sum_{i=1}^{114} y_i$ subject to \begin{align} \sum_{i=1}^{115} x_i = 60 \tag1 \\ x_i + x_{i+4} - 1 &\le y_i &&\text{for $i\in\{1,\dots,111\}$} \tag2 \end{align} Constraint $(1)$ selects $60$ elements. Constraint $(2)$ enforces $x_i \land x_{i+4} \implies y_i$.

The minimum turns out to be $1$, even if you relax integrality, and the linear programming dual variables provide a certificate of optimality.