Agent

public abstract class Agent implements Serializable

The base type for any agent that can interact with the Sepia environment.

Author:Tim

Fields

OBSERVER_ID

public static final int OBSERVER_ID

configuration

protected Configuration configuration

playernum

protected final int playernum

verbose

protected boolean verbose

visualLog

protected VisualLog visualLog

Constructors

Agent

public Agent(int playernum)

Create a new Agent to control a player.

Parameters:
  • playernum – The player number controlled by this agent.

Methods

clearVisualLog

public void clearVisualLog()

Clear the visual log maintained by this agent. If it is not initialized, this calls initializeVisualAgent.

closeVisualLog

public void closeVisualLog()

If the visual log is initialized, then close the window and release the reference.

getPlayerNumber

public int getPlayerNumber()

Get the player number that this agent controls

getUsage

public static String getUsage()

Return the usage of any additional parameters

initialStep

public abstract Map<Integer, Action> initialStep(State.StateView newstate, History.HistoryView statehistory)

Accept the initial state of an episode

Parameters:
  • newstate – The new state of the system
  • onofflatch – A countdown latch used to synchonize completion

initializeVisualLog

protected void initializeVisualLog()

Initialize the visual log, constructing it.

loadPlayerData

public abstract void loadPlayerData(InputStream is)

Load data stored by the agent.

Parameters:
  • is – An input stream, such as from a file.

See also: {@link.savePlayerData(OutputStream)}

middleStep

public abstract Map<Integer, Action> middleStep(State.StateView newstate, History.HistoryView statehistory)

Accept an intermediate state of an episode

Parameters:
  • newstate – The new state of the system
  • onofflatch – A countdown latch used to synchonize completion

savePlayerData

public abstract void savePlayerData(OutputStream os)

Save data accumulated by the agent.

Parameters:
  • os – An output stream, such as to a file.

See also: {@link.loadPlayerData(InputStream)}

setConfiguration

public void setConfiguration(Configuration configuration)

setVerbose

public void setVerbose(boolean verbosity)

Determines whether to print out the action list each time it is chosen by getAction()

Parameters:
  • verbosity

setVisualLogDimensions

public void setVisualLogDimensions(int width, int height)

Resize the visual log to a new size.

Parameters:
  • width
  • height

terminalStep

public abstract void terminalStep(State.StateView newstate, History.HistoryView statehistory)

Receive notification that the episode has terminated.

Parameters:
  • newstate – The final state of the system

writeLineVisual

public void writeLineVisual(String newline)

Write a line to the visual log maintained by this agent. If it is not initialized, this calls initializeVisualAgent.

Parameters:
  • newline – The line to write