title: How to write "not equal to" in AMPL or set such as a condition for a variable's parameter?
body: <p>I am trying to set a variable <code>W{m in M, n in N}</code> where M and N are the same set of values. M and N represent a location. Variable W represents a transfer between m and n. Therefore, m cannot equal to n in variable W. For example, when m = 1, n can only equal to 2 and 3 (M=N=c(1,2,3)). </p>
  
  <p>This is a cost-minimizing 2-stage stochastic model. I tried to write <code>m &lt;&gt; n</code> into the sum conditions as well as writing <code>m &lt;&gt; n</code> in the constraint. All returned syntax error.</p>
  
  <p>I tried to add the condition into the objective function:</p>
  
  <p>sum{m in M, n in N | m &lt;> n}W[m,n];</p>
  
  <p>sum{m in M, n in N, m &lt;> n}W[m,n];</p>
  
  <p>sum{m in M, n in N, m!=n}W[m,n];</p>
  
  <p>sum{m in M, n in N | m != n}W[m,n];</p>
  
  <p>I also tried to add it into the variable definition:</p>
  
  <p>var W{m in M, n in N, m &lt;> n};</p>
  
  <p>etc..</p>
  
  <p>I tried many ways but none is working. AMPL returned syntax error if I added the <code>m&lt;&gt;n</code> or <code>m!=n</code> into the model. After I delete the <code>m!=n</code> conditions, the model works but returning the wrong number. </p>