pub struct BasicSpec<S> {
pub get_variable: fn(&S, usize) -> Option<usize>,
pub set_variable: fn(&mut S, usize, Option<usize>),
pub value_count: fn(&S) -> usize,
pub entity_count_fn: fn(&S) -> usize,
pub variable_field: &'static str,
pub descriptor_index: usize,
}Expand description
Problem specification for basic variable problems.
Passed to run_solver to provide problem-specific construction and local
search phases for solutions using #[basic_variable_config].
Fields§
§get_variable: fn(&S, usize) -> Option<usize>§set_variable: fn(&mut S, usize, Option<usize>)§value_count: fn(&S) -> usize§entity_count_fn: fn(&S) -> usize§variable_field: &'static str§descriptor_index: usizeTrait Implementations§
Source§impl<S, C> ProblemSpec<S, C> for BasicSpec<S>
impl<S, C> ProblemSpec<S, C> for BasicSpec<S>
Source§fn is_trivial(&self, solution: &S) -> bool
fn is_trivial(&self, solution: &S) -> bool
Returns
true if the problem is trivially empty and solving can be skipped.Source§fn default_time_limit_secs(&self) -> u64
fn default_time_limit_secs(&self) -> u64
Default solver time limit in seconds (used when config has no termination).
Source§fn build_and_solve(
self,
director: ScoreDirector<S, C>,
config: &SolverConfig,
time_limit: Duration,
termination: AnyTermination<S, ScoreDirector<S, C>>,
terminate: Option<&AtomicBool>,
callback: impl Fn(&S) + Send + Sync,
) -> SolveResult<S>
fn build_and_solve( self, director: ScoreDirector<S, C>, config: &SolverConfig, time_limit: Duration, termination: AnyTermination<S, ScoreDirector<S, C>>, terminate: Option<&AtomicBool>, callback: impl Fn(&S) + Send + Sync, ) -> SolveResult<S>
Builds the construction + local search phases and runs the solver.
Auto Trait Implementations§
impl<S> Freeze for BasicSpec<S>
impl<S> RefUnwindSafe for BasicSpec<S>
impl<S> Send for BasicSpec<S>
impl<S> Sync for BasicSpec<S>
impl<S> Unpin for BasicSpec<S>
impl<S> UnsafeUnpin for BasicSpec<S>
impl<S> UnwindSafe for BasicSpec<S>
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