pub struct Ucb1 { /* private fields */ }Expand description
UCB1 選択
score = success_rate + c * sqrt(ln(total_visits) / visits) + learned_bonus
- 成功率が高いノードを優先(活用)
- 訪問回数が少ないノードにボーナス(探索)
- Provider から学習済みボーナスを加算
Implementations§
Source§impl Ucb1
impl Ucb1
Sourcepub fn with_weights(c: f64, learning_weight: f64) -> Self
pub fn with_weights(c: f64, learning_weight: f64) -> Self
探索係数と学習ボーナス係数を指定して生成
Sourcepub fn with_default_c() -> Self
pub fn with_default_c() -> Self
デフォルトの探索係数(√2)で生成
Sourcepub fn learning_weight(&self) -> f64
pub fn learning_weight(&self) -> f64
学習ボーナス係数を取得
Sourcepub fn compute_score(
&self,
stats: &SwarmStats,
action: &str,
target: Option<&str>,
provider: &dyn LearnedProvider,
) -> f64
pub fn compute_score( &self, stats: &SwarmStats, action: &str, target: Option<&str>, provider: &dyn LearnedProvider, ) -> f64
UCB1 スコアを計算(コンテキストなし、後方互換用)
Sourcepub fn compute_score_with_context(
&self,
stats: &SwarmStats,
action: &str,
target: Option<&str>,
provider: &dyn LearnedProvider,
prev_action: Option<&str>,
prev_prev_action: Option<&str>,
) -> f64
pub fn compute_score_with_context( &self, stats: &SwarmStats, action: &str, target: Option<&str>, provider: &dyn LearnedProvider, prev_action: Option<&str>, prev_prev_action: Option<&str>, ) -> f64
UCB1 スコアを計算(コンテキスト付き)
Provider に confidence_with_context クエリを投げて学習ボーナスを取得。
Trait Implementations§
Source§impl<N, E, S> SelectionLogic<N, E, S> for Ucb1
impl<N, E, S> SelectionLogic<N, E, S> for Ucb1
Source§fn next(
&self,
map: &GraphMap<N, E, S>,
stats: &SwarmStats,
provider: &dyn LearnedProvider,
) -> Option<MapNodeId>
fn next( &self, map: &GraphMap<N, E, S>, stats: &SwarmStats, provider: &dyn LearnedProvider, ) -> Option<MapNodeId>
次のノードを1つ選択
Source§fn select(
&self,
map: &GraphMap<N, E, S>,
count: usize,
stats: &SwarmStats,
provider: &dyn LearnedProvider,
) -> Vec<MapNodeId>
fn select( &self, map: &GraphMap<N, E, S>, count: usize, stats: &SwarmStats, provider: &dyn LearnedProvider, ) -> Vec<MapNodeId>
次のノードを複数選択
Source§fn score(
&self,
action: &str,
target: Option<&str>,
stats: &SwarmStats,
provider: &dyn LearnedProvider,
) -> f64
fn score( &self, action: &str, target: Option<&str>, stats: &SwarmStats, provider: &dyn LearnedProvider, ) -> f64
ノードのスコアを計算
Auto Trait Implementations§
impl Freeze for Ucb1
impl RefUnwindSafe for Ucb1
impl Send for Ucb1
impl Sync for Ucb1
impl Unpin for Ucb1
impl UnwindSafe for Ucb1
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more