Struct vrp_core::solver::RefinementContext
source · [−]pub struct RefinementContext {
pub problem: Arc<Problem>,
pub environment: Arc<Environment>,
pub state: HashMap<String, Box<dyn Any + Sync + Send>>,
/* private fields */
}Expand description
A type which encapsulates information needed to perform solution refinement process.
Fields
problem: Arc<Problem>Original problem definition.
environment: Arc<Environment>An environmental context.
state: HashMap<String, Box<dyn Any + Sync + Send>>A collection of data associated with refinement process.
Implementations
sourceimpl RefinementContext
impl RefinementContext
sourcepub fn new(
problem: Arc<Problem>,
population: TargetPopulation,
telemetry_mode: TelemetryMode,
environment: Arc<Environment>
) -> Self
pub fn new(
problem: Arc<Problem>,
population: TargetPopulation,
telemetry_mode: TelemetryMode,
environment: Arc<Environment>
) -> Self
Creates a new instance of RefinementContext.
sourcepub fn add_solution(&mut self, solution: InsertionContext)
pub fn add_solution(&mut self, solution: InsertionContext)
Adds solution to population.
Trait Implementations
sourceimpl HeuristicContext for RefinementContext
impl HeuristicContext for RefinementContext
type Objective = ProblemObjective
type Objective = ProblemObjective
A heuristic objective function type.
type Solution = InsertionContext
type Solution = InsertionContext
A heuristic solution type.
sourcefn population(&self) -> &DynHeuristicPopulation<Self::Objective, Self::Solution>
fn population(&self) -> &DynHeuristicPopulation<Self::Objective, Self::Solution>
Returns current population.
sourcefn statistics(&self) -> &HeuristicStatistics
fn statistics(&self) -> &HeuristicStatistics
Returns current statistic used to track the search progress.
sourcefn environment(&self) -> &Environment
fn environment(&self) -> &Environment
Returns environment.
sourcefn on_initial(&mut self, solution: Self::Solution, item_time: Timer)
fn on_initial(&mut self, solution: Self::Solution, item_time: Timer)
Updates population with initial solution.
sourcefn on_generation(
&mut self,
offspring: Vec<Self::Solution>,
termination_estimate: f64,
generation_time: Timer
)
fn on_generation(
&mut self,
offspring: Vec<Self::Solution>,
termination_estimate: f64,
generation_time: Timer
)
Updates population with a new offspring.
sourcefn on_result(self) -> HeuristicResult<Self::Objective, Self::Solution>
fn on_result(self) -> HeuristicResult<Self::Objective, Self::Solution>
Returns final population and telemetry metrics
Auto Trait Implementations
impl !RefUnwindSafe for RefinementContext
impl Send for RefinementContext
impl Sync for RefinementContext
impl Unpin for RefinementContext
impl !UnwindSafe for RefinementContext
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