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§
source§impl 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§
source§impl HeuristicContext for RefinementContext
impl HeuristicContext for RefinementContext
§type Objective = GoalContext
type Objective = GoalContext
A heuristic objective function type.
§type Solution = InsertionContext
type Solution = InsertionContext
A heuristic solution type.
source§fn selected<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Solution> + 'a>
fn selected<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Solution> + 'a>
Returns selected solutions base on current context.
source§fn ranked<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Solution> + 'a>
fn ranked<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Solution> + 'a>
Returns subset of solutions within their rank sorted according their quality.
source§fn statistics(&self) -> &HeuristicStatistics
fn statistics(&self) -> &HeuristicStatistics
Returns current statistic used to track the search progress.
source§fn selection_phase(&self) -> SelectionPhase
fn selection_phase(&self) -> SelectionPhase
Returns selection phase.
source§fn environment(&self) -> &Environment
fn environment(&self) -> &Environment
Returns environment.
source§fn 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.
Auto Trait Implementations§
impl Freeze for RefinementContext
impl !RefUnwindSafe for RefinementContext
impl Send for RefinementContext
impl Sync for RefinementContext
impl Unpin for RefinementContext
impl !UnwindSafe for RefinementContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more