4.8 Display statement

display domain : item , $\dots$ , item ;


domain is an optional indexing expression which specifies the subscript domain of the display statement;

item, $\dots$, item are items to be displayed. (The colon preceding the first item may be omitted.)


display: 'x =', x, 'y =', y, 'z =', z;
display sqrt(x ** 2 + y ** 2 + z ** 2);
display{i in I, j in J}: i, j, a[i,j], b[i,j];

The display statement evaluates all items specified in the statement and writes their values to the terminal in plain text format.

If the subscript domain is not specified, items are evaluated and then displayed only once. Specifying the subscript domain causes evaluating and displaying items for every n-tuple in the domain set. In the latter case items may include dummy indices introduced in the corresponding indexing expression.

Item to be displayed can be a model object (set, parameter, variable, constraint, objective) or an expression.

If the item is a computable object (i.e. a set or parameter provided with the assign attribute), the object is evaluated over the entire domain and then its content (i.e. the content of the object array) is displayed. Otherwise, if the item is not a computable object, only its current content (i.e. the members actually generated during the model evaluation) is displayed. Note that if the display statement is used above the solve statement and the item is a variable, its displayed “value” means “elemental variable”, not a numeric value, which the variable could have in some solution obtained by the solver. To display a numeric value of a variable the display statement should be used below the solve statement. Analogously, if the item is a constraint or objective, its “value” means “elemental constraint” or “elemental objective”, not a numeric value.

If the item is an expression, the expression is evaluated and its resultant value is displayed.