Summary table of OPL keywords

Provides a short description of each OPL keyword and a link to the corresponding full description.

This table lists the words reserved for OPL; some of them are used as keywords, others are reserved for future use. Keywords that are specific to the CP Optimizer engine are identified by CP keyword in the description. This table provides a short description and a link to the full keyword description.

Important:

You cannot use OPL reserved words as variable names.

The keywords initial and template are reserved for future use.

The keyword struct is deprecated. Use tuple instead.

Table 1. OPL reserved keywords
Keyword Description
all Allows you to use only part of an array with functions that take array parameters.
and CP. Uses a logical AND to aggregate several constraints into a single one.
assert Checks assumptions.
boolean Domain shortcut for decision variables.
constraints An alias for subject to.
CP Denotes a constraint-programming model.
CPLEX Denotes a math-programming model.
cumulFunction Used to express a cumulative function (CP keyword, scheduling).
dexpr Expresses decision variables in a more compact way.
diff The difference between two data sets.
div The integer division operator.
dvar Decision variables in OPL models.
else To state conditional constraints.
execute Introduces a preprocessing or postprocessing scripting block.
false A shortcut for a constraint that is always false.
float Declares a floating-point value.
float+ Domain shortcut for decision variables.
forall Introduces a constraint.
from Associated with the DBRead and SheetRead keywords to read data from a database or spreadsheet.
in Checks membership in a set.
if To state conditional constraints
include Includes a model in another model.
infinity A predefined float constant to represent the IEEE infinity symbol.
int Declares an integer.
int+ Domain shortcut for decision variables.
intensity Used for defining intensity of an interval (CP keyword, scheduling).
inter Retains the common elements between data sets (intersection).
interval Used to create interval variables (CP keyword, scheduling).
invoke Calls an IBM ILOG Script function after a data initialization.
key In declarations of tuples, enables you to access data organized in tuples using a set of unique identifiers.
main Introduces a flow control scripting block.
max Computes the maximum of a collection of related expressions.
maximize A constraint to express an objective function.
maxint The largest positive integer available in OPL.
min Computes the minimum of a collection of related expressions.
minimize A constraint to express an objective function.
mod The integer division remainder.
not in Non-membership in a set.
optional Used to declare an interval as optional (CP keyword, scheduling).
or CP. Uses a logical OR to aggregate several constraints into a single one.
ordered Combines several parameters to produce a more compact statement.
piecewise Introduces continuous and discontinuous piecewise linear functions.
prepare Introduces IBM ILOG Script function definitions to be used in some other part of the .dat file.
prod Computes the product of a collection of related expressions.
pwlFunction Used to model a known continuous function of time (scheduling).
range Defines a range of integers by a lower bound and an upper bound.
reversed Specifies the descending lexicographic order in a set.
sequence Used to define a sequence of interval variables (CP keyword, scheduling).
setof Defines sets (lists of unique elements).
SheetConnection Connects a model to a spreadsheet.
SheetRead Reads data from a spreadsheet.
SheetWrite Writes data to a spreadsheet.
size Used for defining interval size (CP keyword, scheduling).
sorted Orders a set in ascending natural, lexicographic order.
stateFunction Used to express a state function (CP keyword, scheduling).
stepFunction A special case of pwlFunction, where the function changes in step intervals (scheduling).
stepwise Used to express stepwise linear functions (scheduling).
string Declares a data string.
subject to Introduces an optimization instruction, followed by a block of constraints.
sum Computes the sum of a collection of related expressions.
symdiff Runs the difference between the union and the intersection of two sets.
to Associated with the DBUpdate and SheetWrite keywords to write data to a database or spreadsheet.
true A shortcut for a constraint that is always true.
tuple A data structure to cluster together closely related data.
types Used to associate a non-negative integer (the type of the interval variable) with each interval variable in a sequence.
union Adds the nonidentical elements of a set to another sets.
using Associated with the keyword CP or CPLEX to specify the solving engine for a model.
with Indicates that an element of a tuple must be contained in a given set.