pub trait AlnsProblem {
type Solution: AlnsSolution;
// Required methods
fn create_initial_solution(&mut self) -> Self::Solution;
fn clone_solution(&self, solution: &Self::Solution) -> Self::Solution;
fn destroy_operators(&self) -> Vec<DestroyOperatorId>;
fn repair_operators(&self) -> Vec<RepairOperatorId>;
fn destroy(
&mut self,
solution: &mut Self::Solution,
operator: DestroyOperatorId,
degree: f64,
rng: &mut StdRng,
) -> DestroyResult;
fn repair(
&mut self,
solution: &mut Self::Solution,
destroyed: &DestroyResult,
operator: RepairOperatorId,
) -> RepairResult;
// Provided method
fn relatedness(&self, solution: &Self::Solution, i: usize, j: usize) -> f64 { ... }
}Expand description
Trait for problems that can be solved by ALNS.
Required Associated Types§
Sourcetype Solution: AlnsSolution
type Solution: AlnsSolution
Solution type
Required Methods§
Sourcefn create_initial_solution(&mut self) -> Self::Solution
fn create_initial_solution(&mut self) -> Self::Solution
Create an initial solution.
Sourcefn clone_solution(&self, solution: &Self::Solution) -> Self::Solution
fn clone_solution(&self, solution: &Self::Solution) -> Self::Solution
Clone a solution.
Sourcefn destroy_operators(&self) -> Vec<DestroyOperatorId>
fn destroy_operators(&self) -> Vec<DestroyOperatorId>
Get available destroy operators.
Sourcefn repair_operators(&self) -> Vec<RepairOperatorId>
fn repair_operators(&self) -> Vec<RepairOperatorId>
Get available repair operators.
Sourcefn destroy(
&mut self,
solution: &mut Self::Solution,
operator: DestroyOperatorId,
degree: f64,
rng: &mut StdRng,
) -> DestroyResult
fn destroy( &mut self, solution: &mut Self::Solution, operator: DestroyOperatorId, degree: f64, rng: &mut StdRng, ) -> DestroyResult
Apply a destroy operator.
Sourcefn repair(
&mut self,
solution: &mut Self::Solution,
destroyed: &DestroyResult,
operator: RepairOperatorId,
) -> RepairResult
fn repair( &mut self, solution: &mut Self::Solution, destroyed: &DestroyResult, operator: RepairOperatorId, ) -> RepairResult
Apply a repair operator.
Provided Methods§
Calculate relatedness between two items (for Shaw/Related removal).