Package com.anylogic.engine
- Field Summary
- Method Summary
- Method Details
- agents
- size
- randomAgentInside
- randomAgentInside
- randomAgentExcept
- randomAgentExcept
- deliverToAllAgentsInside
- deliverToRandomAgentInside
- applyNetwork
- applyNetwork
- disableSteps
- enableSteps
- areStepsEnabled
- setNetworkUserDefined
- setNetworkRandom
- setNetworkRingLattice
- setNetworkSmallWorld
- setNetworkScaleFree
- getNetworkType
- getNetworkConnectionsPerAgent
- getNetworkNeighborLinkProbability
- getNetworkScaleFreeM
- register_xjal
- register_xjal
- unregister_xjal
- toStringNetwork_xjal
- getSpaceType
- toStringSpace_xjal
- setNetworkType_xjal
- All Superinterfaces:
AgentExtension
,Serializable
- All Known Subinterfaces:
ExtEnvironmentContinuous
,ExtEnvironmentDiscrete
,ExtEnvironmentGIS
,ExtEnvironmentWithLayout
,ExtEnvironmentWithMetrics
public interface ExtEnvironmentInteractive extends AgentExtension
Extension interface for agent environment with communication enabled.
- Author:
- AnyLogic North America, LLC https://anylogic.com
Modifier and Type | Method | Description |
---|---|---|
Collection<Agent> | agents() |
Returns the collection of all agents registered with this environment.
|
default void | applyNetwork() |
Discards all existing connections and establishes new connection
network according to the current network settings.
|
void | applyNetwork |
Discards all existing connections and establishes new connection
network according to the current network settings,
using the specified random number generator, if required by network type.
|
boolean | areStepsEnabled() |
Tests if the time steps are enabled.
|
void | deliverToAllAgentsInside |
Immediately delivers a message to all agents in the environment.
|
void | deliverToRandomAgentInside |
Immediately delivers a message to a random agent in the environment,
if there are any agents.
|
void | disableSteps() |
Disables time steps.
|
void | enableSteps |
Enables discrete time steps with a given duration.
|
double | getNetworkConnectionsPerAgent() |
Returns the average (or exact) number of connections per agent.
|
double | getNetworkNeighborLinkProbability() |
Returns the probability of an agent connection to be a neighbor.
|
int | getNetworkScaleFreeM() |
Returns the M parameter of a scale free network.
|
NetworkType | getNetworkType() |
Returns the network type.
|
SpaceType | getSpaceType() |
Returns the space type of this environment, one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE |
default Agent | randomAgentExcept |
Returns a randomly chosen agent in the environment except the given agent
or
null if there are no such agents |
Agent | randomAgentExcept |
Returns a randomly chosen agent in the environment except the given agent
or
null if there are no such agents. |
default Agent | randomAgentInside() |
Returns a randomly chosen agent in the environment or
null
if there are no agents |
Agent | randomAgentInside |
Returns a randomly chosen agent in the environment or
null
if there are no agents. |
void | register_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | register_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setNetworkRandom |
Sets network type to random with a given average number of connections per
agent.
|
void | setNetworkRingLattice |
Sets network type to ring lattice.
|
void | setNetworkScaleFree |
Sets the network type to "scale free".
|
void | setNetworkSmallWorld |
Sets network type to "small world".
|
void | setNetworkType_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setNetworkUserDefined() |
Sets network type to user-defined.
|
int | size() |
Returns the number of agents registered with this environment.
|
String | toStringNetwork_xjal() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
String | toStringSpace_xjal() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | unregister_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
Collection<Agent> agents()
Returns the collection of all agents registered with this environment.
You may iterate over that collection.
int size()
Returns the number of agents registered with this environment.
- Returns:
- the number of agents registered with this environment
default Agent randomAgentInside()
Returns a randomly chosen agent in the environment or
null
if there are no agents- Returns:
- a randomly chosen agent in the environment, or
null
Agent randomAgentInside(Random r)
Returns a randomly chosen agent in the environment or
null
if there are no agents.
This function uses the specified random number generator.- Parameters:
r
- the random number generator.- Returns:
- a randomly chosen agent in the environment, or
null
- Since:
- 8.0
@AnyLogicInternalAPI default Agent randomAgentExcept(Agent agent)
Returns a randomly chosen agent in the environment except the given agent
or
null
if there are no such agents- Parameters:
agent
- this agent will not be returned- Returns:
- a randomly chosen agent in the environment, or
null
@AnyLogicInternalAPI Agent randomAgentExcept(Random r, Agent agent)
Returns a randomly chosen agent in the environment except the given agent
or
null
if there are no such agents.
This function uses the specified random number generator.- Parameters:
r
- the random number generator.agent
- this agent will not be returned- Returns:
- a randomly chosen agent in the environment, or
null
- Since:
- 8.0
void deliverToAllAgentsInside(Object msg)
Immediately delivers a message to all agents in the environment.
- Parameters:
msg
- the message
void deliverToRandomAgentInside(Object msg)
Immediately delivers a message to a random agent in the environment,
if there are any agents.
- Parameters:
msg
- the message
default 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, if required by network type.
- Parameters:
r
- the random number generator.- Since:
- 8.0
void disableSteps()
Disables time steps.
void enableSteps(double stepDuration)
Enables discrete time steps with a given duration.
- Parameters:
stepDuration
- the duration of a step, normally 1
boolean areStepsEnabled()
Tests if the time steps are enabled.
- Returns:
true
if the time steps are enabled,false
otherwise
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 setNetworkRandom(double connectionsPerAgent)
Sets network type to random with a given average number of connections per
agent. Call applyNetwork() to actually create network connections.
- Parameters:
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.
- Parameters:
connectionsPerAgent
- number of connections per agent (even)
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 neighbors
void setNetworkScaleFree(int m)
Sets the network type to "scale free". Scale free network is constructed
according to Barabasi, A. L. and R. Albert. 1999. Emergence of scaling in
random networks. Science 286(5439): 509-512. Call applyNetwork() to actually
create network connections.
- Parameters:
m
- parameter of the scale free network (start number of hubs?)
NetworkType getNetworkType()
Returns the network type. Note that this type has not necessarily been
applied.
- Returns:
- the network type
double getNetworkConnectionsPerAgent()
Returns the average (or exact) number of connections per agent.
Applies to random, ring lattice and small world networks.
- Returns:
- the average (or exact) number of connections per agent
double getNetworkNeighborLinkProbability()
Returns the probability of an agent connection to be a neighbor.
Applies to "small world" network.
- Returns:
- the probability of an agent connection to be a neighbor
int getNetworkScaleFreeM()
Returns the M parameter of a scale free network.
Applies to "scale free" network.
- Returns:
- the M parameter of a scale free network
@AnyLogicInternalAPI void register_xjal(AgentList<?> population)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use
Registers an agent population with this environment.
it may be removed/renamed in future. Please use
Agent.setEnvironment(Agent)
instead.Registers an agent population with this environment.
- Parameters:
population
- the agent population
@AnyLogicInternalAPI void register_xjal(Agent a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use
Registers an agent with this environment and places it at a random location regardless the layout type. No connections are created at this time.
it may be removed/renamed in future. Please use
Agent.setEnvironment(Agent)
instead.Registers an agent with this environment and places it at a random location regardless the layout type. No connections are created at this time.
- Parameters:
a
- the agent
@AnyLogicInternalAPI void unregister_xjal(Agent a)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use
Unregisters an agent with this environment.
it may be removed/renamed in future. Please use
Agent.setEnvironment(Agent)
instead.Unregisters an agent with this environment.
- Parameters:
a
- the agent
@AnyLogicInternalAPI String toStringNetwork_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
SpaceType getSpaceType()
Returns the space type of this environment, one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
- Returns:
- one of
SPACE_CONTINUOUS, SPACE_DISCRETE, SPACE_GIS, SPACE_NONE
@AnyLogicInternalAPI String toStringSpace_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
@AnyLogicInternalAPI void setNetworkType_xjal(NetworkType networkType)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use one of
it may be removed/renamed in future. Please use one of
setNetwork*()
methods instead.- Parameters:
networkType
-