pub struct Feature {
pub name: String,
pub constraint: Option<Arc<dyn FeatureConstraint>>,
pub objective: Option<Arc<dyn FeatureObjective>>,
pub state: Option<Arc<dyn FeatureState>>,
}
Expand description
An individual feature which is used to build a specific VRP variant, e.g., capacity restriction, job values, etc. Each feature consists of three optional parts (but at least one should be defined):
-
constraint: an invariant which should be hold to have a feasible VRP solution in the end. A good examples are hard constraints such as capacity, time, travel limits, etc.
-
objective: an objective of the optimization such as minimization of unassigned jobs or tours. All objectives form together a hierarchy which describes a goal of optimization, including various soft constraints: assignment of preferred jobs, optional breaks, etc. This helps to guide the search on the global objective level (e.g. comparison of various solutions in order to find out which one is “better”) and local objective level (e.g. which job should be inserted next into specific solution).
-
state: the corresponding cached data of constraint/objective to speed up/control their evaluations.
As mentioned above, at least one part should be defined. Some rules of thumb:
- each soft constraint requires an objective so that the goal of optimization is reflected on global and local levels
- hard constraint can be defined without objective as this is an invariant
- state should be used to avoid expensive calculations during insertion evaluation phase.
FeatureObjective::estimate
andFeatureConstraint::evaluate
methods are called during this phase. Additionally, it can be used to do some solution modifications atFeatureState::accept_solution_state
.
Fields§
§name: String
An unique id of the feature.
constraint: Option<Arc<dyn FeatureConstraint>>
A hard constraint.
objective: Option<Arc<dyn FeatureObjective>>
An objective which models soft constraints.
state: Option<Arc<dyn FeatureState>>
A state change handler.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Feature
impl !RefUnwindSafe for Feature
impl Send for Feature
impl Sync for Feature
impl Unpin for Feature
impl !UnwindSafe for Feature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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