[AMPL 24974] A syntax error in a constraint loop

Hi,
Recently I have this syntax error in one of my constraints

syntax error
context: subject to precedence_in_part_platform {j in J, l >>> in <<< J: l<>j} : 1 + x[j] >= f[j,l] + x[l];
ampl:

The model was working fine las month. I do not know the reason for this error, given that the model have earlier constraints with this loop but it did not give any syntax error.

Could you please help, Thanks a lot

Did you define l as a param or var earlier in the model? If l is already defined, then writing l in J in the constraint indexing gives exactly the error you are seeing. For example:

ampl: param l; set J; var x{J}; var f{J,J};
ampl: subject to precedence_in_part_platform {j in J, l in J: l<>j} : 1 + x[j] >= f[j,l] + x[l];

syntax error
context:  subject to precedence_in_part_platform {j in J, l  >>> in  <<< J: l<>j} : 1 + x[j] >= f[j,l] + x[l];
ampl:

If you aren’t defining l earlier in the model, then can you post an example from your model, which causes the error to appear?

Your question has been moved to our new user forum at discuss.ampl.com, and a reply has been posted. To see the reply, go here:

https://discuss.ampl.com/t/ampl-24974-a-syntax-error-in-a-constraint-loop/925

Thanks a lot, it is solved