Struct vrp_core::models::solution::Tour

source ·
pub struct Tour { /* private fields */ }
Expand description

Represents a tour, a smart container for jobs with their associated activities.

Implementations§

source§

impl Tour

source

pub fn new(actor: &Actor) -> Self

Creates a new tour with start and optional end using actor properties.

source

pub fn set_start(&mut self, activity: Activity) -> &mut Tour

Sets tour start.

source

pub fn set_end(&mut self, activity: Activity) -> &mut Tour

Sets tour end.

source

pub fn insert_last(&mut self, activity: Activity) -> &mut Tour

Inserts activity within its job to the end of tour.

source

pub fn insert_at(&mut self, activity: Activity, index: usize) -> &mut Tour

Inserts activity within its job at specified index.

source

pub fn remove(&mut self, job: &Job) -> bool

Removes job within its activities from the tour.

source

pub fn remove_activity_at(&mut self, idx: usize) -> Job

Removes activity and its job from the tour.

source

pub fn all_activities(&self) -> Iter<'_, Activity>

Returns all activities in tour.

source

pub fn activities_slice(&self, start: usize, end: usize) -> &[Activity]

Returns activities slice in specific range (all inclusive).

source

pub fn all_activities_mut(&mut self) -> IterMut<'_, Activity>

Returns all activities in tour as mutable.

source

pub fn job_activities<'a>( &'a self, job: &'a Job ) -> impl Iterator<Item = &Activity> + 'a

Returns all activities in tour for specific job.

source

pub fn legs(&self) -> impl Iterator<Item = Leg<'_>> + '_ + Clone

Returns counted tour legs.

source

pub fn jobs(&self) -> impl Iterator<Item = &Job> + '_

Returns all jobs.

source

pub fn get(&self, index: usize) -> Option<&Activity>

Returns activity by its index in tour.

source

pub fn get_mut(&mut self, index: usize) -> Option<&mut Activity>

Returns mutable activity by its index in tour.

source

pub fn start(&self) -> Option<&Activity>

Returns start activity in tour.

source

pub fn end(&self) -> Option<&Activity>

Returns end activity in tour.

source

pub fn end_idx(&self) -> Option<usize>

Returns end activity in tour.

source

pub fn contains(&self, job: &Job) -> bool

Checks whether job is present in tour

source

pub fn index(&self, job: &Job) -> Option<usize>

Returns index of first job occurrence in the tour.

source

pub fn index_last(&self, job: &Job) -> Option<usize>

Returns index of last job occurrence in the tour.

source

pub fn has_job(&self, job: &Job) -> bool

Checks whether job is present in tour.

source

pub fn has_jobs(&self) -> bool

Checks whether tour has jobs.

source

pub fn job_activity_count(&self) -> usize

Returns total amount of job activities.

source

pub fn total(&self) -> usize

Returns amount of all activities in tour.

source

pub fn job_count(&self) -> usize

Returns amount of jobs.

source

pub fn deep_copy(&self) -> Tour

Creates a copy of existing tour deeply copying all activities and jobs.

Trait Implementations§

source§

impl Debug for Tour

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Tour

source§

fn default() -> Tour

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

impl Index<usize> for Tour

§

type Output = Activity

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tour

§

impl Send for Tour

§

impl Sync for Tour

§

impl Unpin for Tour

§

impl !UnwindSafe for Tour

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 = _

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V