pub struct ReasoningSystem {
pub board: HypothesisBoard,
pub graph: BeliefGraph,
}Expand description
Combined reasoning system with hypotheses and belief dependencies
Fields§
§board: HypothesisBoard§graph: BeliefGraphImplementations§
Source§impl ReasoningSystem
impl ReasoningSystem
pub fn new(board: HypothesisBoard) -> Self
pub fn in_memory() -> Self
Sourcepub async fn add_dependency(
&mut self,
hypothesis_id: HypothesisId,
depends_on: HypothesisId,
) -> Result<()>
pub async fn add_dependency( &mut self, hypothesis_id: HypothesisId, depends_on: HypothesisId, ) -> Result<()>
Create a dependency edge between hypotheses
Sourcepub fn remove_dependency(
&mut self,
hypothesis_id: HypothesisId,
depends_on: HypothesisId,
) -> Result<bool>
pub fn remove_dependency( &mut self, hypothesis_id: HypothesisId, depends_on: HypothesisId, ) -> Result<bool>
Remove a dependency edge
Sourcepub fn dependents(
&self,
hypothesis_id: HypothesisId,
) -> Result<IndexSet<HypothesisId>>
pub fn dependents( &self, hypothesis_id: HypothesisId, ) -> Result<IndexSet<HypothesisId>>
Get dependents (what depends on this hypothesis)
Sourcepub fn dependees(
&self,
hypothesis_id: HypothesisId,
) -> Result<IndexSet<HypothesisId>>
pub fn dependees( &self, hypothesis_id: HypothesisId, ) -> Result<IndexSet<HypothesisId>>
Get dependees (what this hypothesis depends on)
Sourcepub fn dependency_chain(
&self,
hypothesis_id: HypothesisId,
) -> Result<IndexSet<HypothesisId>>
pub fn dependency_chain( &self, hypothesis_id: HypothesisId, ) -> Result<IndexSet<HypothesisId>>
Get full dependency chain
Sourcepub fn detect_cycles(&self) -> Vec<Vec<HypothesisId>>
pub fn detect_cycles(&self) -> Vec<Vec<HypothesisId>>
Detect cycles in the belief graph
Sourcepub async fn remove_hypothesis(&mut self, id: HypothesisId) -> Result<bool>
pub async fn remove_hypothesis(&mut self, id: HypothesisId) -> Result<bool>
Remove a hypothesis and its graph node
Auto Trait Implementations§
impl Freeze for ReasoningSystem
impl !RefUnwindSafe for ReasoningSystem
impl Send for ReasoningSystem
impl Sync for ReasoningSystem
impl Unpin for ReasoningSystem
impl UnsafeUnpin for ReasoningSystem
impl !UnwindSafe for ReasoningSystem
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> 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