#[non_exhaustive]pub struct FactoringScore {
pub leaves: usize,
pub mobile_leaves: usize,
pub leaf_actions: usize,
pub global_actions: usize,
pub max_leaf_states: usize,
pub total_leaf_states: usize,
}Expand description
How well a factoring decouples a task.
§Examples
use decoupled_search::Factoring;
use sas_plus::{Effect, Fact, Operator, State, Task, Variable};
// A truck (variable 0) and two packages that ride along.
let op = |pre: Vec<Fact>, eff: Fact| Operator {
name: "op".into(),
pre,
eff: vec![Effect::new(eff)],
cost: 1,
};
let task = Task {
variables: vec![Variable::new("truck", 2), Variable::new("p", 3), Variable::new("q", 3)],
operators: vec![
op(vec![Fact::new(0, 0)], Fact::new(0, 1)),
op(vec![Fact::new(0, 0), Fact::new(1, 0)], Fact::new(1, 2)),
op(vec![Fact::new(0, 1), Fact::new(1, 2)], Fact::new(1, 1)),
op(vec![Fact::new(0, 0), Fact::new(2, 0)], Fact::new(2, 2)),
],
initial: State(vec![0, 0, 0]),
goal: vec![Fact::new(1, 1), Fact::new(2, 2)],
axioms: vec![],
};
let score = Factoring::fork(&task).score(&task)?;
assert_eq!((score.leaves, score.mobile_leaves), (2, 2));
assert_eq!((score.leaf_actions, score.global_actions), (3, 1));
assert_eq!(score.leaf_action_share(), 0.75);
assert_eq!((score.max_leaf_states, score.total_leaf_states), (3, 6));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.leaves: usizeNumber of leaves.
mobile_leaves: usizeNumber of mobile leaves: leaves with at least one leaf action, which can move without a global action (Gnad, Poser and Hoffmann 2017: flexibility above 0).
leaf_actions: usizeOperators priced inside a leaf.
global_actions: usizeOperators searched explicitly.
max_leaf_states: usizeStates of the largest leaf; 0 without leaves.
total_leaf_states: usizeStates of all leaves together.
Implementations§
Source§impl FactoringScore
impl FactoringScore
The share of operators that are leaf actions, in 0.0..=1.0; 0 for
a task without operators.
Trait Implementations§
Source§impl Clone for FactoringScore
impl Clone for FactoringScore
impl Copy for FactoringScore
Source§impl Debug for FactoringScore
impl Debug for FactoringScore
Source§impl Default for FactoringScore
impl Default for FactoringScore
impl Eq for FactoringScore
Source§impl PartialEq for FactoringScore
impl PartialEq for FactoringScore
impl StructuralPartialEq for FactoringScore
Auto Trait Implementations§
impl Forget for FactoringScore
impl Freeze for FactoringScore
impl Move for FactoringScore
impl RefUnwindSafe for FactoringScore
impl Send for FactoringScore
impl Sync for FactoringScore
impl Unpin for FactoringScore
impl UnsafeUnpin for FactoringScore
impl UnwindSafe for FactoringScore
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> 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