![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
#include <routing_filter_committables.h>
Classes | |
struct | Interval |
struct | VehicleBreak |
Public Member Functions | |
DimensionValues (int num_paths, int num_nodes) | |
void | PushNode (int node) |
Adds a node to new nodes. | |
void | MakePathFromNewNodes (int path) |
Turns new nodes into a new path, allocating dimension values for it. | |
void | Reset () |
Resets all path to empty, in both committed and current state. | |
void | Revert () |
Clears the changed state, make it point to the committed state. | |
void | Commit () |
absl::Span< const int > | CommittedNodes (int path) const |
Returns a const view of the nodes of the path, in the committed state. | |
absl::Span< const int > | Nodes (int path) const |
Returns a const view of the nodes of the path, in the current state. | |
absl::Span< const Interval > | Transits (int path) const |
Returns a const view of the transits of the path, in the current state. | |
absl::Span< Interval > | MutableTransits (int path) |
Returns a mutable view of the transits of the path, in the current state. | |
absl::Span< const int64_t > | Travels (int path) const |
absl::Span< int64_t > | MutableTravels (int path) |
absl::Span< const int64_t > | TravelSums (int path) const |
Returns a const view of the travel sums of the path, in the current state. | |
absl::Span< int64_t > | MutableTravelSums (int path) |
Returns a mutable view of the travel sums of the path in the current state. | |
absl::Span< const Interval > | Cumuls (int path) const |
Returns a const view of the cumul mins of the path, in the current state. | |
absl::Span< Interval > | MutableCumuls (int path) |
Returns a mutable view of the cumul mins of the path, in the current state. | |
Interval | Span (int path) const |
Returns the span interval of the path, in the current state. | |
Interval & | MutableSpan (int path) |
absl::Span< const VehicleBreak > | VehicleBreaks (int path) const |
std::vector< VehicleBreak > & | MutableVehicleBreaks (int path) |
int | NumNodes (int path) const |
Returns the number of nodes of the path, in the current state. | |
absl::Span< const int > | ChangedPaths () const |
Returns a const view of the set of paths changed, in the current state. | |
bool | PathHasChanged (int path) const |
Returns whether the given path was changed, in the current state. | |
This class allows to represent a state of dimension values for all paths of a vehicle routing problem. Values of interest for each path are:
This class can maintain two states at once: a committed state and a current state. The current state can be modified by first describing a path p to be modified with PushNode() and MakePathFromNewNodes(). Then the dimension values of this path can be modified with views returned by MutableXXX() methods.
When a set of paths has been modified, the caller can decide to definitely change the committed state to the new state, or to revert to the committed state.
Operations are meant to be efficient:
Definition at line 173 of file routing_filter_committables.h.
|
inline |
Definition at line 175 of file routing_filter_committables.h.
|
inline |
Returns a const view of the set of paths changed, in the current state.
Definition at line 456 of file routing_filter_committables.h.
|
inline |
Makes the committed state point to the current state. If the state representation is too large, reclaims memory by compacting the committed state.
If the committed data would take too much space, compact the data: copy committed data to the end of vectors, erase old data, refresh indexing (range_of_path_).
Definition at line 311 of file routing_filter_committables.h.
|
inline |
Returns a const view of the nodes of the path, in the committed state.
Definition at line 357 of file routing_filter_committables.h.
|
inline |
Returns a const view of the cumul mins of the path, in the current state.
Definition at line 416 of file routing_filter_committables.h.
|
inline |
Turns new nodes into a new path, allocating dimension values for it.
Allocate dimension values. We allocate n cells for all dimension values, even transits, so they can all be indexed by the same range_of_path.
Definition at line 261 of file routing_filter_committables.h.
|
inline |
Returns a mutable view of the cumul mins of the path, in the current state.
Definition at line 422 of file routing_filter_committables.h.
|
inline |
Returns a mutable view of the span of the path, in the current state. The path must have been changed since the last commit.
Definition at line 433 of file routing_filter_committables.h.
|
inline |
Returns a mutable view of the transits of the path, in the current state.
When the path is not empty, #transits = #nodes - 1. When the path is empty, begin = end, return empty span.
Definition at line 378 of file routing_filter_committables.h.
|
inline |
Returns a mutable view of the travels of the path, in the current state.
Definition at line 396 of file routing_filter_committables.h.
|
inline |
Returns a mutable view of the travel sums of the path in the current state.
Definition at line 410 of file routing_filter_committables.h.
|
inline |
Returns a mutable vector of the vehicle breaks of the path, in the current state. The path must have been changed since the last commit.
Definition at line 448 of file routing_filter_committables.h.
|
inline |
Returns a const view of the nodes of the path, in the current state.
Definition at line 363 of file routing_filter_committables.h.
|
inline |
Returns the number of nodes of the path, in the current state.
Definition at line 454 of file routing_filter_committables.h.
|
inline |
Returns whether the given path was changed, in the current state.
Definition at line 460 of file routing_filter_committables.h.
|
inline |
Adds a node to new nodes.
Definition at line 258 of file routing_filter_committables.h.
|
inline |
Resets all path to empty, in both committed and current state.
Definition at line 279 of file routing_filter_committables.h.
|
inline |
Clears the changed state, make it point to the committed state.
Definition at line 295 of file routing_filter_committables.h.
|
inline |
Returns the span interval of the path, in the current state.
Definition at line 428 of file routing_filter_committables.h.
|
inline |
Returns a const view of the transits of the path, in the current state.
When the path is not empty, #transits = #nodes - 1. When the path is empty, begin = end, return empty span.
Definition at line 369 of file routing_filter_committables.h.
|
inline |
Returns a const view of the travels of the path, in the current state.
Definition at line 388 of file routing_filter_committables.h.
|
inline |
Returns a const view of the travel sums of the path, in the current state.
Definition at line 403 of file routing_filter_committables.h.
|
inline |
Returns a const view of the vehicle breaks of the path, in the current state.
Definition at line 440 of file routing_filter_committables.h.