Hello Chunyang,
To understand the ordening of elements in an AIMMS set,
it helps to know how AIMMS constructs the ordening.
A root set is a one-dimensional set that is not a sub set of another set.
AIMMS associates with each root set an element space.
An element space maps each element to an element number.
Whenever a new element is added to a root set, it gets the next available element number in the element space.
Removing an element from a root set, will not result in removing that element from the element space; unless you are using CleanDepedents,
see also https://documentation.aimms.com/language-reference/data-communication-components/data-initialization-verification-and-control/data-control.html
The elements in a set are presented by default with increasing element numbers;
this may not coincide with the presentation you may have expected as you clearly demonstrate.
You can override the order of presentation via the order by attribute,
see https://documentation.aimms.com/language-reference/non-procedural-language-components/set-declaration/set-declaration-and-attributes.html#set-declaration-and-attributes
A special root set is the predeclared set Integers.
The element space associated with this root set does not maintain an mapping stored in memory,
but rather a function that maps each element to an integer.
Thus the set Integers, and all its subsets, present their elements by default in increasing order.
During one session while developing an AIMMS project; elements may be added to a root set in an unexpected order,
and during that same session this unexpected order will be kept.
This may explain the behavior you reported.
That is why, during testing, I always start AIMMS sessions afresh, such that I know that behaviour observed, can be reproduced.
To fill the set Time with elements 1 to 24, presented in increasing order, I attached two small AIMMS projects to this reply.
In the first project, ElementRange, the AIMMS function ElementRange is used, see https://documentation.aimms.com/functionreference/elementary-computational-operations/set-related-functions/elementrange.html
In this project, the set Time is defined as ElementRange(1,24,fill:0)
In the second project, AXLLRead, the axll::readset procedure is used.
Does the above help you understand ordering and enable you to work with AIMMS' set ordenings?
With kind regards,
Chris.