What is IBM ILOG Script?

Describes the scripting language for combining OPL models and interacting with them.

IBM® ILOG Script is an implementation of JavaScript.

The OPL language described so far covers the requirements for modeling in optimization, that is, expressing constraints on decision variables. However, an optimization application might also need functionality for manipulating data. This non-modeling expressiveness of the OPL language is called scripting, and is available as IBM ILOG® Script, a scripting language for combining OPL models and interacting with them. IBM ILOG Script is an implementation of the ECMA-262 standard (also known as ECMAScript or JavaScript).

You can use OPL functions, except and and or, within IBM ILOG Script blocks by specifying the OPL namespace:

 ( Opl.xxx() ) 
Important:

IBM ILOG Script for OPL manipulates script variables that are denoted by the keyword var and are different from OPL modeling decision variables, denoted by the keyword dvar.

Scripting is used in three different situations, as described in the following sections:

  • Preprocessing and postprocessing to prepare data and work on solutions

  • Flow control to orchestrate model, model data, and solving

  • A few tips: additional information on how the language interpreter works and on data declaration

  • Common pitfalls: common errors you should avoid when writing script statements in your OPL models

See also the Reference Manual of IBM ILOG Script Extensions for OPL for an overview and a detailed description of the IBM ILOG Script API.