Environment

In AnyLogic agent plays a role of an environment for the agent populations present on its diagram. So environments can be hierarchically organized (for example, agents-companies can live in one environment and agents-employees can live in local company environments). Agent population can belong to at most one environment. 

  To set the environment for an agent population

  1. Open the properties of the agent type playing a role of environment for the agent population by clicking it in the Projects view (e.g. Main).
  2. In the Space and network section of the properties, select the populations in the list Select the agents you want to place in the environment.
  3. In the properties below, configure the space type for the environment and set the space dimensions.
  4. Optionally, choose the pattern of the initial agent location layout and choose one of the connection network types.

Managing the standard contact networks dynamically

Function

Description

NetworkType getNetworkType()

Returns the network type. 

Possible values: NETWORK_USER_DEFINED, NETWORK_RANDOM, NETWORK_ALL_IN_RANGE, NETWORK_RING_LATTICE, NETWORK_SMALL_WORLD, NETWORK_SCALE_FREE.

double getNetworkConnectionRange()

Returns the range of agent connections.

double getNetworkConnectionsPerAgent()

Returns the average (or exact) number of connections per agent. Applies to random, ring lattice and small world networks.

double getNetworkNeighborLinkProbability()

Returns the probability of an agent connection to be a neighbour. Applies to "small world" network.

int getNetworkScaleFreeM()

Returns the M parameter of a scale free network. Applies to "scale free" network.

void setNetworkRandom(double connectionsPerAgent)

Sets network type to random with a given average number of connections per agent. Call applyNetwork() to actually create network connections.

Parameter: connectionsPerAgent - average number of connections per agent

void setNetworkRingLattice(int connectionsPerAgent)

Sets network type to ring lattice. All agents are considered to be in a ring in their natural order and each agent is connected to a given number of closest neighbours. Call applyNetwork() to actually create network connections.

Parameter: connectionsPerAgent - number of connections per agent (even)

void setNetworkScaleFree(int m)

Sets the network type to "scale free".

Parameter: m - parameter of the scale free network (start number of hubs)

void setNetworkSmallWorld(int connectionsPerAgent, double neighborLinkProbability)

Sets network type to "small world". Small world network can be obtained from a ring lattice by rewiring some links to long-distant links. Call applyNetwork() to actually create network connections.

Parameters:
connectionsPerAgent - number of connections per agent (even)
neighborLinkProbability - probability of connection to link neighbours

void setNetworkUserDefined()

Sets network type to user-defined. As a result, a subsequent call of applyNetwork() will do nothing. This is also a default network type.

void setNetworkAllInRange(double connectionRange)

Sets network type to the one when agents are connected if the distance between them is not longer that a given one. This network type is only possible in continuous space. Call applyNetwork() to actually create network connections.

Parameter: connectionRange - the maximum distance between connected agents. In case of GIS space, measured in meters

void applyNetwork()

Discards all existing connections and establishes new connection network according to the current network settings.

void applyNetwork(Random r)

Discards all existing connections and establishes new connection network according to the current network settings, using the specified random number generator.

Parameter: r - the random number generator