Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class ResourceAssignmentOptimizer
Note: This documentation is automatically generated.
Method |
ComputeAssignmentCostsForVehicle | Return type: bool Arguments:
int v, const std::function<int64_t(int64_t)>& next_accessor,
const std::function<int64_t(int64_t, int64_t)>& transit_accessor,
bool optimize_vehicle_costs, std::vector<int64_t>* assignment_costs,
std::vector<std::vector<int64_t>>* cumul_values,
std::vector<std::vector<int64_t>>* break_values Computes the vehicle-to-resource assignment costs for the given vehicle to
all resources in the group, and sets these costs in assignment_costs (if
non-null).
optimize_vehicle_costs indicates if the costs should be optimized or if
we merely care about feasibility (cost of 0) and infeasibility (cost of -1)
of the assignments.
The cumul and break values corresponding to the assignment of each resource
are also set in cumul_values and break_values, if non-null.
|
ComputeBestAssignmentCost | Return type: int64_t Arguments:
const std::vector<std::vector<int64_t>>&
primary_vehicle_to_resource_assignment_costs,
const std::vector<std::vector<int64_t>>&
secondary_vehicle_to_resource_assignment_costs,
const std::function<bool(int)>& use_primary_for_vehicle,
std::vector<int>* resource_indices Returns the cost resulting from the min-cost assignment of resources to
(used) vehicles, or -1 if the assignment is impossible.
For each vehicle v and resource r, the cost of assigning r to v is equal to
- primary_vehicle_to_resource_assignment_costs[v][r] if
primary_vehicle_to_resource_assignment_costs[v] is not empty,
- secondary_vehicle_to_resource_assignment_costs[v][r] otherwise
(secondary_vehicle_to_resource_assignment_costs[v] can never be empty).
If non-null, 'resource_indices' contains the index of the resource assigned
to each vehicle.
TODO(user): Return std::optional to catch infeasibilities.
|
dimension | Return type: const RoutingDimension* const |
ResourceAssignmentOptimizer | Arguments: const RoutingModel::ResourceGroup* resource_group,
LocalDimensionCumulOptimizer* optimizer,
LocalDimensionCumulOptimizer* mp_optimizer |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[],["The `ResourceAssignmentOptimizer` class provides methods for managing resource-to-vehicle assignments. `ComputeAssignmentCostsForVehicle` calculates the cost of assigning a vehicle to each resource, determining feasibility and storing costs, cumul, and break values. `ComputeBestAssignmentCost` finds the minimum-cost assignment of resources to vehicles, using primary or secondary assignment cost vectors, returning -1 if impossible. The class also holds a `dimension` object, and the constructor `ResourceAssignmentOptimizer` initializes it with a resource group and optimizers.\n"],null,[]]