public class MCTS extends Object implements Agent
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ITERATIONS |
static int |
DEFAULT_ROLLOUT_DEPTH |
static int |
DEFAULT_TREE_DEPTH_MUL |
protected org.slf4j.Logger |
logger |
static int |
NO_LIMIT |
protected Random |
random |
protected int |
rolloutDepth |
protected int |
roundLength |
protected int |
treeDepthMul |
Constructor and Description |
---|
MCTS()
Create a default MCTS implementation.
|
MCTS(int roundLength) |
MCTS(int roundLength,
int rolloutDepth,
int treeDepthMul)
Create an MCTS agent which has the parameters.
|
Modifier and Type | Method and Description |
---|---|
static MCTS |
buildMCTSND() |
protected int |
calculateTreeDepthLimit(GameState state) |
Action |
doMove(int agentID,
GameState state)
Standardised interface for game playing agents.
|
protected MCTSNode |
expand(MCTSNode parent,
GameState state) |
protected int |
rollout(GameState state,
int agentID,
MCTSNode current) |
protected MCTSNode |
select(MCTSNode root,
GameState state,
IterationObject iterationObject) |
protected Action |
selectActionForExpand(GameState state,
MCTSNode node,
int agentID)
Select a new action for the expansion node.
|
protected Action |
selectActionForRollout(GameState state,
int playerID) |
String |
toString() |
public static final int DEFAULT_ITERATIONS
public static final int DEFAULT_ROLLOUT_DEPTH
public static final int DEFAULT_TREE_DEPTH_MUL
public static final int NO_LIMIT
protected final int roundLength
protected final int rolloutDepth
protected final int treeDepthMul
protected final Random random
protected final org.slf4j.Logger logger
public MCTS()
This creates an MCTS agent that has a default roll-out length of 50_000 iterations, a depth of 18 and a tree multiplier of 1.
public MCTS(int roundLength)
public MCTS(int roundLength, int rolloutDepth, int treeDepthMul)
roundLength
- rolloutDepth
- treeDepthMul
- public static MCTS buildMCTSND()
public Action doMove(int agentID, GameState state)
Agent
The agent gets a copy of the game state and it's agent ID and should return a move.
protected MCTSNode select(MCTSNode root, GameState state, IterationObject iterationObject)
protected int calculateTreeDepthLimit(GameState state)
protected Action selectActionForExpand(GameState state, MCTSNode node, int agentID)
state
- the game state to travel fromagentID
- the AgentID to use for action selectionnode
- the Node to use for expansionCopyright © 2017 FOSS Galaxy. All rights reserved.