using

OPL keyword for the solving engine

Purpose

OPL keyword to specify the solving engine.

context
Model files (.mod)

Syntax

using CP;
using CPLEX;

Description

This keyword allows you to specify the engine by which the model will be solved. The possible values are CP and CPLEX. If you do not specify an engine using this keyword, OPL will use CPLEX as the default engine.

If you use constraint-programming keywords in your model but do not specify CP as the solving engine, OPL will return syntax errors.

Example

using CP;

int n = 5;

range R = 1..n;
dvar int x[R] in R;


subject to {
  allDifferent(all (i in R : i%2 == 0) x[i] );
  allDifferent(all (i in R : i%2 == 1) x[i] );
}