Skip to main content

Dear All,

I want to write an equation for calculating growth in a parameter or variable. As an example:

Pop(t) = Pop(t-1) + GrowthFactor(t)*Pop(t-1)

How to do this inside AIMMS?

Thank you.

Hi, @rahmat .

 

Parameter
I tried using this approach and it worked

 

Code (remark: PRD → t):

popini $ (Ord(PRD) = 1)
+ pop(PRD-1) $ (Ord(PRD) > 1)
+ growthFactor(PRD) * pop(PRD-1) $ (Ord(PRD) > 1)

where popini is your initial value.

 

Variable

Similar to parameter. You can create a constraint as shown below:

Code (remark: PRD → t):

vPop(PRD)
=
popini $ (Ord(PRD) = 1)
+ vPop(PRD-1) $ (Ord(PRD) > 1)
+ growthFactor(PRD) * vPop(PRD-1) $ (Ord(PRD) > 1)

where popini is your initial value.

 

Hope this helps!


Hello @mateusarakawa ,

Thank you very much for the advice given.

One more question, is there any difference between using "$" and "|" in writing formulas in parameters or variables?


Hello @mateusarakawa ,

Thank you very much for the advice given.

One more question, is there any difference between using "$" and "|" in writing formulas in parameters or variables?

 

Hi, @rahmat.

Great question. I wasn’t able to find exactly, for all cases, the difference between “$” and “|”.

I know they are similar when we are calculating or using functions, as mentioned in this page:
https://documentation.aimms.com/language-reference/sparse-execution/the-aimms-sparse-execution-engine/modifying-the-sparsity.html

In the documentation above “$” is a sparsity operator, but in some cases “$” means ONLYIF, like in the code that I worte in this topic. I know also that only “|” can be used to define domains.​

 

AIMMS compiler is evolving, maybe @mohansx or other aimmsian can help us finding the documentation that explains this difference.


Thank you very much...


Reply


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

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