Skip to main content

Operator

Struct Operator 

Source
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: Sel

Implementations§

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>,

Source

pub fn new( mutation: M, selection: Sel, rules: R, ) -> Operator<M, Sel, N, E, S, R>

新しい Operator を作成

Source

pub fn with_provider( self, provider: Arc<dyn LearnedProvider>, ) -> Operator<M, Sel, N, E, S, R>

Provider を設定

Source

pub fn provider(&self) -> &dyn LearnedProvider

Provider への参照

Source

pub fn set_provider(&mut self, provider: Arc<dyn LearnedProvider>)

Provider を設定

Source

pub fn rules(&self) -> &R

Rules への参照

Source

pub fn selection(&self) -> &Sel

Selection への参照

Source

pub fn selection_mut(&mut self) -> &mut Sel

Selection への可変参照

Source

pub fn set_selection(&mut self, selection: Sel)

Selection を置き換え

Source

pub fn interpret( &self, input: &dyn MutationInput, map: &GraphMap<N, E, S>, actions: &ActionsConfig, stats: &SwarmStats, ) -> Vec<MapUpdate<N, E, S>>

入力を MapUpdate に変換

Note: 統計は ActionEventPublisher 経由で別途記録されるため、 この関数では統計を更新しない。

Source

pub fn initialize( &self, root_id: MapNodeId, initial_contexts: &[&str], ) -> Vec<MapUpdate<N, E, S>>

初期ノードを展開

Source

pub fn next( &self, map: &GraphMap<N, E, S>, stats: &SwarmStats, ) -> Option<MapNodeId>

次のノードを1つ選択

Source

pub fn select( &self, map: &GraphMap<N, E, S>, count: usize, stats: &SwarmStats, ) -> Vec<MapNodeId>

次のノードを複数選択

Source

pub fn score( &self, action: &str, target: Option<&str>, stats: &SwarmStats, ) -> f64

ノードのスコアを計算

Source

pub fn is_complete(&self, map: &GraphMap<N, E, S>) -> bool

完了判定

デフォルト: フロンティア枯渇で完了

Source

pub fn create_node_data(&self, input: &dyn MutationInput) -> N

ノードデータを生成

Source

pub fn create_edge_data(&self, input: &dyn MutationInput) -> E

エッジデータを生成

Source

pub fn initial_state(&self) -> S

初期状態を生成

Source

pub fn name(&self) -> String

Operator 名

Auto Trait Implementations§

§

impl<M, Sel, N, E, S, R> Freeze for Operator<M, Sel, N, E, S, R>
where M: Freeze, Sel: Freeze, R: Freeze,

§

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>
where N: Send, E: Send, S: Send,

§

impl<M, Sel, N, E, S, R> Sync for Operator<M, Sel, N, E, S, R>
where N: Sync, E: Sync, S: Sync,

§

impl<M, Sel, N, E, S, R> Unpin for Operator<M, Sel, N, E, S, R>
where M: Unpin, Sel: Unpin, R: Unpin, N: Unpin, E: Unpin, S: Unpin,

§

impl<M, Sel, N, E, S, R> !UnwindSafe for Operator<M, Sel, N, E, S, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more