pub struct Operator<M, Sel, N, E, S, R>where
N: Debug + Clone,
E: Debug + Clone,
S: MapState,
R: Rules,
M: MutationLogic<N, E, S, R>,
Sel: SelectionLogic<N, E, S>,{
pub selection: Sel,
/* private fields */
}Expand description
Mutation と Selection を組み合わせた Operator
SwarmStats を参照して Selection を行う。 統計は ActionEventPublisher 経由で記録されるため、Operator 自身は統計を管理しない。
Fields§
§selection: SelImplementations§
Source§impl<M, Sel, N, E, S, R> Operator<M, Sel, N, E, S, R>where
N: Debug + Clone,
E: Debug + Clone,
S: MapState,
R: Rules,
M: MutationLogic<N, E, S, R>,
Sel: SelectionLogic<N, E, S>,
impl<M, Sel, N, E, S, R> Operator<M, Sel, N, E, S, R>where
N: Debug + Clone,
E: Debug + Clone,
S: MapState,
R: Rules,
M: MutationLogic<N, E, S, R>,
Sel: SelectionLogic<N, E, S>,
Sourcepub fn new(
mutation: M,
selection: Sel,
rules: R,
) -> Operator<M, Sel, N, E, S, R>
pub fn new( mutation: M, selection: Sel, rules: R, ) -> Operator<M, Sel, N, E, S, R>
新しい Operator を作成
Sourcepub fn with_provider(
self,
provider: Arc<dyn LearnedProvider>,
) -> Operator<M, Sel, N, E, S, R>
pub fn with_provider( self, provider: Arc<dyn LearnedProvider>, ) -> Operator<M, Sel, N, E, S, R>
Provider を設定
Sourcepub fn provider(&self) -> &dyn LearnedProvider
pub fn provider(&self) -> &dyn LearnedProvider
Provider への参照
Sourcepub fn set_provider(&mut self, provider: Arc<dyn LearnedProvider>)
pub fn set_provider(&mut self, provider: Arc<dyn LearnedProvider>)
Provider を設定
Sourcepub fn selection_mut(&mut self) -> &mut Sel
pub fn selection_mut(&mut self) -> &mut Sel
Selection への可変参照
Sourcepub fn set_selection(&mut self, selection: Sel)
pub fn set_selection(&mut self, selection: Sel)
Selection を置き換え
Sourcepub fn interpret(
&self,
input: &dyn MutationInput,
map: &GraphMap<N, E, S>,
actions: &ActionsConfig,
stats: &SwarmStats,
) -> Vec<MapUpdate<N, E, S>>
pub fn interpret( &self, input: &dyn MutationInput, map: &GraphMap<N, E, S>, actions: &ActionsConfig, stats: &SwarmStats, ) -> Vec<MapUpdate<N, E, S>>
入力を MapUpdate に変換
Note: 統計は ActionEventPublisher 経由で別途記録されるため、 この関数では統計を更新しない。
Sourcepub fn initialize(
&self,
root_id: MapNodeId,
initial_contexts: &[&str],
) -> Vec<MapUpdate<N, E, S>>
pub fn initialize( &self, root_id: MapNodeId, initial_contexts: &[&str], ) -> Vec<MapUpdate<N, E, S>>
初期ノードを展開
Sourcepub fn next(
&self,
map: &GraphMap<N, E, S>,
stats: &SwarmStats,
) -> Option<MapNodeId>
pub fn next( &self, map: &GraphMap<N, E, S>, stats: &SwarmStats, ) -> Option<MapNodeId>
次のノードを1つ選択
Sourcepub fn select(
&self,
map: &GraphMap<N, E, S>,
count: usize,
stats: &SwarmStats,
) -> Vec<MapNodeId>
pub fn select( &self, map: &GraphMap<N, E, S>, count: usize, stats: &SwarmStats, ) -> Vec<MapNodeId>
次のノードを複数選択
Sourcepub fn score(
&self,
action: &str,
target: Option<&str>,
stats: &SwarmStats,
) -> f64
pub fn score( &self, action: &str, target: Option<&str>, stats: &SwarmStats, ) -> f64
ノードのスコアを計算
Sourcepub fn is_complete(&self, map: &GraphMap<N, E, S>) -> bool
pub fn is_complete(&self, map: &GraphMap<N, E, S>) -> bool
完了判定
デフォルト: フロンティア枯渇で完了
Sourcepub fn create_node_data(&self, input: &dyn MutationInput) -> N
pub fn create_node_data(&self, input: &dyn MutationInput) -> N
ノードデータを生成
Sourcepub fn create_edge_data(&self, input: &dyn MutationInput) -> E
pub fn create_edge_data(&self, input: &dyn MutationInput) -> E
エッジデータを生成
Sourcepub fn initial_state(&self) -> S
pub fn initial_state(&self) -> S
初期状態を生成
Auto Trait Implementations§
impl<M, Sel, N, E, S, R> Freeze for Operator<M, Sel, N, E, S, R>
impl<M, Sel, N, E, S, R> !RefUnwindSafe for Operator<M, Sel, N, E, S, R>
impl<M, Sel, N, E, S, R> Send for Operator<M, Sel, N, E, S, R>
impl<M, Sel, N, E, S, R> Sync for Operator<M, Sel, N, E, S, R>
impl<M, Sel, N, E, S, R> Unpin for Operator<M, Sel, N, E, S, R>
impl<M, Sel, N, E, S, R> !UnwindSafe for Operator<M, Sel, N, E, S, R>
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> 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