Deploying AIMMS set functionality to composite objects

This is a companion article to Modeling composite objects.

AIMMS provides extensive functionality on sets and elements, including, among others:

  1. element parameters,

  2. element valued functions,

  3. element valued iterative operators,

  4. set valued iterative operators, and

  5. indexed sets.

The AIMMS 4.82 project download

Can this functionality be used in the two approaches to model composite objects?

The component based approach to support AIMMS set semantics for composite objects

The component based approach is not sufficient to support the above mentioned functionalities.

The first three functionalities enumerated above result in single elements; so they cannot be used to select multiple components, whereby each component is an element in itself. The last three functionalities enumerated above result in subsets of a single set of varying length ; so they cannot be used to select multiple components whereby the elements may come from different sets.

The reference element based approach to support AIMMS set semantics for composite objects

The reference element based approach is sufficient to support the above mentioned functionalities.

As each reference element is an element in an AIMMS set, and a reference element references a composite object; the reference element based approach for composite objects can be used in conjunction with AIMMS set semantics. This is illustrated in the remainder of this section.

As the set s_arcIds is an ordinary set, we can use it everywhere an AIMMS set can be used; for instance in the following declarations:

 1DeclarationSection Declarations_for_set_semantic_support_of_reference_based_approach {
 2    Parameter p_totArcFlow {
 3        IndexDomain: i_arc;
 4    }
 5    ElementParameter ep_arbitraryArc {
 6        Range: s_arcIds;
 7    }
 8    ElementParameter ep_maxOutFlowArc {
 9        IndexDomain: i_node;
10        Range: s_arcIds;
11    }
12    Set s_fewOrderedArcsByFlow {
13        SubsetOf: s_arcIds;
14        OrderBy: user;
15    }
16    Set s_outgoingArcs {
17        IndexDomain: i_node;
18        SubsetOf: s_arcIds;
19    }
20}

With these declarations, the existing AIMMS language can be used:

 1Procedure MainExecution {
 2    Body: {
 3        p_totArcFlow(i_arc) := sum( i_tp, v_flow2(i_tp, i_arc) );
 4
 5        ep_arbitraryArc := Element( s_arcIds,
 6            round( uniform(1, card( s_arcIds ) ) ) );
 7
 8        ep_maxOutFlowArc(i_node) :=
 9            argMax( i_arc | ep_arcNodeFrom( i_arc ) = i_node,
10                p_totArcFlow(i_arc) );
11
12        s_fewOrderedArcsByFlow := NBest( i_arc, p_totArcFlow(i_arc), 4 );
13
14        s_outgoingArcs( i_node ) :=
15            { i_arc | ep_arcNodeFrom( i_arc ) = i_node };
16    }
17}

Remarks on the above code:

  1. Line 3: Ordinary summation.

  2. Line 5, 6: Just selecting an arbitrary arc.

  3. Line 8-10: Here we can select the outgoing arc over which the maximum flow is per node.

  4. Line 12: Using the NBest operator, we can select a few arcs based on flow amount.

  5. Line 14, 15: Filling an indexed set; for each node the set of outgoing arcs.

Summary

Clearly, the reference element based approach is superior to the component based approach when set operations are relevant for a collection of composite objects.