Question about index scope not being specified

  • 21 November 2023
  • 0 replies

Userlevel 5
Badge +7

Hi all,


I am aware that AIMMS will use all of the indices specified on the Left Hand Side of an assignment statement to loop over all combinations.

When trying out something in a test project I am working on, I wanted to use this logic, but found that this does not work anymore when you are using formatstring on the LHS. Was wondering if this is on purpose or whether this behavior should be possible


Example that works:

spStringParameter( StringToElement(sTargetSet, iSource, 1) ) := formatstring("Test :: element %e", iSource) ; 

Example that does not work:

spStringParameter( StringToElement(sTargetSet, formatstring("%e", iSource), 1) :=  formatstring("Test :: element %e", iSource) ; 


When running the second one, I get an error indicating that the scope of iSource has not been specified. The above is a minimal example of the problem, not completely the same as what I had. I can work around it by either putting the statement in an explicit for-loop, or create the mapping isource → itarget in an intermediate mapping parameter. Was just wondering if it should work or not 😉

0 replies

Be the first to reply!


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

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