AnyLogic
Expand
Font size

Parameter propagation

You can associate a parameter of an agent type with a parameter of its embedded agent. In this case if you change an agent type parameter during the model execution, the associated agent's parameter depending on it also changes. This holds generally for all parameter dependencies down the agent tree from the modification point.

You can associate parameters of the same type only.

Propagate values of parameters down the agents hierarchy when:

  • You need to change parameters of several agents at once. You can simply do this by creating a single parameter of the capsule agent and propagating its value to several parameters you need to change.
  • You need to optimize the model by changing the parameter of a non-top-level agent. In this case, you also need parameter propagation since you can optimize model by changing only the top-level agent parameters. The same applies to other complex multi-run experiments (e.g. calibration, parameter variation, etc.) when they should operate with parameters of non-top-level agents.
  • You need to interactively change parameters of embedded agents or agent populations using controls (sliders, edit boxes, etc.) located on the top-level agent diagram (usually Main).

To associate a parameter of an agent type with a parameter of its embedded agent or population

  1. Open the diagram of the agent type in the graphical editor.
  2. Select the embedded agent and navigate to the Properties view.
  3. Enter the name of the top-level agent parameter in the field where the value of the corresponding embedded agent's parameter is set. This parameter will automatically obtain the value from the specified top-level agent's parameter.

Example

Demo model: Predator Prey Agent Based Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

In this model, several parameters of the Main agent type are associated with the parameters of the hares and lynx agent populations. If you open the properties of the hares population, you will see that all parameters of the population are associated with the parameters of Main agent.

For example, the HareNumberPerBirth parameter of the Main agent is specified as the value of the NumberPerBirth parameter. These parameters are linked to enable users interactively changing the value of the population parameter using the slider located on the Main agent diagram. This slider changes the value of the HareNumberPerBirth parameter of the Main agent, and due to the established binding, the value of the NumberPerBirth parameter automatically changes for all agents from hares.

In order to make it easier to understand the existing dependencies, when a model element is selected in the graphical editor, all model items that the selected item refers to in its properties, are highlighted. On the left side of the image, you can see that all the associated parameters are highlighted on the Main diagram.

How can we improve this article?