Filling a set via the union of its subsets

  • 6 October 2021
  • 4 replies

Userlevel 2

In AIMMS it is possible to define a set via a union of some of its subsets. 

As an example: 

Set Locations {

     Definition: Factories + Warehouses + Stores;


Set Factories {

    SubsetOf : Locations;


Set Warehouses {

    SubsetOf : Locations;


Set Stores {

   SubsetOf Locations;



This is a powerful feature in AIMMS and it seems very logical to use, but to implement this, we are faced with several exceptions to the normal flow.


  1. For an ordinary subset it is not allowed to add elements to it that are not present in the super set. But if AIMMS would not allow that in the given example, then it becomes impossible to fill any of the sets with elements. So, if AIMMS recognizes this construction it introduces an exception that is should allow that the subset (temporarily) contains elements that are not in the superset. Only after the definition of Locations has been re-evaluated the expected subset relation is corrected.
  2. AIMMS works with dependencies between identifiers. When assigning to an identifier, the code first makes sure that all identifiers on which the identifier depends are made ‘up-to-date’. So for an ordinary subset, before assigning to it, first the definition of its super set is evaluated. If this mechanism would be applied here, then we end up in a circular dependency: Factories depends on Locations, and Locations (via its definition) depends on Factories. So again, AIMMS adds an exception in this dependency structure: if it encounters the above construction of sets then Factories will not depend on Locations.


Now, why am I sharing this? That is because this feature of AIMMS has never been described in any of the documentation (at least I cannot find it), and we don't have a proper name for it. 

And, to be really honest: this concept did result in some bug reports lately, and every time that I have to write a release note for it, I feel that I first need to describe this feature. It would be so much easier if I could just mention the feature by name and perhaps refer to some place in the documentation.

So… does anyone have a suggestion on how we should name this feature?



4 replies

Userlevel 4
Badge +2

Hi Richard,

Perhaps Constituent subsets?

With kind regards,



Userlevel 4
Badge +2

Never knew that this required such special handling on the back-end. A great feature that I have used very often in a lot of projects in the past!

As a name suggestion, something like “Concatenated Rootsets”?


something like “union-defined sets”?

Userlevel 5
Badge +1

Thanks for your suggestions @Chris Kuip  @gdiepen @Diego Perez-Urruti !

We’ll reach out to you shortly with a tree planted certificate as a thank you :)


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator