Fill an empty set with a procedure

44 views
Skip to first unread message

garzonci...@gmail.com

unread,
May 7, 2019, 7:44:20 PM5/7/19
to AIMMS - The Modeling System
I have an empty set called "Spaces"
My idea is to create a space and its respective parameters inside a while
I have an iteration ID called "iterNr"
When I try to use SetElementAdd(Spaces, iterNr, iterNr) it shows an error that says "The second argument of intrinsic procedure "SetElementAdd" is not a scalar element parameter into the set "Spaces" (or another set with the same root set)"

Mohan

unread,
May 7, 2019, 7:48:52 PM5/7/19
to AIMMS - The Modeling System
Hello,

You are using the statement wrong.

The second argument for SetElementAdd is an element parameter with the range Spaces (same as the set you provided for the first argument).

You can declare a new element parameter by adding a new identifier. You can also update the declaration of the set Spaces with the attribute "Parameter". Specify a name there, say ep_Space.

Now your for loop call will be SetElementAdd(Spaces, ep_Space, iterNr).

The logic is, an element parameter is a data structure to store a single element in a set. So, each element parameter is linked to a specific set so that it can hold the elements of that set.

SetElementAdd is adding a single element to the set Spaces. So, you store that single element in the element parameter ep_Space whose value will be equal to iterNr.
Reply all
Reply to author
Forward
0 new messages