The DISPLAY Statement

Output in AIMMS format

You can use the DISPLAY statement to print the data associated with sets, parameters and variables to a file or window in AIMMS format. As this format is also very easy to read, the DISPLAY statement is an excellent alternative for printing indexed identifiers.

Syntax

display-statement:

image/svg+xmlDISPLAY { data-selection display-format , } WHERE display-format , ;

display-format:

image/svg+xmlformat-specifier := expression

Display format

All data selections of a DISPLAY statement are printed by AIMMS in the form of a data assignment.

  • Sets are printed in the form of a set assignment with an enumerated set on the right-hand side.

  • (Slices of) parameters and variables are printed in the form of data assignments, which can be either a table format, a list format, or a composite table.

For indexed parameters and variables AIMMS uses a default display format which is dependent on the dimension.

Overriding the display format

You can override the default AIMMS format by specifying a display format, consisting of one or more format specifications, in the WHERE clause. AIMMS supports the following format specifiers:

  • DECIMALS: the number of decimals to be printed for each entry,

  • ROWDIM: the dimension of the row space,

  • COLDIM: the dimension of the column space, and

  • COLSPERLINE: the desired numbers of columns per line.

When a format specifier is not specified, AIMMS will use the system default.

Number of decimals

All format specifications in a WHERE clause are applied to the entire collection of data selections printed in the DISPLAY statement. By specifying a DECIMAL format specifier for a particular data selection in the DISPLAY statement, you can also override the number of decimals printed for each data selection individually. You cannot specify other format specifiers for individual data selections.

Obtaining lists and tables

If you have set the dimension of either the row or column space to zero, AIMMS will print the identifier in list format. If both the dimension of the row and column space are greater than zero, AIMMS will print the identifier as a table. AIMMS will honor your request to print the desired number of columns per line if the resulting width does not exceed the default page width. In the latter case, AIMMS will reduce the number of columns until they fit within the requested page width. The default page width can be set as an option within your project.

Outer indices for slicing

If the sum of the dimensions of the row and column space is less than the dimension of the parameter or variable to be displayed, AIMMS will display the identifiers as slices of the requested format, where the slices are taken by fixing the first indices in the domain.

Composite tables

When all arguments of the DISPLAY statement have the same domain and you enclose them by braces, AIMMS will print their values as a single composite table. In this case, you can only specify the precision with which each column must be printed. AIMMS will ignore any of the other display options in combination with the composite table format.

Example

The following statements illustrate the use of the DISPLAY statement and its various display options.

  • The following statement will display the data of the variable Transport with 2 decimals and in the default format.

    display Transport where decimals := 2;
    

    The execution of this statement results in the following output being generated.

        Transport :=
        data table
                 Amsterdam   Rotterdam  'Den Haag'
             !  ----------  ----------  ----------
     Amsterdam        2.50        2.50        5.00
     Rotterdam        2.50        5.00        5.00
    'Den Haag'                    2.50        5.00
        ;
    
  • The following statement displays the subselection of the slice of the variable Transport consisting of all transports departing from the set LargeSupplyCities.

    display Transport(i in LargeSupplyCities,j) where decimals := 2;
    

    This statement will result in the following table, assuming that LargeSupplyCities contains only Amsterdam and Rotterdam.

       Transport :=
       data table
                Amsterdam   Rotterdam  'Den Haag'
            !  ----------  ----------  ----------
    Amsterdam        2.50        2.50        5.00
    Rotterdam        2.50        5.00        5.00
       ;
    
  • The following DISPLAY statement displays Transport with no rows, two columns (i.e. in list format), and two entries per line.

    display Transport where decimals:=2, rowdim:=0, coldim:=2, colsperline:=2;
    

    The resulting output looks as follows.

    Transport := data
    { ( Amsterdam , Amsterdam  ) : 2.50,  ( Amsterdam , Rotterdam  ) : 2.50,
      ( Amsterdam , 'Den Haag' ) : 5.00,  ( Rotterdam , Amsterdam  ) : 2.50,
      ( Rotterdam , Rotterdam  ) : 5.00,  ( Rotterdam , 'Den Haag' ) : 5.00,
      ( 'Den Haag', Rotterdam  ) : 2.50,  ( 'Den Haag', 'Den Haag' ) : 5.00 } ;
    
  • In the following DISPLAY statement the row and column display dimensions do not add up to the dimension of Transport.

    display Transport where decimals:=2, rowdim:=0, coldim:=1, colsperline:=3;
    

    As a result AIMMS considers the indices corresponding to the dimension deficit as outer, and displays Transport by means of three one-dimensional displays, each of the requested dimension.

    Transport('Amsterdam', j) := data
    { Amsterdam  : 2.50,  Rotterdam  : 2.50,  'Den Haag' : 5.00 } ;
    
    Transport('Rotterdam', j) := data
    { Amsterdam  : 2.50,  Rotterdam  : 5.00,  'Den Haag' : 5.00 } ;
    
    Transport('Den Haag', j) := data
    { Rotterdam  : 2.50,  'Den Haag' : 5.00 } ;
    
  • The following DISPLAY statement illustrates how a composite table can be obtained for identifiers defined over the same domain, with a different number of decimals for each identifier.

    display { Supply decimals := 2, Demand decimals := 3 };
    

    Execution of this statement results in the creation of the following one-dimensional composite table.

    Composite table:
        i             Supply   Demand
    !   ----------    ------  -------
        Amsterdam      10.00    5.000
        Rotterdam      12.50   10.000
        'Den Haag'      7.50   15.000
        ;