|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Environment<T>
public abstract class Environment<T extends Agent>
Base class for agent environments. There are several subclasses for different space types:
| Nested Class Summary | |
|---|---|
static class |
Environment.AgentCollection<T extends Agent>
A collection of agents. |
| Field Summary | |
|---|---|
static int |
LAYOUT_ARRANGED
|
static int |
LAYOUT_RANDOM
|
static int |
LAYOUT_RING
|
static int |
LAYOUT_SPRING_MASS
|
static int |
LAYOUT_USER_DEFINED
|
static int |
NETWORK_ALL_IN_RANGE
This network type is available only in continuous environments |
static int |
NETWORK_RANDOM
|
static int |
NETWORK_RING_LATTICE
|
static int |
NETWORK_SCALE_FREE
|
static int |
NETWORK_SMALL_WORLD
|
static int |
NETWORK_USER_DEFINED
|
static int |
SPACE_CONTINUOUS_2D
|
static int |
SPACE_DISCRETE_2D
|
static int |
TIME_CONTINUOUS
|
static int |
TIME_DISCRETE
|
| Constructor Summary | |
|---|---|
Environment(ActiveObject activeObject)
Creates an environment with default settings: - continuous time - continuous space of size 500 x 500 - no connections ("user-degfined" network) You may change these settings by calling the corresponding methods while the environment is empty (no agents registered). |
|
| Method Summary | |
|---|---|
void |
applyNetwork()
Discards all existing connections and establishes new connection network according to the current network settings. |
boolean |
areStepsEnabled()
Tests if the time steps are enabled. |
void |
deliverToAll(java.lang.Object msg)
Immediately delivers a nessage to all agents in the environment. |
void |
deliverToRandom(java.lang.Object msg)
Immediately delivers a nessage to a random agent in the environment, if there are any agents. |
void |
disableSteps()
Disables time steps. |
void |
enableSteps(double stepDuration)
Enables discrete time steps with a given duration. |
abstract java.lang.String |
formatSpaceType()
Returns the name of the space type |
Environment.AgentCollection<T> |
getAgentCollection()
Returns the collection of all agents registered with this environment. |
double |
getConnectionsPerAgent()
Returns the average (or exact) number of connections per agent. |
double |
getHeight()
Returns the height of environment space. |
double |
getNeighborLinkProbability()
Returns the probability of an agent connection to be a neighbor. |
int |
getNetworkType()
Returns the network type. |
T |
getRandomAgent()
Returns a randomly chosen agent in the environment or null if there are no agents |
int |
getScaleFreeM()
Returns the M parameter of a scale free network. |
abstract int |
getSpaceType()
Deprecated. this method is deprecated since different space types are presented in different Environment* classes |
double |
getWidth()
Returns the width of environment space. |
static java.lang.String |
layoutTypeToString(int type)
|
void |
onAfterStep()
A callback that is called when at the end of every step after the agents have performed all their step actions. |
void |
onBeforeStep()
A callback that is called at the beginning of every step before the agents are asked to perform any their step actions. |
void |
onDestroy()
This method must be called when the environment is destroyed. |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object The method is used in snapshot saving/loading |
void |
setNetworkRandom(double connectionsPerAgent)
Sets network type to random with a given average number of connections per agent. |
void |
setNetworkRingLattice(int connectionsPerAgent)
Sets network type to ring lattice. |
void |
setNetworkScaleFree(int m)
Sets the network type to "scale free". |
void |
setNetworkSmallWorld(int connectionsPerAgent,
double neighborLinkProbability)
Sets network type to "small world". |
void |
setNetworkUserDefined()
Sets network type to user-defined. |
int |
size()
Returns the number of agents registered with this environment. |
static java.lang.String |
spaceTypeToString(int type)
Deprecated. use formatSpaceType() |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int TIME_CONTINUOUS
public static final int TIME_DISCRETE
public static final int SPACE_CONTINUOUS_2D
public static final int SPACE_DISCRETE_2D
public static final int NETWORK_USER_DEFINED
public static final int NETWORK_RANDOM
public static final int NETWORK_ALL_IN_RANGE
public static final int NETWORK_RING_LATTICE
public static final int NETWORK_SMALL_WORLD
public static final int NETWORK_SCALE_FREE
public static final int LAYOUT_USER_DEFINED
public static final int LAYOUT_RANDOM
public static final int LAYOUT_ARRANGED
public static final int LAYOUT_RING
public static final int LAYOUT_SPRING_MASS
| Constructor Detail |
|---|
public Environment(ActiveObject activeObject)
activeObject - the active object where environemnt is defined| Method Detail |
|---|
public void onDestroy()
public Environment.AgentCollection<T> getAgentCollection()
public int size()
public T getRandomAgent()
public void disableSteps()
public void enableSteps(double stepDuration)
stepDuration - the duration of a step, normally 1public boolean areStepsEnabled()
public void onBeforeStep()
public void onAfterStep()
@Deprecated public abstract int getSpaceType()
SPACE_DISCRETE_2DSPACE_CONTINUOUS_2D)
public double getWidth()
public double getHeight()
public void deliverToAll(java.lang.Object msg)
msg - the messagepublic void deliverToRandom(java.lang.Object msg)
msg - the messagepublic void restoreOwner(java.lang.Object owner)
restoreOwner in interface com.xj.anylogic.engine.internal.Childowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGrouppublic void setNetworkUserDefined()
public void setNetworkRandom(double connectionsPerAgent)
connectionsPerAgent - average number of connections per agentpublic void setNetworkRingLattice(int connectionsPerAgent)
connectionsPerAgent - number of connections per agent (even)
public void setNetworkSmallWorld(int connectionsPerAgent,
double neighborLinkProbability)
connectionsPerAgent - number of connections per agent (even)neighborLinkProbability - probability of connection to link neighborspublic void setNetworkScaleFree(int m)
m - parameter of the scale free network (start number of hubs?)public int getNetworkType()
public double getConnectionsPerAgent()
public double getNeighborLinkProbability()
public int getScaleFreeM()
public void applyNetwork()
public java.lang.String toString()
toString in class java.lang.Objectpublic abstract java.lang.String formatSpaceType()
@Deprecated public static java.lang.String spaceTypeToString(int type)
formatSpaceType()
public static java.lang.String layoutTypeToString(int type)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||