Struct Solver

Source
pub struct Solver<P> { /* private fields */ }
Expand description

Hybrid push-pull solver.

Implementations§

Source§

impl<P> Solver<P>

Source

pub fn new(problem_instance: P) -> Self

Create a new Solver instance for a Problem.

Source

pub fn into_problem_instance(self) -> P

Consume self and return the wrapped Problem instance.

Source

pub async fn status(&self) -> Status

Get the current Status of the solver.

Source

pub async fn enqueue_fragment(&self, id: FragmentId) -> &Self

Enqueue a fragment to be solved.

Only fragments enqueued through this method and their transitive dependencies will be considered for evaluation.

Source

pub async fn punted_iter(&self) -> Vec<FragmentId>

Get an interator to all fragments that are currently punted. Interpretation of punted fragments depends on the current status:

Source§

impl<P> Solver<P>
where P: Problem,

Source

pub async fn assume_evaluated(&self, id: FragmentId) -> &Self

Assume the given fragment is already evaluated.

Source

pub async fn run( &self, concurrency: NonZeroUsize, ) -> Result<Vec<FragmentId>, P::Error>

Run the solver until all enqueued fragments and their transitive dependencies are either solved or proven to be part of at least one cycle. See the module docs for the limitations when concurrency > 1.

Returns an interator with all fragments that are part of at least one cycle, if any. See Solver::punted_iter.

Returns an error if any evaluation returns an error.

§Known Issues
Source

pub async fn step(&self) -> Result<bool, P::Error>

Run a single solver step for a single fragment.

Returns false if there are no more fragments that can be evaluated.

Returns an error if Problem::evaluate was called and evaluation returned an error.

§Known Issues
  • If Solver::step is not run to completion the Solver may be left in an inconsistent state.

Auto Trait Implementations§

§

impl<P> !Freeze for Solver<P>

§

impl<P> !RefUnwindSafe for Solver<P>

§

impl<P> Send for Solver<P>
where P: Send,

§

impl<P> Sync for Solver<P>
where P: Sync,

§

impl<P> Unpin for Solver<P>
where P: Unpin,

§

impl<P> UnwindSafe for Solver<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.