Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::RoutingModel::ResourceGroup Class Reference

Detailed Description

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.

Definition at line 410 of file routing.h.

#include <routing.h>

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

int AddResource (Attributes attributes, const RoutingDimension *dimension)
void NotifyVehicleRequiresAResource (int vehicle)
const std::vector< int > & GetVehiclesRequiringAResource () const
bool VehicleRequiresAResource (int vehicle) const
void SetAllowedResourcesForVehicle (int vehicle, const std::vector< int > &allowed_resource_indices)
void ClearAllowedResourcesForVehicle (int vehicle)
const absl::flat_hash_set< int > & GetResourcesMarkedAllowedForVehicle (int vehicle) const
bool IsResourceAllowedForVehicle (int resource, int vehicle) const
const std::vector< Resource > & GetResources () const
const ResourceGetResource (int resource_index) const
const absl::flat_hash_set< DimensionIndex > & GetAffectedDimensionIndices () const
int GetResourceClassesCount () const
const std::vector< int > & GetResourceIndicesInClass (ResourceClassIndex resource_class) const
const util_intops::StrongVector< ResourceClassIndex, std::vector< int > > & GetResourceIndicesPerClass () const
ResourceClassIndex GetResourceClassIndex (int resource_index) const
const AttributesGetDimensionAttributesForClass (DimensionIndex dimension_index, ResourceClassIndex rc_index) const
int Size () const
int Index () const

Friends

class RoutingModel

Member Function Documentation

◆ AddResource()

int operations_research::ResourceGroup::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 1155 of file routing.cc.

◆ ClearAllowedResourcesForVehicle()

void operations_research::RoutingModel::ResourceGroup::ClearAllowedResourcesForVehicle ( int vehicle)
inline

Definition at line 498 of file routing.h.

◆ GetAffectedDimensionIndices()

const absl::flat_hash_set< DimensionIndex > & operations_research::RoutingModel::ResourceGroup::GetAffectedDimensionIndices ( ) const
inline

Definition at line 518 of file routing.h.

◆ GetDimensionAttributesForClass()

const Attributes & operations_research::RoutingModel::ResourceGroup::GetDimensionAttributesForClass ( DimensionIndex dimension_index,
ResourceClassIndex rc_index ) const
inline

Definition at line 541 of file routing.h.

◆ GetResource()

const Resource & operations_research::RoutingModel::ResourceGroup::GetResource ( int resource_index) const
inline

Definition at line 514 of file routing.h.

◆ GetResourceClassesCount()

int operations_research::RoutingModel::ResourceGroup::GetResourceClassesCount ( ) const
inline

Definition at line 523 of file routing.h.

◆ GetResourceClassIndex()

ResourceClassIndex operations_research::RoutingModel::ResourceGroup::GetResourceClassIndex ( int resource_index) const
inline

Definition at line 537 of file routing.h.

◆ GetResourceIndicesInClass()

const std::vector< int > & operations_research::RoutingModel::ResourceGroup::GetResourceIndicesInClass ( ResourceClassIndex resource_class) const
inline

Definition at line 526 of file routing.h.

◆ GetResourceIndicesPerClass()

const util_intops::StrongVector< ResourceClassIndex, std::vector< int > > & operations_research::RoutingModel::ResourceGroup::GetResourceIndicesPerClass ( ) const
inline

Definition at line 533 of file routing.h.

◆ GetResources()

const std::vector< Resource > & operations_research::RoutingModel::ResourceGroup::GetResources ( ) const
inline

Definition at line 513 of file routing.h.

◆ GetResourcesMarkedAllowedForVehicle()

const absl::flat_hash_set< int > & operations_research::RoutingModel::ResourceGroup::GetResourcesMarkedAllowedForVehicle ( int vehicle) const
inline

Definition at line 502 of file routing.h.

◆ GetVehiclesRequiringAResource()

const std::vector< int > & operations_research::RoutingModel::ResourceGroup::GetVehiclesRequiringAResource ( ) const
inline

Definition at line 477 of file routing.h.

◆ Index()

int operations_research::RoutingModel::ResourceGroup::Index ( ) const
inline

Definition at line 552 of file routing.h.

◆ IsResourceAllowedForVehicle()

bool operations_research::RoutingModel::ResourceGroup::IsResourceAllowedForVehicle ( int resource,
int vehicle ) const
inline

Definition at line 507 of file routing.h.

◆ NotifyVehicleRequiresAResource()

void operations_research::ResourceGroup::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 1168 of file routing.cc.

◆ SetAllowedResourcesForVehicle()

void operations_research::RoutingModel::ResourceGroup::SetAllowedResourcesForVehicle ( int vehicle,
const std::vector< int > & allowed_resource_indices )
inline

Definition at line 485 of file routing.h.

◆ Size()

int operations_research::RoutingModel::ResourceGroup::Size ( ) const
inline

Definition at line 551 of file routing.h.

◆ VehicleRequiresAResource()

bool operations_research::RoutingModel::ResourceGroup::VehicleRequiresAResource ( int vehicle) const
inline

Definition at line 481 of file routing.h.

◆ RoutingModel

friend class RoutingModel
friend

Definition at line 585 of file routing.h.


The documentation for this class was generated from the following files: