STATE
- Type which is used for states in the game.ACTION
- Type which is used for actions in the game.PLAYER
- Type which is used for players in the game.public class IterativeDeepeningAlphaBetaSearch<STATE,ACTION,PLAYER> extends java.lang.Object implements AdversarialSearch<STATE,ACTION>
Modifier and Type | Field and Description |
---|---|
protected int |
currDepthLimit |
protected Game<STATE,ACTION,PLAYER> |
game |
static java.lang.String |
METRICS_MAX_DEPTH |
static java.lang.String |
METRICS_NODES_EXPANDED |
protected double |
utilMax |
protected double |
utilMin |
Constructor and Description |
---|
IterativeDeepeningAlphaBetaSearch(Game<STATE,ACTION,PLAYER> game,
double utilMin,
double utilMax,
int time)
Creates a new search object for a given game.
|
Modifier and Type | Method and Description |
---|---|
static <STATE,ACTION,PLAYER> |
createFor(Game<STATE,ACTION,PLAYER> game,
double utilMin,
double utilMax,
int time)
Creates a new search object for a given game.
|
protected double |
eval(STATE state,
PLAYER player)
Primitive operation, which estimates the value for (not necessarily
terminal) states.
|
Metrics |
getMetrics()
Returns some statistic data from the last search.
|
protected boolean |
hasSafeWinner(double resultUtility)
Primitive operation which is used to stop iterative deepening search in
situations where a safe winner has been identified.
|
protected void |
incrementDepthLimit()
Primitive operation which is called at the beginning of one depth limited
search step.
|
protected boolean |
isSignificantlyBetter(double newUtility,
double utility)
Primitive operation which is used to stop iterative deepening search in
situations where a clear best action exists.
|
ACTION |
makeDecision(STATE state)
Template method controlling the search.
|
double |
maxValue(STATE state,
PLAYER player,
double alpha,
double beta,
int depth) |
double |
minValue(STATE state,
PLAYER player,
double alpha,
double beta,
int depth) |
java.util.List<ACTION> |
orderActions(STATE state,
java.util.List<ACTION> actions,
PLAYER player,
int depth)
Primitive operation for action ordering.
|
void |
setLogEnabled(boolean b) |
public static final java.lang.String METRICS_NODES_EXPANDED
public static final java.lang.String METRICS_MAX_DEPTH
protected double utilMax
protected double utilMin
protected int currDepthLimit
public IterativeDeepeningAlphaBetaSearch(Game<STATE,ACTION,PLAYER> game, double utilMin, double utilMax, int time)
game
- The game.utilMin
- Utility value of worst state for this player. Supports
evaluation of non-terminal states and early termination in
situations with a safe winner.utilMax
- Utility value of best state for this player. Supports
evaluation of non-terminal states and early termination in
situations with a safe winner.time
- Maximal computation time in seconds.public static <STATE,ACTION,PLAYER> IterativeDeepeningAlphaBetaSearch<STATE,ACTION,PLAYER> createFor(Game<STATE,ACTION,PLAYER> game, double utilMin, double utilMax, int time)
game
- The game.utilMin
- Utility value of worst state for this player. Supports
evaluation of non-terminal states and early termination in
situations with a safe winner.utilMax
- Utility value of best state for this player. Supports
evaluation of non-terminal states and early termination in
situations with a safe winner.time
- Maximal computation time in seconds.public void setLogEnabled(boolean b)
public ACTION makeDecision(STATE state)
makeDecision
in interface AdversarialSearch<STATE,ACTION>
public Metrics getMetrics()
getMetrics
in interface AdversarialSearch<STATE,ACTION>
protected void incrementDepthLimit()
protected boolean isSignificantlyBetter(double newUtility, double utility)
protected boolean hasSafeWinner(double resultUtility)
protected double eval(STATE state, PLAYER player)
(utilMin + utilMax) / 2
for non-terminal
states. When overriding, first call the super implementation!