Data and decision variable identifiers

Describes the use of identifiers within OPL expressions.

Since data and decision variable identifiers are the basic components of expressions, we will review briefly here how they are used to build expressions. If r is a tuple with a field capacity of type T, then r.capacity is an expression of type T. If a is an n-dimensional array of type T, a[e 1 ]...[e n] is an expression of type T, provided that e i is well-typed. For instance, the excerpt


int limit[routes] = ...; 
dvar int transp[r in routes] in 0..limit[r]; 

contains an expression limit[r] of type integer. Indices of arrays can be complex expressions. For instance, the excerpt

int nbFlights = ...; 
range Flight = 1..nbFlights; 
{string} Employee = ...; 
dvar int crew[Flight][Employee] in 0..1; 
constraints { 
    
    forall(e in Employee) 
       forall(i in 1..nbFlights - 2) 
          crew[i][e] + crew[i+1][e] + crew[i+2][e] >= 1; 
} 

contains an integer expression crew[i+1][e] whose first index is itself an integer expression.