Skip to main content
Solved

Looping Execution Array

  • October 18, 2022
  • 2 replies
  • 89 views

Forum|alt.badge.img+3

Hello,

I'm trying to do some sensitivity runs where I scale a parameter each run and resolve.

The problem is I can't seem to very simply make an array to loop over to scale the parameter.

 

Basically this:

FOR x in [50, 75, 100] DO

   y = x * z;

   solve LP;

ENDFOR

 

Just creating the array and looping through it is giving me trouble. I don't know the best way - import the array as a parameter? Then it gets mad it doesn't have an index? But it doesn't even really have an index. Then x has to be a declared parameter as well?

Is there an easy way to do this or maybe it's because AIMMS isn't made for scripts? I can't seem to find a syntax guide that talks about declaring an array parameter.

Thanks for helping a noob!

Best answer by Chris Kuip

Hi,

 

You are almost there: just replace [ ] with { } in your code.

 

I created small example:

Here x is declared as an index with range Integers, and y and z are two parameters.

This gives the following listing file:

For your convenience, I've attached the AIMMS 4.88 project.

With kind regards,

 

Chris.

2 replies

Chris Kuip
AIMMSian
Forum|alt.badge.img+7
  • AIMMSian
  • Answer
  • October 18, 2022

Hi,

 

You are almost there: just replace [ ] with { } in your code.

 

I created small example:

Here x is declared as an index with range Integers, and y and z are two parameters.

This gives the following listing file:

For your convenience, I've attached the AIMMS 4.88 project.

With kind regards,

 

Chris.


Forum|alt.badge.img+3
  • Author
  • Enthusiast
  • October 21, 2022

Thanks Chris! That did it.


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

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