public class GridWorldTerminalFunction extends java.lang.Object implements TerminalFunction
The set of terminal positions is defined either in the constructor or with subsequent calls to the markAsTerminalPosition(int, int)
method. Terminal positions may also be removed with the unmarkTerminalPosition(int, int)
and unmarkAllTerminalPositions()
methods.
Modifier and Type | Class and Description |
---|---|
class |
GridWorldTerminalFunction.IntPair
A pair class for two ints.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<GridWorldTerminalFunction.IntPair> |
terminalPositions
The set of positions marked as terminal positions.
|
Constructor and Description |
---|
GridWorldTerminalFunction()
Initializes without any terminal positions specified.
|
GridWorldTerminalFunction(GridWorldTerminalFunction.IntPair... terminalPositions)
Initializes with a list of terminal positions specified by a sequence of
GridWorldTerminalFunction.IntPair objects. |
GridWorldTerminalFunction(int x,
int y)
Initializes with a terminal position at the specified agent x and y locaiton.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isTerminal(State s) |
boolean |
isTerminalPosition(int x,
int y)
Returns true if a position is marked as a terminal position; false otherwise.
|
void |
markAsTerminalPosition(int x,
int y)
Marks a position as a terminal position for the agent.
|
void |
unmarkAllTerminalPositions()
Unmarks all agent positions as terminal positions.
|
void |
unmarkTerminalPosition(int x,
int y)
Unmarks an agent position as a terminal position.
|
protected java.util.Set<GridWorldTerminalFunction.IntPair> terminalPositions
public GridWorldTerminalFunction()
public GridWorldTerminalFunction(int x, int y)
x
- the x location of the agenty
- the y location of the agentpublic GridWorldTerminalFunction(GridWorldTerminalFunction.IntPair... terminalPositions)
GridWorldTerminalFunction.IntPair
objects.terminalPositions
- the agent positions that are terminal states, specified with GridWorldTerminalFunction.IntPair
objects.public void markAsTerminalPosition(int x, int y)
x
- the x location of the agent.y
- the y location of the agent.public void unmarkTerminalPosition(int x, int y)
x
- the x location of the agent.y
- the y location of the agent.public void unmarkAllTerminalPositions()
public boolean isTerminalPosition(int x, int y)
x
- the x location of the agent.y
- the y location of the agent.public boolean isTerminal(State s)
isTerminal
in interface TerminalFunction