When does AMPL evaluate the conditions specified in my model’s check statements?

The check conditions are evaluated each time that AMPL generates (or re-generates) an instance of your model. Normally the generation of an instance is triggered by a solve command, but a few other commands such as write and solution can have the same effect.

You can force all check statements to be evaluated immediately by typing the command

check;

or by inserting this command into an AMPL script at the point where you want the checking to occur.