![]() |
OR-Tools
9.6
|
A ResourceGroup defines a set of available Resources with attributes on one or multiple dimensions.
For every ResourceGroup in the model, each (used) vehicle in the solution which requires a resource (see NotifyVehicleRequiresResource()) from this group must be assigned to exactly 1 resource, and each resource can in turn be assigned to at most 1 vehicle requiring it. This vehicle-to-resource assignment will apply the corresponding Attributes to the dimensions affected by the resource group. NOTE: As of 2021/07, each ResourceGroup can only affect a single RoutingDimension at a time, i.e. all Resources in a group must apply attributes to the same single dimension.
Classes | |
| class | Attributes |
| Attributes for a dimension. More... | |
| class | Resource |
| A Resource sets attributes (costs/constraints) for a set of dimensions. More... | |
Public Member Functions | |
| ResourceGroup (const RoutingModel *model) | |
| int | AddResource (Attributes attributes, const RoutingDimension *dimension) |
| Adds a Resource with the given attributes for the corresponding dimension. More... | |
| void | NotifyVehicleRequiresAResource (int vehicle) |
| Notifies that the given vehicle index requires a resource from this group if the vehicle is used (i.e. More... | |
| const std::vector< int > & | GetVehiclesRequiringAResource () const |
| bool | VehicleRequiresAResource (int vehicle) const |
| const std::vector< Resource > & | GetResources () const |
| const Resource & | GetResource (int resource_index) const |
| const absl::flat_hash_set< DimensionIndex > & | GetAffectedDimensionIndices () const |
| int | Size () const |
|
inlineexplicit |
| int AddResource | ( | Attributes | attributes, |
| const RoutingDimension * | dimension | ||
| ) |
Adds a Resource with the given attributes for the corresponding dimension.
Returns the index of the added resource in resources_.
Definition at line 1751 of file routing.cc.
|
inline |
|
inline |
|
inline |
|
inline |
| void NotifyVehicleRequiresAResource | ( | int | vehicle | ) |
Notifies that the given vehicle index requires a resource from this group if the vehicle is used (i.e.
if its route is non-empty or vehicle_used_when_empty_[vehicle] is true).
Definition at line 1768 of file routing.cc.