title: How to express the "not equals" relation in linear programming?
body: <p>I want to solve a LP problem in Python with the library Pulpe (or any other).</p>
  
  <p>I want to express a constraint stating that all my variables must have different values, (their domain is {0, 1, 2, 3... N} for a given integer N.) that is <code>x_1 != x_2 != x_3 ... != x_N</code>.</p>
  
  <p>The solver gives me a solution when I do not add any constraint related to what I mentionned above but when I do, it tells me that the system is not feasible even though it has one solution.</p>
  
  <p>In order to add the "all different" constraint, I did the following:</p>
  
  <pre><code>for x_i in variables:
      for x_j in variables:
          if the following constraint has not been already added and x_i != x_j:
              my_problem += x_i - x_j &gt;= 1, "unique name for the constraint"
  </code></pre>
  
  <p>The previous code does not work. When I want to add the constraint <code>x_i != x_j</code>, it just doesn't work. So, as I am working with a bounded set of integers, I can (I think) rewrite the "not equals" as x_i - x_j > 0. Pulpe tells me that it does not handle the ">" operator between <code>int</code> and <code>LpAffineExpression</code> so I wrote <code>x_i - x_j &gt;= 1</code>. However, it runs but it seems that it does not work and I can't figure out why.</p>