Anylogic-how to create parament containing changing growth rate over time

Viewed 21

I am building a simulation in Anylogic. I am new to anylogic. I would like to define a parameter: e.g. expected growth rate. it is not constant. it changes monthly. I would like to assign growth rate over a 18 month horizon and add product variants. e,g. product A, growthrate is 5% in the first month, Product B is 4% in the first month. product A, growthrate is 3% in the second month, Product B is 5% in the second month.

How do I realize the requirement in Anylogic

Bests Zishi

1 Answers

Create a variable called growthRates of type ArrayList<Double>() of size how many products you simulate.

Create an integer variable called month.

Create a Source block that creates a dummy agent every month and connect it to a Sink block. Inside Sink block, On Enter section, update your variables based on the time. For example;

month+=1;
if (month==0){
   growthRates.set(0, 0.05); //growth rate for product A
   growthRates.set(1, 0.04; //growth rate for product B
}
else if(month==1){

   growthRates.set(0, 0.06); //growth rate for product A
   growthRates.set(1, 0.03); //growth rate for product B
}

...

Then in your simulation, you use this variable growthRates with the correct index when referring to different products.

Related