Boolean expressions

Describes the use of Boolean expressions in OPL.

Boolean expressions can have various operand types in OPL. They are constructed in different ways:

  • from integer expressions using the traditional relational operators ==, != (not equal), >=, >, <, and <=.

  • from float expressions using the same relational operators.

  • from string expressions and support the same operators as well.

For convenience, OPL offers a range expression to express special combinations for constraints.

They are of the form


a op1 x op2 b

where

  • op1 and op2 are either of the relational operators <= or <

  • a and b are boundary expressions which need to be ground

  • x is an expression

Those expressions are equivalent to


a op1 x; x op2 b

which is itself equivalent to


a op1 x && x op2 b