Reporting data over composite objects

This is a companion article to Modeling composite objects.

In this article, a tabular and a composite table are presented based on data from both the component and reference element based approaches.

The AIMMS 4.82 project download

Creating tabular and composite tables with the composite approach

A tabular display of the arcs allowed based on node sets is presented easily by displaying the identifier bp_arcs.

../../_images/component-tabular.png

The following is a display of all data defined over arcs

../../_images/component-list.png

To get the data for all arcs including zeros, the display domain needs specifications as follows:

../../_images/component-list-option-setting.png

Creating tabular and composite tables with the reference approach

To create a tabular display of the arc set, see following image,

../../_images/reference-tabular.png

a new identifier needs to be created based on the components in the arcs.

1Parameter bp_arcsDef {
2    IndexDomain: (i_nodeFrom,i_nodeTo);
3    Range: binary;
4    Definition: {
5        pr_defArcDef();
6    }
7}

To fill this parameter with data, a small procedure is perhaps efficient.

 1Procedure pr_defArcDef {
 2    Body: {
 3        bp_arcsDefTmp( i_arc, ep_arcNodeFrom( i_arc ), ep_arcNodeTo( i_arc ) ) := 1;
 4        bp_arcsDef(i_nodeFrom, i_nodeTo ) := exists( i_arc | bp_arcsDefTmp(i_arc, i_nodeFrom, i_nodeTo) );
 5    }
 6    Parameter bp_arcsDefTmp {
 7        IndexDomain: (i_arc,i_nodeFrom,i_nodeTo);
 8        Range: binary;
 9    }
10}

However, except for a from/to like relation, a tabular display of a set of composite objects is rarely used. More likely a list view of the data is presented as below.

../../_images/reference-list.png

To create the row names in this list, an element text annotation can be used.

1StringParameter sp_arcName {
2    IndexDomain: i_arc;
3    Definition: {
4        formatString( "%e %s %e",
5            ep_arcNodeFrom( i_arc ),
6            character( 10230 ), ! Right arrow unicode.
7            ep_arcNodeTo(   i_arc ) )
8    }
9}

Note that such arc descriptions are not available for the component based approach as element text annotation is per single set only.

To get the data for all arcs including zeros, the display domain needs specifications as follows:

../../_images/reference-list-option-setting.png

Summary

Reporting data from the component based and the reference element based approach is almost similar; except that the arc names can be more elaborate in the reference element based approach.