4.7 Check statement

check domain : expression ;

Where:

domain is an optional indexing expression which specifies the subscript domain of the check statement;

expression is an logical expression which specifies the logical condition to be checked. (The colon preceding expression may be omitted.)

Examples

check: x + y <= 1 and x >= 0 and y >= 0;
check sum{i in ORIG} supply[i] = sum{j in DEST} demand[j];
check{i in I, j in 1..10}: S[i,j] in U[i] union V[j];

The check statement allows checking the resultant value of an logical expression specified in the statement. If the value is false, the model translator reports an error.

If the subscript domain is not specified, the check is performed only once. Specifying the subscript domain allows performing multiple checks for every n-tuple in the domain set. In the latter case the logical expression may include dummy indices introduced in the corresponding indexing expression.