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
sourceimpl GoalContext
impl GoalContext
sourceimpl 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
sourceimpl Clone for GoalContext
impl Clone for GoalContext
sourcefn clone(&self) -> GoalContext
fn clone(&self) -> GoalContext
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Default for GoalContext
impl Default for GoalContext
sourcefn default() -> GoalContext
fn default() -> GoalContext
sourceimpl MultiObjective for GoalContext
impl MultiObjective for GoalContext
type Solution = InsertionContext
type Solution = InsertionContext
sourcefn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering
fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering
sourcefn 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.sourcefn get_order(
&self,
a: &Self::Solution,
b: &Self::Solution,
idx: usize
) -> Result<Ordering, String>
fn get_order(
&self,
a: &Self::Solution,
b: &Self::Solution,
idx: usize
) -> Result<Ordering, String>
sourceimpl Shuffled for GoalContext
impl Shuffled for GoalContext
sourcefn get_shuffled(&self, random: &(dyn Random + Send + Sync)) -> Self
fn get_shuffled(&self, random: &(dyn Random + Send + Sync)) -> Self
Returns a new instance of ObjectiveCost with shuffled objectives.