Trait vrp_core::models::problem::FeatureState
source · pub trait FeatureState {
fn accept_insertion(
&self,
solution_ctx: &mut SolutionContext,
route_index: usize,
job: &Job
);
fn accept_route_state(&self, route_ctx: &mut RouteContext);
fn accept_solution_state(&self, solution_ctx: &mut SolutionContext);
fn state_keys(&self) -> Iter<'_, StateKey>;
}Expand description
Controls a cached state of the given feature.
Required Methods§
sourcefn accept_insertion(
&self,
solution_ctx: &mut SolutionContext,
route_index: usize,
job: &Job
)
fn accept_insertion(
&self,
solution_ctx: &mut SolutionContext,
route_index: usize,
job: &Job
)
Accept insertion of specific job into the route.
Called once job has been inserted into solution represented via solution_ctx.
Target route is defined by route_index which refers to routes collection in solution context.
Inserted job is job.
This method can call accept_route_state internally.
This method should NOT modify amount of job activities in the tour.
sourcefn accept_route_state(&self, route_ctx: &mut RouteContext)
fn accept_route_state(&self, route_ctx: &mut RouteContext)
Accept route and updates its state to allow more efficient constraint checks. This method should NOT modify amount of job activities in the tour.
sourcefn accept_solution_state(&self, solution_ctx: &mut SolutionContext)
fn accept_solution_state(&self, solution_ctx: &mut SolutionContext)
Accepts insertion solution context allowing to update job insertion data. This method called twice: before insertion of all jobs starts and when it ends. Please note, that it is important to update only stale routes as this allows to avoid updating non changed route states.
sourcefn state_keys(&self) -> Iter<'_, StateKey>
fn state_keys(&self) -> Iter<'_, StateKey>
Returns unique constraint state keys used to store some state. If the data is only read, then it shouldn’t be returned. Used to avoid state key interference.