Struct vrp_core::prelude::EvolutionConfigBuilder
source · [−]pub struct EvolutionConfigBuilder<C, O, S, K> where
C: 'static + HeuristicContext<Objective = O, Solution = S> + Stateful<Key = K>,
O: 'static + HeuristicObjective<Solution = S>,
S: 'static + HeuristicSolution,
K: 'static + Hash + Eq + Clone + Send + Sync, { /* private fields */ }Expand description
Provides configurable way to build evolution configuration using fluent interface style.
Implementations
sourceimpl<C, O, S, K> EvolutionConfigBuilder<C, O, S, K> where
C: 'static + HeuristicContext<Objective = O, Solution = S> + Stateful<Key = K>,
O: 'static + HeuristicObjective<Solution = S>,
S: 'static + HeuristicSolution,
K: 'static + Hash + Eq + Clone + Send + Sync,
impl<C, O, S, K> EvolutionConfigBuilder<C, O, S, K> where
C: 'static + HeuristicContext<Objective = O, Solution = S> + Stateful<Key = K>,
O: 'static + HeuristicObjective<Solution = S>,
S: 'static + HeuristicSolution,
K: 'static + Hash + Eq + Clone + Send + Sync,
sourcepub fn with_max_generations(
self,
limit: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_max_generations(
self,
limit: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets max generations to be run by evolution. Default is 3000.
sourcepub fn with_max_time(
self,
limit: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_max_time(
self,
limit: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets max running time limit for evolution. Default is 300 seconds.
sourcepub fn with_min_cv(
self,
min_cv: Option<(String, usize, f64, bool)>,
key: K
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_min_cv(
self,
min_cv: Option<(String, usize, f64, bool)>,
key: K
) -> EvolutionConfigBuilder<C, O, S, K>
Sets variation coefficient termination criteria. Default is None.
sourcepub fn with_target_proximity(
self,
target_proximity: Option<(Vec<f64, Global>, f64)>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_target_proximity(
self,
target_proximity: Option<(Vec<f64, Global>, f64)>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets target fitness and distance threshold as termination criteria.
sourcepub fn with_initial(
self,
max_size: usize,
quota: f64,
operators: Vec<(Box<dyn InitialOperator<Objective = O, Context = C, Solution = S> + Send + Sync + 'static, Global>, usize), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_initial(
self,
max_size: usize,
quota: f64,
operators: Vec<(Box<dyn InitialOperator<Objective = O, Context = C, Solution = S> + Send + Sync + 'static, Global>, usize), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets initial parameters used to construct initial population.
sourcepub fn with_processing(
self,
processing: ProcessingConfig<C, O, S>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_processing(
self,
processing: ProcessingConfig<C, O, S>
) -> EvolutionConfigBuilder<C, O, S, K>
Specifies processing configuration.
sourcepub fn with_init_solutions(
self,
solutions: Vec<S, Global>,
max_init_size: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_init_solutions(
self,
solutions: Vec<S, Global>,
max_init_size: Option<usize>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets initial solutions in population. Default is no solutions in population.
sourcepub fn with_objective(
self,
objective: Arc<dyn HeuristicObjective<Solution = S> + 'static>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_objective(
self,
objective: Arc<dyn HeuristicObjective<Solution = S> + 'static>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets objective.
sourcepub fn with_context(self, context: C) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_context(self, context: C) -> EvolutionConfigBuilder<C, O, S, K>
Sets heuristic context.
sourcepub fn with_termination(
self,
termination: Box<dyn Termination<Context = C, Objective = O> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_termination(
self,
termination: Box<dyn Termination<Context = C, Objective = O> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets termination.
sourcepub fn with_heuristic(
self,
heuristic: Box<dyn HyperHeuristic<Objective = O, Solution = S, Context = C> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_heuristic(
self,
heuristic: Box<dyn HyperHeuristic<Objective = O, Solution = S, Context = C> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets a different heuristic replacing initial.
sourcepub fn with_strategy(
self,
strategy: Box<dyn EvolutionStrategy<Solution = S, Context = C, Objective = O> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_strategy(
self,
strategy: Box<dyn EvolutionStrategy<Solution = S, Context = C, Objective = O> + 'static, Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets a different heuristic replacing initial.
sourcepub fn with_operators(
self,
heuristic_operators: Vec<(Arc<dyn HeuristicOperator<Objective = O, Solution = S, Context = C> + Send + Sync + 'static>, String), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_operators(
self,
heuristic_operators: Vec<(Arc<dyn HeuristicOperator<Objective = O, Solution = S, Context = C> + Send + Sync + 'static>, String), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets heuristic operators.
sourcepub fn with_group(
self,
heuristic_group: Vec<(Arc<dyn HeuristicOperator<Objective = O, Solution = S, Context = C> + Send + Sync + 'static>, (Box<dyn Fn(&C, &S) + Send + Sync + 'static, Global>, PhantomData<O>)), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
pub fn with_group(
self,
heuristic_group: Vec<(Arc<dyn HeuristicOperator<Objective = O, Solution = S, Context = C> + Send + Sync + 'static>, (Box<dyn Fn(&C, &S) + Send + Sync + 'static, Global>, PhantomData<O>)), Global>
) -> EvolutionConfigBuilder<C, O, S, K>
Sets heuristic group.
sourcepub fn build(self) -> Result<EvolutionConfig<C, O, S>, String>
pub fn build(self) -> Result<EvolutionConfig<C, O, S>, String>
Builds the evolution config.
Trait Implementations
sourceimpl<C, O, S, K> Default for EvolutionConfigBuilder<C, O, S, K> where
C: 'static + HeuristicContext<Objective = O, Solution = S> + Stateful<Key = K>,
O: 'static + HeuristicObjective<Solution = S>,
S: 'static + HeuristicSolution,
K: 'static + Hash + Eq + Clone + Send + Sync,
impl<C, O, S, K> Default for EvolutionConfigBuilder<C, O, S, K> where
C: 'static + HeuristicContext<Objective = O, Solution = S> + Stateful<Key = K>,
O: 'static + HeuristicObjective<Solution = S>,
S: 'static + HeuristicSolution,
K: 'static + Hash + Eq + Clone + Send + Sync,
sourcefn default() -> EvolutionConfigBuilder<C, O, S, K>
fn default() -> EvolutionConfigBuilder<C, O, S, K>
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<C, O, S, K> !RefUnwindSafe for EvolutionConfigBuilder<C, O, S, K>
impl<C, O, S, K> !Send for EvolutionConfigBuilder<C, O, S, K>
impl<C, O, S, K> !Sync for EvolutionConfigBuilder<C, O, S, K>
impl<C, O, S, K> Unpin for EvolutionConfigBuilder<C, O, S, K> where
C: Unpin,
K: Unpin,
O: Unpin,
S: Unpin,
impl<C, O, S, K> !UnwindSafe for EvolutionConfigBuilder<C, O, S, K>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more