Description of oplrun

Describes the oplrun executable and its purpose, and the associated code samples.

In IBM ILOG CPLEX Studio, the oplrun command enables you to execute an OPL model or project from the Windows command line or in a UNIX environment. If you are working in a Windows environment, you can execute the IDE from the command line using the oplide command, as described in Launching the CPLEX Studio IDE .


On UNIX platforms, two different commands are available: oplrun and oplrunjava. oplrun is recommended because it is faster, but if your model includes external Java function calls, use oplrunjava.

Definition and purpose

The oplrun executable enables you to run an OPL model or project externally, that is, directly from the command line instead of launching the IDE. You will find it useful as a pre-deployment step to check speed and memory consumption outside of the IDE and to tune your model on large data sets.


  • to check and compare the results of the execution from the IDE and outside it

  • to overcome possible IDE slowness or overhead caused by IDE-specific settings

The executable is available on both Windows and UNIX platforms.

<Install_dir> being the installation directory of CPLEX Optimization Studio, it is delivered as:

  • On Windows:


  • On UNIX platforms:


    Assuming the C shell is being used, you need to define the LD_LIBRARY_PATH environment variable using setenv. For example:

    setenv LD_LIBRARY_PATH <Install_dir>/opl/bin/<platform_name_and_version>

    See Executing oplrun on AIX platforms and Executing oplrun on UltraSPARC 64 for specific information about these platforms.

The functionality of oplrun is the same as the functionality of the Run button runbutton.png in the IDE. See Syntax and Output for more information.

The code sample

The oplrunsample example supplied in C++, Java, and C# offers the same functionality as oplrun, with a reduced set of options shown in Table 1. See also Source code to run OPL: oplrunsample in the Language and Interfaces Code Samples manual.