Skip to main content

ProblemSpec

Trait ProblemSpec 

Source
pub trait ProblemSpec<S, C>{
    // Required methods
    fn is_trivial(&self, solution: &S) -> bool;
    fn default_time_limit_secs(&self) -> u64;
    fn log_scale(&self, solution: &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>;
}
Expand description

Parameterizes run_solver over basic-variable and list-variable problems.

Implementors supply problem-specific trivial-case detection, logging, default time limit, and the actual construction + local search execution.

Required Methods§

Source

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

Default solver time limit in seconds (used when config has no termination).

Source

fn log_scale(&self, solution: &S)

Logs the problem scale (entity count, value count, etc.).

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>

Builds the construction + local search phases and runs the solver.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, C> ProblemSpec<S, C> for BasicSpec<S>

Source§

impl<S, V, C, DM, IDM> ProblemSpec<S, C> for ListSpec<S, V, DM, IDM>