New answers tagged

5 votes

Is there a better way of defining a constraint on positive integer variables such that no two variables are the same and are uniquely assigned a value

This is called an alldifferent constraint and is supported directly by constraint programming solvers. @Kuifje gave a traditional linear formulation (+1) that uses binary variables, but it is worth ...
user avatar
  • 22.7k
10 votes
Accepted

Is there a better way of defining a constraint on positive integer variables such that no two variables are the same and are uniquely assigned a value

Introduce binary variables $y_{ij}\in \{0,1\}$ that take value $1$ if and only if $x_i$ is assigned to value $j\in \{1,...,N\}$, and use the following constraints: \begin{align} x_i &= \sum_{j=1}^...
user avatar
  • 10.4k
3 votes
Accepted

How to pose the constraint for binary variable to indicate if quantity is zero or greater than zero

$$b_i \le p^i-p^{i+1} \le (N-1)b_i$$
user avatar
  • 22.7k
4 votes
Accepted

Modeling a special case of conservation of flow

Introduce binary variables $x_a,\dots,x_e,$ with each variable taking value 1 if the corresponding arc is used. To limit yourself to a single input, add the constraint $$x_a + x_b = 1$$ (or $x_a + x_b ...
user avatar
  • 31.1k
3 votes

Integer programming books

There are at least three somewhat distinct aspects to integer programming: theory (e.g., why LP solutions occur at vertices of polytopes); algorithms (branch-and-bound, decomposition, cutting plane ...
user avatar
  • 31.1k
3 votes

What is the meaning of this math formulation?

The set of equations are used to represent the conservation of flow at every node $j$ in a network. Here, $\Delta^{-}(j)$ represents the set of nodes coming into node $j$ and $\Delta^{+}(j)$ ...
user avatar

Top 50 recent answers are included