pacworld
Class PackageWorld

java.lang.Object
  extended by agent.Environment
      extended by pacworld.PackageWorld

public class PackageWorld
extends Environment

A simulator for the package delivery world environment.


Field Summary
static java.io.PrintStream actLog
           
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.
static int MAX_NUM_DESTINATIONS
           
 PacGUI pg
          The GUI that displays the current world
 
Constructor Summary
PackageWorld()
           
PackageWorld(java.io.PrintStream actLog)
           
 
Method Summary
 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.
 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.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUM_AGENTS

public static int DEFAULT_NUM_AGENTS

DEFAULT_WORLD_SIZE

public static int DEFAULT_WORLD_SIZE
The length (and width) of the world. The world must be a square.


DEFAULT_NUM_PACKAGES

public static int DEFAULT_NUM_PACKAGES
Number of packages.


DEFAULT_NUM_DESTINATIONS

public static int DEFAULT_NUM_DESTINATIONS
Number of destinations.


MAX_NUM_DESTINATIONS

public static int MAX_NUM_DESTINATIONS

actLog

public static java.io.PrintStream actLog

pg

public PacGUI pg
The GUI that displays the current world

Constructor Detail

PackageWorld

public PackageWorld()

PackageWorld

public PackageWorld(java.io.PrintStream actLog)
Method Detail

addAgent

public void addAgent(Agent agent)
Add a new agent to the environment. Note, the agents List is actually an ArrayList of PacAgentReps.

Specified by:
addAgent in class Environment

getAgents

public java.util.List<Agent> getAgents()
Returns a list of the agents in the environment.


resetAgents

public void resetAgents()
Clears all agents from the environment.


getScoreMsg

public java.lang.String getScoreMsg()
Returns a string containing score information for the agent team.


getPerformanceMeasure

public int getPerformanceMeasure(Agent a)
Return the performance measure of the agent in the current environment. Since this is a team environment, we only return the team's performance measure, regardless of the agent.

Specified by:
getPerformanceMeasure in class Environment

getTeamPerformanceMeasure

public int getTeamPerformanceMeasure()
Return the performance measure of a team of agents in a cooperative environment. Higher values are considered better.

Specified by:
getTeamPerformanceMeasure in class Environment

getWorldSize

public int getWorldSize()
Return the size of the grid for the environment.


getNumAgents

public int getNumAgents()
Return the number of agents in the environment.


setGUI

public void setGUI(PacGUI gui)
Associate a GUI with the environment.


start

public void start(State initState)
Run the simulation starting from a given state. This consists of a sense-act loop for each agent.

Overrides:
start in class Environment

logMessage

public void logMessage(java.lang.String message)
Outputs a message to the log and the GUI.


main

public static void main(java.lang.String[] args)
Starts the program.