Reputation: 11
I am trying to implement a model to simulate development of a community. So I have a city with a population of communities and each community has a population of houses. What I am having problem with is to find a way such that houses (communities) would be developed at different time and different rate. I am new to AnyLogic and any help would be much appreciated. Thanks.
Upvotes: 1
Views: 681
Reputation: 2517
This is quite a general question, but you are talking about dynamically creating instances of Agents. To get the different times/rates of creation, you'd typically use an AnyLogic Event with a recurrence time which sampled from some probability distribution.
Look at the help sections
Agent based modeling > Adding and removing agents from population
and
Defining Behavior. Events and Statecharts > Events
For rate-based creation (i.e., times sampled from an exponential distribution), use a rate-triggered Event. For some other distribution (say normal or uniform or some custom one), use either a Dynamic Event (and have the first such event setup another instance of the Dynamic Event) or a normal Event with a first occurrence and recurrence time which are expressions that sample from the distribution
(e.g., normal(2,20)
).
For help with probability distributions see this help section:
AnyLogic Help > Stochastic Modeling > Probability Distributions
To dynamically create, say, a community in a population called communities
, the Event action would be add_communities()
. (The help explains how you handle setting up any Parameters of the newly-created Agent: the example here uses the default value set in the Agent's parameters, but there is an alternative form where you provide the Parameter values like add_communities("MyCoolPlace", 10)
, assuming the Agent had a String parameter and then an int (integer) one.
If your Event is not in the same Agent that contains the population, the Event action will need to access that Agent (the appropriate add_
function is only present to call in the Agent which owns the population). For info on that, see this help section:
Advanced Modeling with Java > Java Basics for AnyLogic > Where am I and how do I get to…?
Upvotes: 1