Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class VehicleTypeCurator
Note: This documentation is automatically generated.
Helper class that manages vehicles. This class is based on the
RoutingModel::VehicleTypeContainer that sorts and stores vehicles based on
their "type".
Arguments:
int type, std::function<bool(int)> vehicle_is_compatible,
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eVehicleTypeCurator\u003c/code\u003e is a helper class in C++ designed for managing and sorting vehicles within a routing model based on their type.\u003c/p\u003e\n"],["\u003cp\u003eIt provides functionalities to search for compatible vehicles of a specific type based on given criteria and to manage the pool of available vehicles.\u003c/p\u003e\n"],["\u003cp\u003eThe class can identify the vehicle with the lowest fixed cost within a given type.\u003c/p\u003e\n"],["\u003cp\u003eUsers can update and reset the collection of stored vehicles based on custom functions.\u003c/p\u003e\n"]]],["The `VehicleTypeCurator` class manages vehicles based on their type. Key actions include: finding compatible vehicles of a specific type (`GetCompatibleVehicleOfType`, `HasCompatibleVehicleOfType`), retrieving the lowest fixed-cost vehicle (`GetLowestFixedCostVehicleOfType`), and determining the number of vehicle types (`NumTypes`). It also supports vehicle removal and re-addition (`Update`, `ReinjectVehicleOfClass`) and resetting the stored vehicles based on a given condition (`Reset`). Vehicle types are also retrievable (`Type`).\n"],null,["# VehicleTypeCurator\n\nC++ Reference: class VehicleTypeCurator\n=======================================\n\n\nNote: This documentation is automatically generated.\nHelper class that manages vehicles. This class is based on the RoutingModel::VehicleTypeContainer that sorts and stores vehicles based on their \"type\".\n\n| Method ||\n|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`GetCompatibleVehicleOfType`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L107) | Return type: `std::pair\u003cint, int\u003e ` Arguments: ` int type, std::function\u003cbool(int)\u003e vehicle_is_compatible, std::function\u003cbool(int)\u003e 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. |\n| [`GetLowestFixedCostVehicleOfType`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L68) | Return type: `int ` Arguments: `int type` \u003cbr /\u003e |\n| [`HasCompatibleVehicleOfType`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L97) | Return type: `bool ` Arguments: ` int type, const std::function\u003cbool(int)\u003e& vehicle_is_compatible` Searches a compatible vehicle of the given type; returns false if none was found. |\n| [`NumTypes`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L56) | Return type: `int ` \u003cbr /\u003e |\n| [`ReinjectVehicleOfClass`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L80) | Return type: `void ` Arguments: `int vehicle, int vehicle_class, int64_t fixed_cost` \u003cbr /\u003e |\n| [`Reset`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L62) | Return type: `void ` Arguments: `const std::function\u003cbool(int)\u003e& store_vehicle` Resets the vehicles stored, storing only vehicles from the vehicle_type_container_ for which store_vehicle() returns true. |\n| [`Type`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L58) | Return type: `int ` Arguments: `int vehicle` \u003cbr /\u003e |\n| [`Update`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L66) | Return type: `void ` Arguments: `const std::function\u003cbool(int)\u003e& remove_vehicle` Goes through all the currently stored vehicles and removes vehicles for which remove_vehicle() returns true. |\n| [`VehicleTypeCurator`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_search.h#L52) | Return type: `explicit ` Arguments: ` const RoutingModel::VehicleTypeContainer& vehicle_type_container` \u003cbr /\u003e |"]]