[][src]Trait ggpf::policies::mcts::BaseMCTSPolicy

pub trait BaseMCTSPolicy<G: MCTSGame>: Sized {
    type NodeInfo: Debug + Clone + Copy + Send + Sync;
    type MoveInfo: Debug + Clone + Copy + Send + Sync;
    type PlayoutInfo: Send + Sync;
    fn get_value(
        &self,
        board: &G,
        action: &G::Move,
        node_info: &Self::NodeInfo,
        move_info: &Self::MoveInfo,
        exploration: bool
    ) -> f32;
fn default_node(&self, board: &G) -> Self::NodeInfo;
fn default_move(&self, board: &G, action: &G::Move) -> Self::MoveInfo;
fn backpropagate(
        &mut self,
        leaf: MCTSNodeChild<G, Self>,
        history: &[G::Move],
        playout: Self::PlayoutInfo
    );
#[must_use] fn simulate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        board: &'life1 G
    ) -> Pin<Box<dyn Future<Output = Self::PlayoutInfo> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }

Interface used to write a policy as an MCTS policy.

Associated Types

type NodeInfo: Debug + Clone + Copy + Send + Sync

Additional node statistics.

type MoveInfo: Debug + Clone + Copy + Send + Sync

Additional move statistics.

type PlayoutInfo: Send + Sync

Informations generated by a playout.

Loading content...

Required methods

fn get_value(
    &self,
    board: &G,
    action: &G::Move,
    node_info: &Self::NodeInfo,
    move_info: &Self::MoveInfo,
    exploration: bool
) -> f32

Get value associated to a node.

This value should be relative to the current player, it will be maximized by the selection process.

fn default_node(&self, board: &G) -> Self::NodeInfo

Default node statistics for a given state.

fn default_move(&self, board: &G, action: &G::Move) -> Self::MoveInfo

Default move statistics for a given state.

fn backpropagate(
    &mut self,
    leaf: MCTSNodeChild<G, Self>,
    history: &[G::Move],
    playout: Self::PlayoutInfo
)

Backpropagate playout information.

Params

  • leaf: the newly created node by expansion, it can be used to propagate playout information.
  • history: the list of selected moves until leaf.
  • playout: playout information generated by simulate.

#[must_use]fn simulate<'life0, 'life1, 'async_trait>(
    &'life0 self,
    board: &'life1 G
) -> Pin<Box<dyn Future<Output = Self::PlayoutInfo> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Generate playout information starting from board.

Loading content...

Implementors

impl<G> BaseMCTSPolicy<G> for PUCTPolicy_<G> where
    G: Features + MCTSGame, 
[src]

type NodeInfo = PUCTNodeInfo

type MoveInfo = PUCTMoveInfo

type PlayoutInfo = (Option<HashMap<<G as Base>::Move, f32>>, f32, <G as Game>::Player)

impl<G> BaseMCTSPolicy<G> for UCTPolicy_<G> where
    G::Move: Send,
    G: MCTSGame + SingleWinner
[src]

type NodeInfo = UCTNodeInfo

type MoveInfo = UCTMoveInfo

type PlayoutInfo = bool

impl<G: MCTSGame + SingleWinner> BaseMCTSPolicy<G> for RAVEPolicy_<G>[src]

type NodeInfo = RAVENodeInfo

type MoveInfo = RAVEMoveInfo

type PlayoutInfo = (bool, Vec<G::Move>)

Loading content...