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

source

pub fn new( features: &[Feature], global_objective_map: &[Vec<String>], local_objective_map: &[Vec<String>] ) -> Result<Self, String>

Creates a new instance of VrpVariant with features specified using information about hierarchy of objectives.

source§

impl GoalContext

source

pub fn accept_insertion( &self, solution_ctx: &mut SolutionContext, route_index: usize, job: &Job )

Accepts job insertion.

source

pub fn accept_route_state(&self, route_ctx: &mut RouteContext)

Accepts route state.

source

pub fn accept_solution_state(&self, solution_ctx: &mut SolutionContext)

Accepts solution state.

source

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.

source

pub fn evaluate( &self, move_ctx: &MoveContext<'_> ) -> Option<ConstraintViolation>

Evaluates feasibility of the refinement move.

source

pub fn estimate(&self, move_ctx: &MoveContext<'_>) -> Cost

Estimates insertion cost (penalty) of the refinement move.

Trait Implementations§

source§

impl Clone for GoalContext

source§

fn clone(&self) -> GoalContext

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for GoalContext

source§

fn default() -> GoalContext

Returns the “default value” for a type. Read more
source§

impl MultiObjective for GoalContext

§

type Solution = InsertionContext

The solution value type that we define the objective on.
source§

fn total_order(&self, a: &Self::Solution, b: &Self::Solution) -> Ordering

An objective defines a total ordering between any two solution values.
source§

fn fitness<'a>( &'a self, solution: &'a Self::Solution ) -> Box<dyn Iterator<Item = f64> + 'a>

An objective fitness values for given solution.
source§

fn get_order( &self, a: &Self::Solution, b: &Self::Solution, idx: usize ) -> Result<Ordering, String>

Get solution order for individual objective.
source§

fn get_distance( &self, a: &Self::Solution, b: &Self::Solution, idx: usize ) -> Result<f64, String>

Gets solution distance for individual objective.
source§

fn size(&self) -> usize

Returns total number of inner objectives.
source§

impl Shuffled for GoalContext

source§

fn get_shuffled(&self, random: &(dyn Random + Send + Sync)) -> Self

Returns a new instance of ObjectiveCost with shuffled objectives.

source§

impl HeuristicObjective for GoalContext

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V