OptModel

pub trait OptModel<'a>: Sync + Send {
    type SolutionType: Clone + Sync + Send;

    // Required methods
    fn generate_trial_solution<R: Rng>(
        &self,
        current_solution: Self::SolutionType,
        rng: &mut R,
    ) -> Self::SolutionType;
    fn evaluate<R: Rng>(
        &self,
        solution: &Self::SolutionType,
        rng: &mut R,
    ) -> NotNan<f64>;
}
Expand description

OptModel is a trait that defines requirements to be used with optimization algorithm

Required Associated Types§

Source

type SolutionType: Clone + Sync + Send

Type of the Solution

Required Methods§

Source

fn generate_trial_solution<R: Rng>( &self, current_solution: Self::SolutionType, rng: &mut R, ) -> Self::SolutionType

Generate a new trial solution from current solution

Source

fn evaluate<R: Rng>( &self, solution: &Self::SolutionType, rng: &mut R, ) -> NotNan<f64>

Evaluate the score of the solution

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§