public class PackageWorld extends Environment
Modifier and Type | Field and Description |
---|---|
static java.io.PrintWriter |
actLog |
protected float |
avgEffort |
protected static boolean |
batch
Run in batch mode? If true, then simulation automatically runs when
started and doesn't display a summary dialog window.
|
protected int |
count
The number of turns (each agent's sense/act pair is a turn)
|
static int |
DEFAULT_NUM_AGENTS |
static int |
DEFAULT_NUM_DESTINATIONS
Number of destinations.
|
static int |
DEFAULT_NUM_PACKAGES
Number of packages.
|
static int |
DEFAULT_WORLD_SIZE
The length (and width) of the world.
|
protected int |
delivered
The number of packages successfully delivered.
|
protected PackageState |
initState |
static int |
MAX_NUM_DESTINATIONS |
protected float |
msgLengthPerTurn |
protected int |
numAgents |
protected int |
numDestinations |
protected int |
numPackages |
PacGUI |
pg
The GUI that displays the current world
|
protected float |
thinkPerTurn |
protected long |
thinkTime
The number of milliseconds used by agents to process percepts and
choose actions.
|
protected int |
worldSize |
agents, state
Constructor and Description |
---|
PackageWorld() |
PackageWorld(java.io.PrintWriter actLog) |
Modifier and Type | Method and Description |
---|---|
void |
addAgent(Agent agent)
Add a new agent to the environment.
|
java.util.List<Agent> |
getAgents()
Returns a list of the agents in the environment.
|
int |
getNumAgents()
Return the number of agents in the environment.
|
protected Percept |
getPercept(Agent agt)
Create a percept for an agent.
|
int |
getPerformanceMeasure(Agent a)
Return the performance measure of the agent in the current
environment.
|
java.lang.String |
getScoreMsg()
Returns a string containing score information for the agent team.
|
int |
getTeamPerformanceMeasure()
Return the performance measure of a team of agents in a
cooperative environment.
|
int |
getWorldSize()
Return the size of the grid for the environment.
|
protected boolean |
isComplete()
The simulation is complete when all packages have been delivered or
nothing has happened for two cycles or no packages have been picked up
or dropped off for 5 * n cycles.
|
void |
logMessage(java.lang.String message)
Outputs a message to the log and the GUI.
|
static void |
main(java.lang.String[] args)
Starts the program.
|
void |
resetAgents()
Clears all agents from the environment.
|
void |
setGUI(PacGUI gui)
Associate a GUI with the environment.
|
void |
start(State initState)
Run the simulation starting from a given state.
|
protected void |
updateState(Agent a,
Action action)
Execute an agent's action and update the environment's state.
|
protected long thinkTime
public static int DEFAULT_NUM_AGENTS
public static int DEFAULT_WORLD_SIZE
public static int DEFAULT_NUM_PACKAGES
public static int DEFAULT_NUM_DESTINATIONS
public static int MAX_NUM_DESTINATIONS
protected int numAgents
protected int worldSize
protected int numPackages
protected int numDestinations
public static java.io.PrintWriter actLog
public PacGUI pg
protected PackageState initState
protected int count
protected int delivered
protected float avgEffort
protected float msgLengthPerTurn
protected float thinkPerTurn
protected static boolean batch
public PackageWorld()
public PackageWorld(java.io.PrintWriter actLog)
public void addAgent(Agent agent)
addAgent
in class Environment
public java.util.List<Agent> getAgents()
public void resetAgents()
public java.lang.String getScoreMsg()
protected boolean isComplete()
isComplete
in class Environment
public int getPerformanceMeasure(Agent a)
getPerformanceMeasure
in class Environment
public int getTeamPerformanceMeasure()
getTeamPerformanceMeasure
in class Environment
protected Percept getPercept(Agent agt)
getPercept
in class Environment
protected void updateState(Agent a, Action action)
updateState
in class Environment
public int getWorldSize()
public int getNumAgents()
public void setGUI(PacGUI gui)
public void start(State initState)
start
in class Environment
public void logMessage(java.lang.String message)
public static void main(java.lang.String[] args)