pub struct NodeRules { /* private fields */ }Expand description
Exploration 内の純粋な遷移制約
「NodeType A の後に NodeType B が来れる」というルールを保持。 ドメイン知識(Action、Task)は知らない。
§設計意図
DependencyGraph等のドメイン固有グラフから変換して使う- Strategy はこれを参照してノード生成を行う
- アルゴリズム(DFS/BFS/UCB)がドメインに依存しない
Implementations§
Source§impl NodeRules
impl NodeRules
pub fn new() -> Self
Sourcepub fn add_terminal(self, node_type: &str) -> Self
pub fn add_terminal(self, node_type: &str) -> Self
終端 node_type 追加
Sourcepub fn add_terminals(self, node_types: &[&str]) -> Self
pub fn add_terminals(self, node_types: &[&str]) -> Self
複数終端 node_type 追加
Sourcepub fn add_param_variants(
self,
node_type: &str,
key: &str,
values: &[&str],
) -> Self
pub fn add_param_variants( self, node_type: &str, key: &str, values: &[&str], ) -> Self
Sourcepub fn add_rule_with_confidence(
self,
from: &str,
to: &str,
confidence: f64,
) -> Self
pub fn add_rule_with_confidence( self, from: &str, to: &str, confidence: f64, ) -> Self
ルール追加(confidence 付き): from → to が可能
Sourcepub fn successors(&self, node_type: &str) -> Vec<&str>
pub fn successors(&self, node_type: &str) -> Vec<&str>
指定 node_type の後に来れる node_type 一覧
Sourcepub fn can_transition(&self, from: &str, to: &str) -> bool
pub fn can_transition(&self, from: &str, to: &str) -> bool
遷移が可能か
Sourcepub fn has_node_type(&self, node_type: &str) -> bool
pub fn has_node_type(&self, node_type: &str) -> bool
node_type が定義されているか
Sourcepub fn is_terminal(&self, node_type: &str) -> bool
pub fn is_terminal(&self, node_type: &str) -> bool
終端かどうか
Sourcepub fn confidence_map(&self) -> HashMap<String, f64>
pub fn confidence_map(&self) -> HashMap<String, f64>
アクション名から confidence map を取得(SelectionLogic 用)
各 (from, to) → to の confidence として集約
Trait Implementations§
Source§impl From<&DependencyGraph> for NodeRules
impl From<&DependencyGraph> for NodeRules
Source§fn from(graph: &DependencyGraph) -> Self
fn from(graph: &DependencyGraph) -> Self
Converts to this type from the input type.
Source§impl From<DependencyGraph> for NodeRules
impl From<DependencyGraph> for NodeRules
Source§fn from(graph: DependencyGraph) -> Self
fn from(graph: DependencyGraph) -> Self
DependencyGraph(ドメイン固有)から NodeRules(ドメイン非依存)へ変換
- edges → successors + edge_confidence
- start_nodes → roots
- terminal_nodes → terminals
- param_variants → param_variants
Auto Trait Implementations§
impl Freeze for NodeRules
impl RefUnwindSafe for NodeRules
impl Send for NodeRules
impl Sync for NodeRules
impl Unpin for NodeRules
impl UnwindSafe for NodeRules
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