Enum vrp_core::models::problem::Job

source ·
pub enum Job {
    Single(Arc<Single>),
    Multi(Arc<Multi>),
}
Expand description

Represents a job variant.

Variants§

§

Single(Arc<Single>)

Single job.

§

Multi(Arc<Multi>)

MultiJob with multiple dependent jobs.

Implementations§

source§

impl Job

source

pub fn as_single(&self) -> Option<&Arc<Single>>

Considers job as Single.

source

pub fn to_single(&self) -> &Arc<Single>

Considers job as Single. Panics if it is Multi.

source

pub fn as_multi(&self) -> Option<&Arc<Multi>>

Considers job as Multi.

source

pub fn to_multi(&self) -> &Arc<Multi>

Considers job as Multi. Panics if it is Multi

source

pub fn dimens(&self) -> &Dimensions

Returns dimensions collection.

Examples found in repository?
examples/custom_objective.rs (line 73)
72
73
74
fn estimate_job_cost(job: &Job) -> Cost {
    job.dimens().get_job_priority().filter(|&is_high_prio| *is_high_prio).map_or(1., |_| 0.)
}
More examples
Hide additional examples
examples/custom_constraint.rs (line 36)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    fn evaluate(&self, move_ctx: &MoveContext<'_>) -> Option<ConstraintViolation> {
        match move_ctx {
            // matching job to route is evaluated before activity matching, so use it to improve search procedure
            MoveContext::Route { route_ctx, job, .. } => {
                let hardware_vehicle = route_ctx.route().actor.vehicle.dimens.get_vehicle_hardware();
                let hardware_job = job.dimens().get_job_hardware();

                match (hardware_job, hardware_vehicle) {
                    (None, _) => None,
                    (Some(hw_job), Some(hw_vehicle)) if hw_vehicle.contains(hw_job) => None,
                    _ => ConstraintViolation::fail(self.code),
                }
            }
            // matching activity to route is called for every possible insertion point in the tour
            // we don't need it here as hard constraint can be validated on route-job level
            MoveContext::Activity { .. } => None,
        }
    }
source

pub fn places(&self) -> Box<dyn Iterator<Item = &Place> + '_>

Get all places from the job.

Trait Implementations§

source§

impl Clone for Job

source§

fn clone(&self) -> Job

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 Debug for Job

source§

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

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

impl Hash for Job

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Job

source§

fn eq(&self, other: &Job) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Job

Auto Trait Implementations§

§

impl Freeze for Job

§

impl !RefUnwindSafe for Job

§

impl Send for Job

§

impl Sync for Job

§

impl Unpin for Job

§

impl !UnwindSafe for Job

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for T
where 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 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.
source§

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

source§

fn vzip(self) -> V