Skip to main content

NodeRules

Struct NodeRules 

Source
pub struct NodeRules { /* private fields */ }
Expand description

Exploration 内の純粋な遷移制約

「NodeType A の後に NodeType B が来れる」というルールを保持。 ドメイン知識(Action、Task)は知らない。

§設計意図

  • DependencyGraph 等のドメイン固有グラフから変換して使う
  • Strategy はこれを参照してノード生成を行う
  • アルゴリズム(DFS/BFS/UCB)がドメインに依存しない

Implementations§

Source§

impl NodeRules

Source

pub fn new() -> Self

Source

pub fn add_rule(self, from: &str, to: &str) -> Self

ルール追加: from → to が可能

Source

pub fn add_rules(self, from: &str, tos: &[&str]) -> Self

複数ルール追加: from → [to1, to2, …]

Source

pub fn add_root(self, node_type: &str) -> Self

ルート node_type 追加

Source

pub fn add_roots(self, node_types: &[&str]) -> Self

複数ルート node_type 追加

Source

pub fn add_terminal(self, node_type: &str) -> Self

終端 node_type 追加

Source

pub fn add_terminals(self, node_types: &[&str]) -> Self

複数終端 node_type 追加

Source

pub fn add_param_variants( self, node_type: &str, key: &str, values: &[&str], ) -> Self

パラメータバリアントを追加

指定した node_type の後続ノード展開時に、各バリアントごとにノードを生成する。

§Example
let rules = NodeRules::new()
    .add_rule("Look", "Move")
    .add_param_variants("Move", "target", &["north", "south", "east", "west"]);
Source

pub fn add_rule_with_confidence( self, from: &str, to: &str, confidence: f64, ) -> Self

ルール追加(confidence 付き): from → to が可能

Source

pub fn successors(&self, node_type: &str) -> Vec<&str>

指定 node_type の後に来れる node_type 一覧

Source

pub fn roots(&self) -> Vec<&str>

ルート node_type 一覧

Source

pub fn terminals(&self) -> Vec<&str>

終端 node_type 一覧

Source

pub fn can_transition(&self, from: &str, to: &str) -> bool

遷移が可能か

Source

pub fn has_node_type(&self, node_type: &str) -> bool

node_type が定義されているか

Source

pub fn is_terminal(&self, node_type: &str) -> bool

終端かどうか

Source

pub fn is_root(&self, node_type: &str) -> bool

ルートかどうか

Source

pub fn get_confidence(&self, from: &str, to: &str) -> Option<f64>

エッジの confidence を取得

Source

pub fn confidence_map(&self) -> HashMap<String, f64>

アクション名から confidence map を取得(SelectionLogic 用)

各 (from, to) → to の confidence として集約

Source

pub fn is_empty(&self) -> bool

ルールが空か

Trait Implementations§

Source§

impl Clone for NodeRules

Source§

fn clone(&self) -> NodeRules

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeRules

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NodeRules

Source§

fn default() -> NodeRules

Returns the “default value” for a type. Read more
Source§

impl From<&DependencyGraph> for NodeRules

Source§

fn from(graph: &DependencyGraph) -> Self

Converts to this type from the input type.
Source§

impl From<DependencyGraph> for NodeRules

Source§

fn from(graph: DependencyGraph) -> Self

DependencyGraph(ドメイン固有)から NodeRules(ドメイン非依存)へ変換

  • edges → successors + edge_confidence
  • start_nodes → roots
  • terminal_nodes → terminals
  • param_variants → param_variants
Source§

impl Rules for NodeRules

Source§

fn successors(&self, node_type: &str) -> Vec<&str>

指定 node_type の後に来れる node_type 一覧
Source§

fn roots(&self) -> Vec<&str>

ルート node_type 一覧
Source§

fn is_terminal(&self, node_type: &str) -> bool

終端かどうか
Source§

fn is_empty(&self) -> bool

ルールが空か
Source§

fn param_variants(&self, node_type: &str) -> Option<(&str, &[String])>

指定 node_type のパラメータバリアント(キー, 値リスト) Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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