Command line options

Describes the optional arguments to the oplrun syntax.

If you enter the oplrun command without any arguments or with the -h option, the list of command line options appears as shown in the screen capture below. The table below gives a more detailed description of each option.

Note that the following options are available for CPLEX models only.

  • -tune

  • -tuneFixed

If <Install_dir> is the installation directory of CPLEX Optimization Studio,

  • On Windows, the command syntax is:

    <Install_dir>\opl\bin\<platform_name_and_version>\oplrun

  • On UNIX platforms, the command syntax is:

    <Install_dir>/opl/bin/<platform_name_and_version>/oplrun

In this Windows example, after entering the command:

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

the following options are displayed.

The list of command line options for oplrun.

Table 1. oplrun command line options
Shortcut Meaning Description Supported by oplrunsample
Global
-h this help message Returns a help message with a brief description of all the possible options, as shown above. Yes
-v verbose Tells oplrun to print information during its execution. Extra information includes: time spent in different parts such as initialization, model generation, final solution, and so on. For instance, this option is required to display info about Diagnosing unboundedness. Yes
-version print version information This option returns the product name and version number. No
-deploy deploy mode Minimal memory consumption. (The names of decision variables and constraints are not taken into account when the deploy option is used.) No
-w show warnings Displays a WARNING (which is different from an ERROR) if, for example, the model contains an unused element. No
-ph project help Displays the run configurations available in the specified project. This is most useful on Unix platforms, where one cannot view this information in the CPLEX Studio IDE. No
Compiled Model
-c using compiled model-file

Specifies that the given model (an .opl file) is compiled and should be read accordingly.

Note:

This option is no longer necessary because compiled models are detected automatically.

Yes
-o output-file compile model

Exports the given model to the specified output file in the compiled format (.opl file). For example, the instruction:

oplrun -o gas.opl gas.mod

creates the gas.opl compiled file from gas.mod.

Yes
Files
-e [export-file] model-file export model

For MP models only. Using this option, you can require CPLEX to export the extracted model to a file. If you do not specify the name of the resulting file, the model is exported to a file named oplRun.lp in the LP format. If you specify the name of the exported file, you can export to other formats, such as MPS or SAV. For example, the instruction: oplrun -e test.lp test.mod

exports the model extracted from test.mod to the LP file test.lp. The target format is saved to the directory from which the oplrun command is invoked.

Yes
-de dat-file: write external data

This option allows you to export external data from a model (ellipsis syntax) to a file that can later be used as input. This is useful when you want to dump some data taken from a database to a file that can be used later without the database connection.

For example, the instruction:

oplrun -de datafile.dat mymodel.mod mydatabasedata.dat

takes the data from the database as stated in the file mydatabasedata.dat, then exports this data to the file datafile.dat. Later, datafile.dat can be used without accessing the database.

Yes
-D override data element values This option overrides the value of a data element (simple data types) from the command line. This enables you to use oplrun as a testing environment by running the same model with slightly different input. No
-di dat-file: write internal data Similar to the -de option except that the output includes only internal data (“equal sign” syntax). Yes
-locale locale: the locale oplrun will use Used to control the encoding of files, for example to get platform-dependent help on Unix. No
-p project-dir: [run configuration] Executes the run configuration of the project identified by its path. If you do not specify a run configuration, the default one is executed. No
Language
-f force element usage By default, CPLEX Studio creates only the model elements that are explicitly used in other elements. Warnings are issued concerning those elements of the model that are not used. This option allows you to force the usage of these “unused” elements. It is also available as a setting (.ops file) in the IDE, in the section Language>General. Yes
-dme disable end methods in main script In IBM ILOG Script, some objects support the end method, which enables recovery of the memory used by such objects. Normally, after a call to the end method, these objects cannot be used any more. It is the user’s responsibility to take care to NOT use such objects. However, if you use the -dme option, end methods have no effect and calling “ended” objects does not cause errors. No
-disableDataChecks disable data checks Disables data checking during insertion into sets (unicity, integrity constraints, ...). The data checking is disabled only for external data (data coming from .dat file or CustomDataSource). Performance may be increased, but you have to ensure that the data is correct. No
-disableMultiEnv disable multi-environment mode When this option is used, the environment is shared by a sub-model. No
-disableGC disable garbage collector in script blocks Disables the garbage collector in script blocks. When this option is used, performance may be increased, but the drawback is that the system will consume more memory. The memory will be released at the end of the block. No
Infeasibility
-relax   This option searches for relaxations of the model if it is infeasible. If a relaxation is found, the output contains a list of bounds to be relaxed to obtain a feasible solution. See Figure 3. Yes
-conflict   This option displays conflicts between constraints when the model is infeasible. To make the model feasible, you must remove or modify at least one of the conflicting constraints. See Figure 4. Yes
Profiling
-profile   This option activates the profiler. At the end of execution, a summary of the execution is output, indicating how much time and memory has been spent at the different stages of execution. No
Model tuning
-tune  

For CPLEX models only. This option enables you to fine-tune CPLEX parameters for better performance of the model. When using the option -p project-path, you can specify zero, one, or more, run configurations. If you do not provide a run configuration name (option zero), a project will be tuned with all its available run configurations. The tuning process outputs an.ops file which reflects the CPLEX parameters (OPL options) computed as the best settings for the model.

Typical syntax:

oplrun -tune result.ops -tuneFixed fixed.ops -p project-path rc1 rc2

or

oplrun -tune result.ops - tuneFixed fixed.ops model.mod data.dat

No
-tuneFixed   For CPLEX models only. This option enables you to pass CPLEX a set of fixed parameters that the tuning process should not change. It is optional but if you use it, you must pass the name of an existing file on disk. No