Skip to main content

 
IBM ILOG Script Extensions for OPL - Reference Manual

IBM ILOG Script Extension Classes for OPL - General Presentation

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:


Context

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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Limitations: Value Assignments in Script Statements

The following table lists what assignments are supported for what types.

What? 
Supported for 
Not Supported for 
Assigning values to array items 
Tuples 
Scalars: integer, float, string 
All the rest (which is set items) 
Assigning values to model elements or to data elements 
Scalars: integer, float, string 
All the rest 
Assigning values to tuple components 
Scalars: integer, float, string 
All the rest: sets, arrays, subtuples 
Creating new data elements using new names 
Scalars: integer, float, string 
All the rest 

Ending Objects in Flow Control

Warning
You need to be particularly cautious when using the end() methods available for objects constructed from within flow-control scripting. Calling end() on interdependent objects in the wrong order may crash your application.

Conventions

Each class is documented with the following structure:

Class Name

The name of the class within scripting, followed by its inheritance path.

Description

This section contains:

OPL Type

The corresponding OPL modeling type.

Named Properties

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.

Methods

Likewise, the Method Summary table lists the methods available on the objects of the class, with links to the individual descriptions that follow.

Iterating Properties

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.

Index Resolution

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.

Methods

This section indicates for each method:

The constructor is documented as a method named (constructor). It is called as follows:

var myObject = new MyClass();

©Copyright IBM Corp. 1987-2011.