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

#include <routing_search.h>

Public Member Functions

 VehicleTypeCurator (const RoutingModel::VehicleTypeContainer &vehicle_type_container)
 
int NumTypes () const
 
int Type (int vehicle) const
 
void Reset (const std::function< bool(int)> &store_vehicle)
 VehicleTypeCurator
 
void Update (const std::function< bool(int)> &remove_vehicle)
 
int GetLowestFixedCostVehicleOfType (int type) const
 
void ReinjectVehicleOfClass (int vehicle, int vehicle_class, int64_t fixed_cost)
 
bool HasCompatibleVehicleOfType (int type, const std::function< bool(int)> &vehicle_is_compatible) const
 
std::pair< int, int > GetCompatibleVehicleOfType (int type, const std::function< bool(int)> &vehicle_is_compatible, const std::function< bool(int)> &stop_and_return_vehicle)
 

Detailed Description

Helper class that manages vehicles. This class is based on the RoutingModel::VehicleTypeContainer that sorts and stores vehicles based on their "type".

Definition at line 56 of file routing_search.h.

Constructor & Destructor Documentation

◆ VehicleTypeCurator()

operations_research::VehicleTypeCurator::VehicleTypeCurator ( const RoutingModel::VehicleTypeContainer & vehicle_type_container)
inlineexplicit

Definition at line 58 of file routing_search.h.

Member Function Documentation

◆ GetCompatibleVehicleOfType()

std::pair< int, int > operations_research::VehicleTypeCurator::GetCompatibleVehicleOfType ( int type,
const std::function< bool(int)> & vehicle_is_compatible,
const std::function< bool(int)> & stop_and_return_vehicle )

Searches for the best compatible vehicle of the given type, i.e. the first vehicle v of type 'type' for which vehicle_is_compatible(v) returns true. If a compatible vehicle is found, its index is removed from vehicles_per_vehicle_class_ and the function returns {vehicle, -1}. If for some vehicle 'stop_and_return_vehicle' returns true before a compatible vehicle is found, the function simply returns {-1, vehicle}. Returns {-1, -1} if no compatible vehicle is found and the stopping condition is never met.

If no compatible vehicle was found in this class, move on to the next vehicle class.

No compatible vehicle of the given type was found and the stopping condition wasn't met.

Definition at line 141 of file routing_search.cc.

◆ GetLowestFixedCostVehicleOfType()

int operations_research::VehicleTypeCurator::GetLowestFixedCostVehicleOfType ( int type) const
inline

Definition at line 74 of file routing_search.h.

◆ HasCompatibleVehicleOfType()

bool operations_research::VehicleTypeCurator::HasCompatibleVehicleOfType ( int type,
const std::function< bool(int)> & vehicle_is_compatible ) const

Searches a compatible vehicle of the given type; returns false if none was found.

Definition at line 129 of file routing_search.cc.

◆ NumTypes()

int operations_research::VehicleTypeCurator::NumTypes ( ) const
inline

Definition at line 62 of file routing_search.h.

◆ ReinjectVehicleOfClass()

void operations_research::VehicleTypeCurator::ReinjectVehicleOfClass ( int vehicle,
int vehicle_class,
int64_t fixed_cost )
inline

Add the vehicle class entry to the set (it was removed when vehicles_per_vehicle_class_[vehicle_class] got empty).

Definition at line 86 of file routing_search.h.

◆ Reset()

void operations_research::VehicleTypeCurator::Reset ( const std::function< bool(int)> & store_vehicle)

VehicleTypeCurator

Resets the vehicles stored, storing only vehicles from the vehicle_type_container_ for which store_vehicle() returns true.

Definition at line 78 of file routing_search.cc.

◆ Type()

int operations_research::VehicleTypeCurator::Type ( int vehicle) const
inline

Definition at line 64 of file routing_search.h.

◆ Update()

void operations_research::VehicleTypeCurator::Update ( const std::function< bool(int)> & remove_vehicle)

Goes through all the currently stored vehicles and removes vehicles for which remove_vehicle() returns true.

Definition at line 107 of file routing_search.cc.


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