File structure

At the top level, a CPO file is a collection of statements and sections.

Statements define the problem to be solved (variables, expressions, constraints and so on), sections contain additional information for the solver such as parameters and search specification.

Note that statements and sections can be given in any order as long as each identifier is declared before it is used. It is not necessary to declare all of the variables first.

Example


// Parameters section:
parameters {
  LogPeriod = 100;   // During solve, print log line every 100 branches.
}

// Three statements:
x = intVar(1, 3, 5); // x is a variable with domain {1, 3, 5}.
x < 4;               // Require that x must be strictly less than 4. 
y = intVar(1, 2);    // y is another variable with domain {1, 2}.

// Another parameters section:
parameters {
  Workers = 1;       // Use only one CPU core for solving.
}

// Finally one more statement:
y < x;               // Another requirement: y must be less than x.