Struct vrp_core::construction::heuristics::InsertionContext
source · pub struct InsertionContext {
pub problem: Arc<Problem>,
pub solution: SolutionContext,
pub environment: Arc<Environment>,
}
Expand description
A context which contains information needed for heuristic and metaheuristic.
Fields§
§problem: Arc<Problem>
Original problem.
solution: SolutionContext
Solution context: discovered solution.
environment: Arc<Environment>
Information about environment.
Implementations§
source§impl InsertionContext
impl InsertionContext
sourcepub fn new(problem: Arc<Problem>, environment: Arc<Environment>) -> Self
pub fn new(problem: Arc<Problem>, environment: Arc<Environment>) -> Self
Creates insertion context for given problem with unassigned jobs.
sourcepub fn new_empty(problem: Arc<Problem>, environment: Arc<Environment>) -> Self
pub fn new_empty(problem: Arc<Problem>, environment: Arc<Environment>) -> Self
Creates insertion context for given problem with empty solution.
sourcepub fn new_from_solution(
problem: Arc<Problem>,
solution: (Solution, Option<Cost>),
environment: Arc<Environment>,
) -> Self
pub fn new_from_solution( problem: Arc<Problem>, solution: (Solution, Option<Cost>), environment: Arc<Environment>, ) -> Self
Creates insertion context from existing solution.
sourcepub fn get_total_cost(&self) -> Option<Cost>
pub fn get_total_cost(&self) -> Option<Cost>
Gets total cost of the solution.
Returns None if cost cannot be calculate as the context is in non-consistent state.
Trait Implementations§
source§impl Debug for InsertionContext
impl Debug for InsertionContext
source§impl From<InsertionContext> for Solution
impl From<InsertionContext> for Solution
source§fn from(insertion_ctx: InsertionContext) -> Self
fn from(insertion_ctx: InsertionContext) -> Self
Converts to this type from the input type.
source§impl HeuristicSolution for InsertionContext
impl HeuristicSolution for InsertionContext
source§impl RosomaxaWeighted for InsertionContext
impl RosomaxaWeighted for InsertionContext
source§fn init_weights(&mut self)
fn init_weights(&mut self)
Initializes weights.
Auto Trait Implementations§
impl Freeze for InsertionContext
impl !RefUnwindSafe for InsertionContext
impl Send for InsertionContext
impl Sync for InsertionContext
impl Unpin for InsertionContext
impl !UnwindSafe for InsertionContext
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