[AMPL 25029] Help! syntax error and why

To define Route, you can write

param Route {i in Races, j in Races} :=
   if x[i,j].val > 0.5 then 1 else 0;

Notes:

  1. AMPL doesn’t let you define a param in terms of a variable, but you can define Route in terms of x[i,j].val which is the current value of the variable x.
  2. Some solvers can return slightly non-integer values for integer variables, so it’s safer to test x[i,j].val > 0.5 rather than x[i,j].val = 1.