Class AbstractMCTS
- java.lang.Object
-
- ai.nettogrof.battlesnake.treesearch.AbstractSearch
-
- ai.nettogrof.battlesnake.treesearch.AbstractBestFirstSearch
-
- ai.nettogrof.battlesnake.treesearch.AbstractMCTS
-
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
AbstractRoyaleSearch,AbstractSquadSearch,AbstractStandardSearch,ConstrictorSearch
public abstract class AbstractMCTS extends AbstractBestFirstSearch
This abstract MCTS search, provide basic method use in any search using MCTS type of search- Version:
- Spring 2021
- Author:
- carl.lajeunesse
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMCTS()Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecuteMCTS()Execute the MCTS searchprivate voidfillMCTSList(gnu.trove.list.array.TFloatArrayList upward, gnu.trove.list.array.TFloatArrayList down, gnu.trove.list.array.TFloatArrayList left, gnu.trove.list.array.TFloatArrayList right, AbstractNode node)This method fill 4 list (one for each direction ) with the score of each node based on the move directionprotected List<AbstractNode>getMCTSBestPath(AbstractNode node)This method is use to find the next leaf node to explore using MCTS algoprivate floatmctsScore(AbstractNode parentNode, AbstractNode childNode)Calculation of the Upper Confident Bound score.-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.AbstractBestFirstSearch
getBestChild, getbestChildValue, getBestPath, mergeList, updateFullListNode, updateListNode
-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.AbstractSearch
addMove, checkHeadToHead, createSnakeInfo, freeSpace, generateChild, generateChild, generateSnakeInfoDestination, getSmallestChild, kill, merge, moveSnake, stopSearching
-
-
-
-
Method Detail
-
getMCTSBestPath
protected List<AbstractNode> getMCTSBestPath(AbstractNode node)
This method is use to find the next leaf node to explore using MCTS algo- Parameters:
node- The root node- Returns:
- List of node from the leaf to the root
-
mctsScore
private float mctsScore(AbstractNode parentNode, AbstractNode childNode)
Calculation of the Upper Confident Bound score.- Parameters:
parentNode- the parent nodechildNode- the child node which is the score is calculated- Returns:
- float of the score.
-
fillMCTSList
private void fillMCTSList(gnu.trove.list.array.TFloatArrayList upward, gnu.trove.list.array.TFloatArrayList down, gnu.trove.list.array.TFloatArrayList left, gnu.trove.list.array.TFloatArrayList right, AbstractNode node)This method fill 4 list (one for each direction ) with the score of each node based on the move direction- Parameters:
upward- float array listdown- float array listleft- float array listright- float array listnode- parent node
-
executeMCTS
protected void executeMCTS()
Execute the MCTS search
-
-