pub struct HypothesisSuperposition {
pub hypotheses: Vec<Hypothesis>,
}Expand description
Multiple competing hypotheses in superposition.
Each hypothesis carries an amplitude; the Born rule gives probabilities. Evidence observations boost supporting hypotheses and dampen others.
Fields§
§hypotheses: Vec<Hypothesis>Implementations§
Source§impl HypothesisSuperposition
impl HypothesisSuperposition
pub fn new() -> Self
Sourcepub fn add_hypothesis(
&mut self,
id: &str,
description: &str,
edges: Vec<(u64, u64)>,
)
pub fn add_hypothesis( &mut self, id: &str, description: &str, edges: Vec<(u64, u64)>, )
Add a hypothesis. Amplitudes are redistributed uniformly.
Sourcepub fn probabilities(&self) -> Vec<(String, f64)>
pub fn probabilities(&self) -> Vec<(String, f64)>
Born rule: probability of each hypothesis.
Sourcepub fn observe(&mut self, evidence_edge: (u64, u64))
pub fn observe(&mut self, evidence_edge: (u64, u64))
Update amplitudes based on evidence.
Evidence that supports a hypothesis boosts its amplitude; unsupported hypotheses are dampened.
Sourcepub fn collapse(&self) -> &Hypothesis
pub fn collapse(&self) -> &Hypothesis
Collapse to the most probable hypothesis.
Trait Implementations§
Source§impl Clone for HypothesisSuperposition
impl Clone for HypothesisSuperposition
Source§impl Debug for HypothesisSuperposition
impl Debug for HypothesisSuperposition
Source§impl Default for HypothesisSuperposition
impl Default for HypothesisSuperposition
Source§impl<'de> Deserialize<'de> for HypothesisSuperposition
impl<'de> Deserialize<'de> for HypothesisSuperposition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HypothesisSuperposition
impl RefUnwindSafe for HypothesisSuperposition
impl Send for HypothesisSuperposition
impl Sync for HypothesisSuperposition
impl Unpin for HypothesisSuperposition
impl UnsafeUnpin for HypothesisSuperposition
impl UnwindSafe for HypothesisSuperposition
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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