Labeled assert statements

Shows how to label assertions in OPL.

Assertions can be labeled. When you label a constraint that is part of an assert statement, and if the assertion fails, the context of the failing assertions appears in the Issues output window. For example:


{int} vals = {1, 2, 3};
assert forall(i in vals) ct:i<2;
Figure 1. Labeled assert
labeled-assert.png