[AMPL 25036] Doubt VRP code

There are two problems here:

  • AMPL does not recognize constraints of the form variable in set. Thus, your constraint R0 is rejected with the message “Cannot test whether a variable is in a set expression.”

  • You define x as being indexed over {2..n,2..n}, so x[1,j] is not defined, and cannot be used in R0 or any other constraint.

To define x in AMPL corresponding to (12) and (13) in the mathematical description, you could write

var x {i in V, j in Vprima: i <> j} 
   integer >= 0, <= if i = 1 then 2 else 1;