pub struct Solver<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_cp_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_cp_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 Solver
impl Solver
pub fn new<A: SolverAdaptor>(solver_adaptor: A) -> Solver
pub fn get_family(&self) -> SolverFamily
pub fn get_name(&self) -> &'static str
Source§impl Solver<Init>
impl Solver<Init>
pub fn load_model( self, model: Model, ) -> Result<Solver<ModelLoaded>, SolverError>
Source§impl Solver<ModelLoaded>
impl Solver<ModelLoaded>
pub fn solve( self, callback: SolverCallback, ) -> Result<Solver<ExecutionSuccess>, SolverError>
pub fn solve_mut( self, callback: SolverMutCallback, ) -> Result<Solver<ExecutionSuccess>, SolverError>
Sourcepub fn write_solver_input_file(
&self,
writer: &mut Box<dyn Write>,
) -> Result<(), Error>
pub fn write_solver_input_file( &self, writer: &mut Box<dyn Write>, ) -> Result<(), Error>
Writes a solver input file to the given writer.
This method is for debugging use only, and there are no plans to make the solutions obtained by running this file through the solver translatable back into high-level Essence.
This file is runnable using the solvers command line interface. E.g. for Minion, this outputs a valid .minion file.
This function is only available in the ModelLoaded state as solvers are allowed to edit
the model in place.
Source§impl Solver<ExecutionSuccess>
impl Solver<ExecutionSuccess>
pub fn stats(&self) -> SolverStats
pub fn save_stats_to_context(&self)
pub fn wall_time_s(&self) -> f64
Auto Trait Implementations§
impl<State> Freeze for Solver<State>where
State: Freeze,
impl<State = Init> !RefUnwindSafe for Solver<State>
impl<State = Init> !Send for Solver<State>
impl<State = Init> !Sync for Solver<State>
impl<State> Unpin for Solver<State>where
State: Unpin,
impl<State = Init> !UnwindSafe for Solver<State>
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
§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§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.