public class TKEnvironment extends Watcher
AbstractAgent.ReturnCode, AbstractAgent.State| Modifier and Type | Field and Description |
|---|---|
protected boolean |
GPU_GRADIENTS |
logger| Constructor and Description |
|---|
TKEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate() |
protected Pheromone |
createCudaPheromone(String name,
float evaporationPercentage,
float diffusionPercentage) |
int |
createTurtle(Turtle t)
Launch a turtle with a random location
|
int |
createTurtle(Turtle t,
double x,
double y)
Launch a turtle with predefined coordinates
|
protected static void |
executeThisEnvironment(String... args)
This offers a convenient way to create a main method
that launches a simulation using the environment
class under development.
|
int |
get1DIndex(int xcor,
int ycor) |
int |
getHeight() |
protected Patch |
getPatch(int i,
int j) |
protected Patch[] |
getPatchGrid() |
Pheromone |
getPheromone(String name)
Gets the corresponding pheromone or create a new one using defaults
parameters : 50% for both the evaporation rate and
the diffusion rate.
|
Pheromone |
getPheromone(String name,
float evaporationPercentage,
float diffusionPercentage)
Gets the corresponding pheromone or create a new one using the
parameters if available: The first float is the evaporation rate and the second
is the diffusion rate.
|
Pheromone |
getPheromone(String name,
int evaporationPercentage,
int diffusionPercentage)
Gets the corresponding pheromone or create a new one using the
parameters if available: The first float is the evaporation rate and the second
is the diffusion rate.
|
Collection<Pheromone> |
getPheromones() |
List<Turtle> |
getTurtlesWithRoles(String role)
Gets the turtles with this role in the default community and group
|
List<Turtle> |
getTurtlesWithRoles(String community,
String group,
String role) |
int |
getWidth() |
boolean |
isCudaOn() |
double |
normalizeX(double x)
Returns the normalized value of x, so that
it is inside the environment's boundaries
|
double |
normalizeX(int x)
Returns the normalized value of x, so that
it is inside the environment's boundaries
|
double |
normalizeY(double y)
Returns the normalized value of y, so that
it is inside the environment's boundaries
|
double |
normalizeY(int y)
Returns the normalized value of y, so that
it is inside the environment's boundaries
|
protected void |
resetPheroMaxValues()
reset max values for rendering purposes
|
void |
synchronizeEnvironment(boolean synchronizedEnvironment)
Keep the agents synchronized with the environment dynamics
|
protected void |
update() |
addProbe, allProbes, getProbes, removeAllProbes, removeProbe, toStringbroadcastMessage, broadcastMessageWithRole, bucketModeCreateGroup, bucketModeRequestRole, checkAgentAddress, compareTo, createGroup, createGroup, createGroup, createGroupIfAbsent, createGroupIfAbsent, createGroupIfAbsent, createGUIOnStartUp, destroyCommunity, destroyGroup, destroyRole, end, executeThisAgent, executeThisAgent, executeThisAgent, getAgentAddressIn, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getDistantAgentWithRole, getExistingCommunities, getExistingGroups, getExistingRoles, getKernelAddress, getLogger, getMadkitConfig, getMadkitProperty, getMadkitProperty, getMyGroups, getMyRoles, getName, getNetworkID, getOrganizationSnapShot, getReplyTo, getServerInfo, getSimpleNetworkID, getState, hasGUI, hashCode, hasRole, isAlive, isCommunity, isGroup, isKernelOnline, isMadkitPropertyTrue, isMessageBoxEmpty, isRole, killAgent, killAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgentBucket, launchAgentBucket, launchAgentBucket, launchAgentBucket, launchNode, launchXmlAgents, leaveGroup, leaveRole, nextMessage, nextMessage, nextMessages, proceedEnumMessage, purgeMailbox, receiveMessage, reload, requestRole, requestRole, sendMessage, sendMessage, sendMessageWithRole, sendMessageWithRole, sendReply, sendReplyWithRole, setLogLevel, setMadkitProperty, setMadkitProperty, setName, setupFramepublic Collection<Pheromone> getPheromones()
protected Patch getPatch(int i, int j)
public final double normalizeX(double x)
x - x-coordinatepublic final double normalizeY(double y)
y - y-coordinatepublic final double normalizeX(int x)
x - x-coordinatepublic final double normalizeY(int y)
y - y-coordinatepublic int get1DIndex(int xcor,
int ycor)
x - absolutey - absoluteTurtle.xcor() and
Turtle.ycor().
Its purpose is to be used on a
Pheromoneprotected void update()
public int createTurtle(Turtle t, double x, double y)
t - x - y - public int createTurtle(Turtle t)
t - protected void resetPheroMaxValues()
public int getWidth()
public int getHeight()
public Pheromone getPheromone(String name)
name - the pheromone's namepublic Pheromone getPheromone(String name, int evaporationPercentage, int diffusionPercentage)
name - the pheromone's nameparameters - the first float is the evaporation rate and the second
is the diffusion rate.public Pheromone getPheromone(String name, float evaporationPercentage, float diffusionPercentage)
name - the pheromone's nameparameters - the first float is the evaporation rate and the second
is the diffusion rate.protected Pheromone createCudaPheromone(String name, float evaporationPercentage, float diffusionPercentage)
public List<Turtle> getTurtlesWithRoles(String community, String group, String role)
community - the group's community.group - the targeted group.role - the desired role.public List<Turtle> getTurtlesWithRoles(String role)
role - protected final Patch[] getPatchGrid()
protected static void executeThisEnvironment(String... args)
args - MaDKit or TurtleKit optionsAbstractAgent.executeThisAgent(int, boolean, String...)public boolean isCudaOn()
public void synchronizeEnvironment(boolean synchronizedEnvironment)
synchronizedEnvironment -