pub struct Solver<P> { /* private fields */ }
Expand description
Hybrid push-pull solver.
Implementations§
Source§impl<P> Solver<P>
impl<P> Solver<P>
Sourcepub fn into_problem_instance(self) -> P
pub fn into_problem_instance(self) -> P
Consume self
and return the wrapped Problem
instance.
Sourcepub async fn enqueue_fragment(&self, id: FragmentId) -> &Self
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.
Sourcepub async fn punted_iter(&self) -> Vec<FragmentId>
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:
Status::Pending
: fragments are pending on dependencies.Status::DoneWithCycles
: fragments are part of one or more cycles.Status::Done
: the returned iterator will be empty.
Source§impl<P> Solver<P>where
P: Problem,
impl<P> Solver<P>where
P: Problem,
Sourcepub async fn assume_evaluated(&self, id: FragmentId) -> &Self
pub async fn assume_evaluated(&self, id: FragmentId) -> &Self
Assume the given fragment is already evaluated.
Sourcepub async fn run(
&self,
concurrency: NonZeroUsize,
) -> Result<Vec<FragmentId>, P::Error>
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
- If
Solver::enqueue_fragment
is called whileSolver::run
is executing, those new fragments may not be solved. - If
Solver::run
returns with an error, theSolver
may be left in an inconsistent state.
Sourcepub async fn step(&self) -> Result<bool, P::Error>
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 theSolver
may be left in an inconsistent state.