title: Cplex Java subtour elimination in the TSP
body: <p>I have a problem with putting up the subtour elimination constraint for the travelling salesman problem in cplex java.
  The TSP is about finding the cheapest route for a set of customers n, while each customer should be visited exactly once.</p>
  
  <p>A friend gave me these cplex code lines for the subtour elimination in the normal TSP which should be correct:</p>
  
  <pre><code>forall (i in Nodes) Drive [i][i]==0;
  forall (i in Nodes, j in 2..n:(i!=j)) y[i]-y[j] + n*Drive[i][j] &lt;= (n-1);
  </code></pre>
  
  <p>I transfered this into the following cplex java code:</p>
  
  <pre><code>for(int i0=0; i0&lt;n; i0++){
      for(int q=0; q&lt;n; q++){
          model.addEq(w[i0][i0][q], 0);
      }
  }
  
  for(int i=1; i&lt;n; i++){
      for(int j=2; j&lt;n; j++){
          for(int y=0; y&lt;n; y++){
              model.addLe(model.sum((grossQ[i-1]-grossQ[j-1]), model.prod(n, drive[i][j][y])), (n - 1));
          }
      }
  }
  </code></pre>
  
  <p>I am using a position based model with the decision variable drive[i][j][q] where q states on which position a customer is visited. 
  The Array grossQ = [2..n]</p>
  
  <p>The code doesnt show any errors, but the solution still has a subtour. Does anybody know whats wrong about it?</p>
  
  <p>I am not quite sure, if this is enough information. So let me know, if its too confusing.</p>