public class SingleTreeNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
SingleTreeNode[] |
children
The array that stores the children nodes.
|
double |
epsilon
Epsilon used for breaking ties
|
double |
K
Constant used in exploration part of UCB formulas
|
int |
nodeDepth
Depth of the node in the tree
|
int |
num_actions
Number of actions in this node.
|
SingleTreeNode |
parent
The parent node (is null for the root node of a tree)
|
Constructor and Description |
---|
SingleTreeNode(int num_actions)
Public constructor for nodes with no declared parent node (eg. for a root node)
|
SingleTreeNode(SingleTreeNode parent,
int depth,
int actionIndex,
double tabooBias,
int num_actions)
Public constructor for nodes with a parent node
|
Modifier and Type | Method and Description |
---|---|
void |
backUp(SingleTreeNode node,
double result)
Backtracks along the visited branch of the tree, to update the stored data, including the expectimax values
|
int |
getActionIndex() |
int |
getNbGenerated() |
int |
getNodeDepth() |
int |
mostVisitedAction()
Finds the action that was selected the most times
|
boolean |
notFullyExpanded()
Checks if the current node is fully expanded, i.e. if all actions have been selected at least once.
|
void |
refreshTree()
Updates nodes attributes in a tree; mostly used to reset number of simulations to 1 to reduce the weight of past
simulations when salvaging a tree branch from one time step to the next
|
SingleTreeNode |
selectChild()
Selects a child node, from the current node.
|
void |
setNodeDepth(int newDepth) |
void |
setTabooBias(double tabooBias) |
public final double K
public SingleTreeNode parent
public final SingleTreeNode[] children
public int nodeDepth
public double epsilon
public int num_actions
public SingleTreeNode(int num_actions)
public SingleTreeNode(SingleTreeNode parent, int depth, int actionIndex, double tabooBias, int num_actions)
parent
- the parent nodedepth
- the tree depth at which the node is addedactionIndex
- the index of the action that was chosen immediately before creating this nodetabooBias
- the location bias of this node, computed based on the avatar locationpublic void setNodeDepth(int newDepth)
public int getNodeDepth()
public int getActionIndex()
public int getNbGenerated()
public void setTabooBias(double tabooBias)
public void refreshTree()
public void backUp(SingleTreeNode node, double result)
node
- the initial node of the backup (usually a tree leaf)result
- the value measured before back tracking (eg. the score when the simulation ended)public SingleTreeNode selectChild()
public int mostVisitedAction()
public boolean notFullyExpanded()