pub struct Edges<D: Domain> { /* private fields */ }
Expand description
The outgoing edges from a node, possibly partially expanded.
Implementations§
Source§impl<D: Domain> Edges<D>
impl<D: Domain> Edges<D>
Sourcepub fn new(
node: &Node<D>,
initial_state: &D::State,
next_task: Option<Box<dyn Task<D>>>,
) -> Self
pub fn new( node: &Node<D>, initial_state: &D::State, next_task: Option<Box<dyn Task<D>>>, ) -> Self
Creates new edges, with optionally a forced task that will be the sole edge.
Sourcepub fn child_visits(&self) -> usize
pub fn child_visits(&self) -> usize
Returns the sum of all visits to the edges of this nodes.
Sourcepub fn best_task(
&self,
agent: AgentId,
exploration: f32,
range: Range<AgentValue>,
) -> Option<Box<dyn Task<D>>>
pub fn best_task( &self, agent: AgentId, exploration: f32, range: Range<AgentValue>, ) -> Option<Box<dyn Task<D>>>
Finds the best task with the given exploration
factor and normalization range
.
Sourcepub fn q_value(&self, fallback: (usize, f32), agent: AgentId) -> Option<f32>
pub fn q_value(&self, fallback: (usize, f32), agent: AgentId) -> Option<f32>
Returns the weighted average q value of all child edges.
The fallback
value is used for self-referential edges.
Sourcepub fn expanded_count(&self) -> usize
pub fn expanded_count(&self) -> usize
Returns the number of already-expanded edges.
Sourcepub fn unexpanded_count(&self) -> usize
pub fn unexpanded_count(&self) -> usize
Returns the number of not-yet-expanded edges.
Sourcepub fn branching_factor(&self) -> usize
pub fn branching_factor(&self) -> usize
Returns how many edges there are, the sum of the expanded and not-yet expanded counts.
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for Edges<D>
impl<D> !RefUnwindSafe for Edges<D>
impl<D> Send for Edges<D>
impl<D> Sync for Edges<D>
impl<D> Unpin for Edges<D>
impl<D> !UnwindSafe for Edges<D>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.