Generating a compiled model

Describes how to generate a binary version of a model file.

From the IDE, you can generate a compiled model. A compiled model is a binary version of a .mod file.

Keeping your models as compiled files may help you protect your intellectual property because these binary files are not human-readable. You can also pass a compiled model file name as an argument to a method of the OPL interface libraries. See the Interfaces User’s Manual for more information.

From version 5.1 of OPL onwards, compiled model files are detected automatically by oplrun, interfaces related to IloOplModelSource, interfaces related to IloOplRunConfiguration, and scripting statements.

Note: You cannot export compiled models. All export functions, such as LP/SAV/MPS export, or internal data export, will raise exceptions.
  1. Open a project in the usual way and select the model from which you want to create a compiled model.
  2. Right-click the model and choose Compile model from the menu.

    The compiled model file is created and added to the folder that contains the model file, with the same name as the model and a file extension of .opl.

    Note: You cannot edit compiled models (.opl files) in the IDE.
  3. To run the compiled model, open a command prompt (on Windows platforms) and enter the oplrun command in your workspace. For example, for the blending project:

    oplrun blending.opl blending.dat

    Note: You can also use the oplrun command on a supported UNIX platform. See the oplrun Command Line Interface document.

The following result is displayed in the Command Prompt window.

Running a compiled model file