pub struct SearchTree<P, G, E, A>{ /* private fields */ }
Expand description
SearchTree
is the main struct to use for Monte Carlo Tree Search.
Pass a GameState
wrapped in a RC
to SearchTree::new
to create a new search tree.
Then you can call SearchTree::search
to get the best action and SearchTree::renew
to move to the next state.
Implementations§
Source§impl<P, G, E, A> SearchTree<P, G, E, A>
impl<P, G, E, A> SearchTree<P, G, E, A>
Sourcepub fn with_tree_policy(
self,
tree_policy: impl Fn(f32, f32, f32) -> f32 + 'static,
) -> Self
pub fn with_tree_policy( self, tree_policy: impl Fn(f32, f32, f32) -> f32 + 'static, ) -> Self
Set the tree policy function. By default, it is UCT tree policy.
Sourcepub fn renew(&mut self, action: &A) -> Result<(), String>
pub fn renew(&mut self, action: &A) -> Result<(), String>
Move to the next state and renew the root node with given action.
Sourcepub fn get_game_state(&self) -> Rc<G>
pub fn get_game_state(&self) -> Rc<G>
Get the current game state.
Auto Trait Implementations§
impl<P, G, E, A> Freeze for SearchTree<P, G, E, A>
impl<P, G, E, A> !RefUnwindSafe for SearchTree<P, G, E, A>
impl<P, G, E, A> !Send for SearchTree<P, G, E, A>
impl<P, G, E, A> !Sync for SearchTree<P, G, E, A>
impl<P, G, E, A> Unpin for SearchTree<P, G, E, A>
impl<P, G, E, A> !UnwindSafe for SearchTree<P, G, E, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more