Determine where each identifier is used in your model

<pubDate>Thu, 01 Dec 2011 15:03:20 +0000</pubDate>


<guid isPermaLink="false"></guid>



        <![CDATA[Over time, AIMMS projects tend to grow larger. During such an evolution of a project, some identifiers can become obsolete.

With larger models, often the question is where each identifier is used

in the model, or more important, if it is still used in the model. In

this article, we want to provide you with a way to determine which of

the identifiers in your model might be obsolete.

The goal is to create the indexed subset sIdentfiersUsing, which

contains a subset of AllIdentifiers for each identifier declared in your



   identifier   :  sIdentifiersUsing

   index domain :  iRegularIdentifier

   subset of    :  AllIdentifiers


   identifier :  sRegularIdentifiers

   subset of  :  AllIdentifiers

   index      :  iRegularIdentifier

   definition :  { indexIdentifiers |

                            IdentifierType(IndexIdentifiers) <> 'Section'

                        and IdentifierType(IndexIdentifiers) <> 'Module'

                        and IdentifierType(IndexIdentifiers) <> 'LibraryModule'

                        and IdentifierType(IndexIdentifiers) <> 'declaration'


As you can see, the set sIdentifiersUsing is indexed over a subset of

AllIdentifers, namely all the identifiers except for the Sections,

Modules, Libraries, and declaration sections.

To fill the sIdentifiersUsing set with the identifiers that are using

the identifier iRegularIdentifier, we make use of the intrinsic

procedure ReferencedIdentifiers (see Function Reference) in the

following procedure:


  identifier :  prDetermineReferenced



       identifier :  sReferencedIdentifiers

       subset of  :  AllIdentifiers

       index      :  iReferencedIdentifier ;


       identifier :  sIdentifierSingleton

       subset of  :  AllIdentifiers ;


  body       :

    !First empty the set

    empty sIdentifiersUsing ;

    for iRegularIdentifier do

        !For each non {section/module/library/declaration} identifier in your

        !model, create a singleton set, containing only this identifier

        !(needed because ReferencedIdentifiers must have a set as argument

        sIdentifierSingleton := iRegularIdentifier ;

        !Retrieve all the identifiers that are referenced in all attributes

        !of the current identifier

        sReferencedIdentifiers := ReferencedIdentifiers(




                                   * sRegularIdentifiers ;

        !We now know which identifiers are referenced by iRegularIdentifer.

        !For each of these identifiers, we must add a link that it is used by


        for iReferencedIdentifier do

            sIdentifiersUsing( iReferencedIdentifier ) += iRegularIdentifier ;

        endfor ;

     endfor ;


Please note that if the above procedure indicates that an identifier is

not used anymore, this only means it does not have a reference within

your model anymore.

We have created an .aim file of a section containing the above

identifiers, which you can download via the following link: [attachments

include=”4086”] After downloading the above file, please follow the

Importing instructions in the blog post Exporting a section and

importing it in another AIMMS project to import this .aim file into your


Additional information: Even if an identifier is not used anymore in

your model, it could still be present on pages in your project. With a

combination of the two functions PageGetAll and PageGetUsedIdentifiers

(See the Page functions in the Function Reference) you can first obtain

a list of all the pages in your model, then query per page all the

identifiers used on the page, and finally check if the selected

identifier is one of them. This approach will give you per identifier

the list of pages it is used on.

Alternatively, if you are only interested in the binary question “is an

identifier used on any page yes or no?”, you can also make use of the

new function IdentifierGetUsedInformation that has been introduced in

AIMMS 3.12 FR2. This function also allows you to determine if there

exists a reference to the identifier in any of the case types or

menus.]]> <[CDATA[]]> 177 0 0 0

Last Updated: July, 2020