IBM® ILOG OPL includes IBM ILOG Script extension classes for OPL that you can use in scripting statements. IBM ILOG Script for OPL is an embedded JavaScript™ implementation that provides the "non-modeling" expressiveness of OPL. As such, it is compliant with the standard ECMA-262.
To better understand the integration of IBM ILOG Script
with OPL, you can think of execute
or
main
blocks as being nested in a scope.
This scope is equivalent to
var scope = new Object(); scope.thisOplModel = // the instance of IloOplModel for this .mod file scope.cplex = // the IloCplex instance used to instantiate the IloOplModel with (scope) { with (thisOplModel) { // the execute or main block goes here } }
For more information, in particular on the underlying concepts, see also:
This overview provides preliminary information on:
Not all classes provide the same functionality in all contexts. The following table lists the classes whose properties and methods are available for each scope.
Preprocessing |
Postprocessing |
Flow Control |
Global Functions |
---|---|---|---|
The following table lists what assignments are supported for what types.
Each class is documented with the following structure:
The name of the class within scripting, followed by its inheritance path.
This section contains:
The corresponding OPL modeling type.
When applicable, the Property Summary table lists the named properties available for
the objects of the class, with links to the individual descriptions that follow. In the Available topic, "all" means "available for preprocessing, postprocessing, and flow control (the main
keyword). Properties available for assignment (writing)
are mentioned explicitly.
Likewise, the Method Summary table lists the methods available on the objects of the class, with links to the individual descriptions that follow.
This section describes how an object of the given type behaves when used in a property iterating context.
for(var p in myObject)
The description reports on the objects given for
p
. The default behavior is to iterate on
all the names of the named properties.
This section indicates how the object will answer
to an indexing request with a property p
:
myObject[p]
By default, string indices are resolved as named
properties, if they are available. In all other cases, the special
value undefined
is returned.
This section indicates for each method:
The constructor is documented as a method named (constructor)
. It is called as follows:
var myObject = new MyClass();