Struct vrp_core::models::problem::GoalContext
source · pub struct GoalContext { /* private fields */ }Expand description
Defines Vehicle Routing Problem variant by global and local objectives: A global objective defines the way two VRP solutions are compared in order to select better one: for example, given the same amount of assigned jobs, prefer less tours used instead of total solution cost.
A local objective defines how single VRP solution is created/modified. It specifies hard constraints such as vehicle capacity, time windows, skills, etc. Also it defines soft constraints which are used to guide search in preferred by global objective direction: reduce amount of tours served, maximize total value of assigned jobs, etc.
Both, global and local objectives, are specified by individual features. In general, a Feature encapsulates a single VRP aspect, such as capacity constraint for job’ demand, time limitations for vehicles/jobs, etc.
Implementations§
source§impl GoalContext
impl GoalContext
source§impl GoalContext
impl GoalContext
sourcepub fn accept_insertion(
&self,
solution_ctx: &mut SolutionContext,
route_index: usize,
job: &Job
)
pub fn accept_insertion(
&self,
solution_ctx: &mut SolutionContext,
route_index: usize,
job: &Job
)
Accepts job insertion.
sourcepub fn accept_route_state(&self, route_ctx: &mut RouteContext)
pub fn accept_route_state(&self, route_ctx: &mut RouteContext)
Accepts route state.
sourcepub fn accept_solution_state(&self, solution_ctx: &mut SolutionContext)
pub fn accept_solution_state(&self, solution_ctx: &mut SolutionContext)
Accepts solution state.
sourcepub fn merge(&self, source: Job, candidate: Job) -> Result<Job, ViolationCode>
pub fn merge(&self, source: Job, candidate: Job) -> Result<Job, ViolationCode>
Tries to merge two jobs taking into account common constraints. Returns a new job, if it is possible to merge them together having theoretically assignable job. Otherwise returns violation error code.
sourcepub fn evaluate(&self, move_ctx: &MoveContext<'_>) -> Option<ConstraintViolation>
pub fn evaluate(&self, move_ctx: &MoveContext<'_>) -> Option<ConstraintViolation>
Evaluates feasibility of the refinement move.
sourcepub fn estimate(&self, move_ctx: &MoveContext<'_>) -> Cost
pub fn estimate(&self, move_ctx: &MoveContext<'_>) -> Cost
Estimates insertion cost (penalty) of the refinement move.
Trait Implementations§
source§impl Clone for GoalContext
impl Clone for GoalContext
source§fn clone(&self) -> GoalContext
fn clone(&self) -> GoalContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Default for GoalContext
impl Default for GoalContext
source§fn default() -> GoalContext
fn default() -> GoalContext
source§impl MultiObjective for GoalContext
impl MultiObjective for GoalContext
§type Solution = InsertionContext
type Solution = InsertionContext
source§fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering
fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering
source§fn fitness<'a>(
&'a self,
solution: &'a Self::Solution
) -> Box<dyn Iterator<Item = f64> + 'a>
fn fitness<'a>(
&'a self,
solution: &'a Self::Solution
) -> Box<dyn Iterator<Item = f64> + 'a>
solution.