pub struct Solver<A: SolverAdaptor, State: SolverState = Init> { /* private fields */ }
Expand description
An abstract representation of a constraints solver.
Solver provides a common interface for interacting with a constraint solver. It also abstracts over solver-specific datatypes, handling the translation to/from conjure_core::ast types for a model and its solutions.
Details of how a model is solved is specified by the SolverAdaptor. This includes: the underlying solver used, the translation of the model to a solver compatible form, how solutions are translated back to conjure_core::ast types, and how incremental solving is implemented. As such, there may be multiple SolverAdaptor implementations for a single underlying solver: e.g. one adaptor may give solutions in a representation close to the solvers, while another may attempt to rewrite it back into Essence.
Implementations§
Source§impl<Adaptor: SolverAdaptor> Solver<Adaptor>
impl<Adaptor: SolverAdaptor> Solver<Adaptor>
pub fn new(solver_adaptor: Adaptor) -> Solver<Adaptor>
pub fn get_family(&self) -> SolverFamily
Source§impl<A: SolverAdaptor> Solver<A, Init>
impl<A: SolverAdaptor> Solver<A, Init>
pub fn load_model( self, model: Model, ) -> Result<Solver<A, ModelLoaded>, SolverError>
Source§impl<A: SolverAdaptor> Solver<A, ModelLoaded>
impl<A: SolverAdaptor> Solver<A, ModelLoaded>
pub fn solve( self, callback: SolverCallback, ) -> Result<Solver<A, ExecutionSuccess>, SolverError>
pub fn solve_mut( self, callback: SolverMutCallback, ) -> Result<Solver<A, ExecutionSuccess>, SolverError>
Source§impl<A: SolverAdaptor> Solver<A, ExecutionSuccess>
impl<A: SolverAdaptor> Solver<A, ExecutionSuccess>
pub fn stats(&self) -> SolverStats
pub fn save_stats_to_context(&self)
pub fn wall_time_s(&self) -> f64
Trait Implementations§
Auto Trait Implementations§
impl<A, State> Freeze for Solver<A, State>
impl<A, State> RefUnwindSafe for Solver<A, State>where
State: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, State> Send for Solver<A, State>
impl<A, State> Sync for Solver<A, State>
impl<A, State> Unpin for Solver<A, State>
impl<A, State> UnwindSafe for Solver<A, State>where
State: UnwindSafe,
A: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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