C++11 Templated MCTS (Monte Carlo Tree Search) library with examples for openFrameworks.
State state; // contains the current state, it must comply with the State interface
Action action; // contains an action that can be applied to a State, and bring it to a new State
UCT<State, Action> uct; // Templated class. Builds a partial decision tree and searches it with UCT MCTS
// OPTIONAL init uct params
uct.uct_k = sqrt(2);
uct.max_millis = 0;
uct.max_iterations = 100;
uct.simulation_depth = 5;
loop {
// run uct mcts on current state and infer optimal action
action = uct.run(state);
// apply the action to the current state
state.apply_action(action);
}
https://github.com/memo/ofxMSAmcts
Acknowledgements
Created during my PhD at Goldsmiths, funded by the EPSRC UK.