Solved

# Growth Formula

• 4 replies
• 64 views

Userlevel 2 +4
• Ace
• 27 replies

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.

icon

Best answer by mateusarakawa 23 February 2021, 17:00

View original

### 4 replies

Userlevel 5 +2

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!

Userlevel 2 +4

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?

Userlevel 5 +2

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.

Userlevel 2 +4

Thank you very much...