![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
Wraps a routing assignment providing extra features. More...
#include <routing_ils.h>
Public Member Functions | |
RoutingSolution (const RoutingModel &model) | |
void | Reset (const Assignment *assignment) |
Initializes the routing solution for the given assignment. | |
void | InitializeRouteInfoIfNeeded (int vehicle) |
bool | BelongsToInitializedRoute (int64_t node_index) const |
Returns whether node_index belongs to a route that has been initialized. | |
int64_t | GetNextNodeIndex (int64_t node_index) const |
Returns the next node index of the given node_index. | |
int64_t | GetInitializedPrevNodeIndex (int64_t node_index) const |
int | GetRouteSize (int vehicle) const |
bool | CanBeRemoved (int64_t node_index) const |
void | RemoveNode (int64_t node_index) |
void | RemovePerformedPickupDeliverySibling (int64_t customer) |
Removes the performed sibling pickup or delivery of customer, if any. | |
int64_t | GetRandomAdjacentVisit (int64_t visit, std::mt19937 &rnd, std::bernoulli_distribution &boolean_dist) const |
std::vector< int64_t > | GetRandomSequenceOfVisits (int64_t seed_visit, std::mt19937 &rnd, std::bernoulli_distribution &boolean_dist, int size) const |
Wraps a routing assignment providing extra features.
Definition at line 35 of file routing_ils.h.
|
explicit |
Definition at line 488 of file routing_ils.cc.
bool operations_research::RoutingSolution::BelongsToInitializedRoute | ( | int64_t | node_index | ) | const |
Returns whether node_index belongs to a route that has been initialized.
Definition at line 537 of file routing_ils.cc.
bool operations_research::RoutingSolution::CanBeRemoved | ( | int64_t | node_index | ) | const |
Returns whether node_index can be removed from the solution. This must be called for node_index belonging to initialized routes.
Definition at line 558 of file routing_ils.cc.
int64_t operations_research::RoutingSolution::GetInitializedPrevNodeIndex | ( | int64_t | node_index | ) | const |
Returns the previous node index of the given node_index. This must be called for node_index belonging to initialized routes.
Definition at line 548 of file routing_ils.cc.
int64_t operations_research::RoutingSolution::GetNextNodeIndex | ( | int64_t | node_index | ) | const |
Returns the next node index of the given node_index.
Definition at line 542 of file routing_ils.cc.
int64_t operations_research::RoutingSolution::GetRandomAdjacentVisit | ( | int64_t | visit, |
std::mt19937 & | rnd, | ||
std::bernoulli_distribution & | boolean_dist ) const |
Randomly returns the next or previous visit of the given performed visit. Returns -1 if there are no other available visits. When the selected adjacent vertex is a vehicle start/end, we always pick the visit in the opposite direction. This must be called for a performed visit belonging to an initialized route.
The visit is performed.
Definition at line 599 of file routing_ils.cc.
std::vector< int64_t > operations_research::RoutingSolution::GetRandomSequenceOfVisits | ( | int64_t | seed_visit, |
std::mt19937 & | rnd, | ||
std::bernoulli_distribution & | boolean_dist, | ||
int | size ) const |
Returns a randomly selected sequence of contiguous visits that includes the seed visit. This must be called for a performed seed visit belonging to an initialized route.
The seed visit is actually performed.
The seed visit is always included.
Sequence's excluded boundaries.
We can no longer extend the sequence either way.
When left is at the start (resp. right is at the end), we can only extend right (resp. left), and if both ends are free to move we decide the direction at random.
Definition at line 625 of file routing_ils.cc.
int operations_research::RoutingSolution::GetRouteSize | ( | int | vehicle | ) | const |
Returns the number of visits performed by the given vehicle. This must be called for a vehicle associated with an initialized route.
Definition at line 553 of file routing_ils.cc.
void operations_research::RoutingSolution::InitializeRouteInfoIfNeeded | ( | int | vehicle | ) |
Initializes next and prev pointers for the route served by the given vehicle, if not already done.
Setup the start and inner nodes.
Setup the end node.
Definition at line 507 of file routing_ils.cc.
void operations_research::RoutingSolution::RemoveNode | ( | int64_t | node_index | ) |
Removes the node with the given node_index. This must be called for node_index belonging to initialized routes.
Definition at line 563 of file routing_ils.cc.
void operations_research::RoutingSolution::RemovePerformedPickupDeliverySibling | ( | int64_t | customer | ) |
Removes the performed sibling pickup or delivery of customer, if any.
Definition at line 583 of file routing_ils.cc.
void operations_research::RoutingSolution::Reset | ( | const Assignment * | assignment | ) |
Initializes the routing solution for the given assignment.
Definition at line 496 of file routing_ils.cc.