include

OPL keyword to include a model in another model

Purpose

OPL keyword to include a model in another model.

context
Model files (.mod)

Syntax

TopLevelDeclaration: . "include" "(string-literal)" @1 ';'
                   | . InModelDeclaration
                   | . "using" Id ';'
                   | . Model

Description

This instruction includes a model in another model. It expects a string literal as argument.

Note:

The include keyword can be used only in the declaration part of a model, and only at the first level. You cannot use it in an if statement, or in a block.

Example

If the model qrinsert1.mod contains


dvar int y in 0..20; 

the keyword include is used like this:

include "qrinsert1.mod";

dvar int x in 0..20;

maximize x+y;