Basic Syntax

Describes the basic syntax for running a model or a run configuration using oplrun.

Running a model

To execute a model on its own, follow this syntax:

oplrun [options] "model-file" "[data-file ...]"

For example, in the Windows command prompt, change to the directory

C:\Program Files\IBM\ILOG\Cplex_Studio<version>\opl\bin\x64_win64

and enter:

oplrun "C:\Program Files\IBM\ILOG\Cplex_Studio<version>\opl\examples\opl\volsay\volsay.mod"

The model is executed in the command prompt, as shown.

Results of volsay.mod in the command prompt, after using oplrun.

The options and data-file arguments are optional. However, if the model requires external data, the data-file argument is mandatory. For example, the instruction:

oplrun "C:\Program Files\IBM\ILOG\CPLEX_Studio<version>\opl\examples\opl\nurses\nurses.mod"

generates an error because nurses.dat is missing.

The correct syntax

oplrun "C:\Program Files\IBM\ILOG\CPLEX_Studio<version>\opl\examples\opl\nurses\nurses.mod" "C:\Program Files\IBM\ILOG\CPLEX_Studio<version>\opl\examples\opl\nurses\nurses.dat"

runs the nurses.mod model file associated with the nurses.dat data file. See the output in Figure 1.

Running a run configuration

To execute a run configuration in a project, follow this syntax:

oplrun [options] -p project-dir [run-configuration]

The arguments options and run-configuration are optional. If you specify a run configuration name that contains spaces, you must enclose it between quotation marks. If you do not specify a run configuration name, CPLEX Studio executes the default configuration. The following example command line executes the run configuration Bin generation of the vellino multi-model project.

In the Windows command prompt, change to the directory

C:\Program Files\IBM\ILOG\Cplex_Studio<version>\opl\bin\x64_win64

and enter:

oplrun -p "C:\Program Files\IBM\ILOG\CPLEX_Studio<version>\opl\examples\opl\vellino" "Bin generation"

See the output in Figure 2.

Note:

If you are working with oplrun on a UNIX platform, you can use the -ph (project help) option to list the run configurations available in your project. This example shows the vellino example on Windows. The following list is displayed after the command:

oplrun -ph "C:\Program Files\IBM\ILOG\CPLEX_Studio<version>\opl\examples\opl\vellino"
oplrun project help option

See Understanding OPL projects in the Quick Start manual for more information on file name extensions and run configurations.