true

OPL keyword for true constraints

Purpose

OPL keyword for true constraints.

Also a keyword in IBM ILOG Script; see IBM ILOG Script Booleans in the Language Reference Manual.

context
Model files (.mod)

Syntax

LiteralExpression: "(integer-literal)"
                  | "(float-literal)"
                  | "(boolean-literal)"
                  | "(string-literal)"
                  | "infinity"
                  | "maxint"

Description

A shortcut for a constraint that is always true.

Example

int xShouldBeLessThan10=1;
dvar int x in 0..20;

int yShouldBeLessThan10=0;
dvar int y in 0..20;

maximize x+y;
 
subject to
 
{
   
   ctx:if (xShouldBeLessThan10==0) true;
   else (x<=10);
   
   cty:if (yShouldBeLessThan10==0) true;
   else (y<=10);
   
}
 
int Ok=1;
 
execute
{
   
 if (x!=10) Ok=0;
 if (y!=20) Ok=0;
}