pub trait SaProblem: Send + Sync {
type Solution: SaSolution;
// Required methods
fn initial_solution<R: Rng>(&self, rng: &mut R) -> Self::Solution;
fn neighbor<R: Rng>(
&self,
solution: &Self::Solution,
operator: NeighborhoodOperator,
rng: &mut R,
) -> Self::Solution;
fn evaluate(&self, solution: &mut Self::Solution);
// Provided methods
fn available_operators(&self) -> Vec<NeighborhoodOperator> { ... }
fn on_temperature_change(
&self,
_temperature: f64,
_iteration: u64,
_best: &Self::Solution,
_current: &Self::Solution,
) { ... }
}Expand description
Trait for problem-specific SA operations.
Required Associated Types§
Sourcetype Solution: SaSolution
type Solution: SaSolution
The solution type for this problem.
Required Methods§
Sourcefn initial_solution<R: Rng>(&self, rng: &mut R) -> Self::Solution
fn initial_solution<R: Rng>(&self, rng: &mut R) -> Self::Solution
Creates an initial solution.
Provided Methods§
Sourcefn available_operators(&self) -> Vec<NeighborhoodOperator>
fn available_operators(&self) -> Vec<NeighborhoodOperator>
Returns available neighborhood operators for this problem.
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.