Get elements of a set using set name as a string?

  • 9 August 2023
  • 0 replies
  • 16 views

Userlevel 5
Badge +7

Today I got the question: Get elements of a set using set name as a string?

This can be achieved using a runtime library.

The interface to the data is a procedure with:
- input   : the set name
- outputs : 
  o an integer set with the same number of elements
  o a string parameter indexed over that integer set with the names of the elements as strings.

The tricky part of creating the runtime library is the passing of arguments. 
Arguments are local identifiers in a procedure, and local identifiers cannot be directly created
using model editing procedures. 
This is circumvented by first creating the declaration section, and
then moving that declaration section as a section inside the procedure.

An example project which does just that is enclosed.


0 replies

Be the first to reply!

Reply


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

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