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.
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.
[[["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\u003eResourceAssignmentOptimizer\u003c/code\u003e class facilitates the optimal assignment of resources to vehicles within a routing problem.\u003c/p\u003e\n"],["\u003cp\u003eIt leverages cost computations and optimization techniques to determine the most efficient assignment strategy.\u003c/p\u003e\n"],["\u003cp\u003eThe class offers methods for calculating assignment costs, determining the best assignment, and accessing relevant routing dimensions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eComputeAssignmentCostsForVehicle\u003c/code\u003e method calculates the cost of assigning a resource to a given vehicle.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eComputeBestAssignmentCost\u003c/code\u003e method aims to find the assignment with the lowest total cost.\u003c/p\u003e\n"]]],["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,["# ResourceAssignmentOptimizer\n\nC++ Reference: class ResourceAssignmentOptimizer\n================================================\n\n\nNote: This documentation is automatically generated.\n\n| Method ||\n|-------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`ComputeAssignmentCostsForVehicle`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_lp_scheduling.h#L878) | Return type: `bool ` Arguments: ` int v, const std::function\u003cint64_t(int64_t)\u003e& next_accessor, const std::function\u003cint64_t(int64_t, int64_t)\u003e& transit_accessor, bool optimize_vehicle_costs, std::vector\u003cint64_t\u003e* assignment_costs, std::vector\u003cstd::vector\u003cint64_t\u003e\u003e* cumul_values, std::vector\u003cstd::vector\u003cint64_t\u003e\u003e* 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. |\n| [`ComputeBestAssignmentCost`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_lp_scheduling.h#L862) | Return type: `int64_t ` Arguments: ` const std::vector\u003cstd::vector\u003cint64_t\u003e\u003e& primary_vehicle_to_resource_assignment_costs, const std::vector\u003cstd::vector\u003cint64_t\u003e\u003e& secondary_vehicle_to_resource_assignment_costs, const std::function\u003cbool(int)\u003e& use_primary_for_vehicle, std::vector\u003cint\u003e* 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. |\n| [`dimension`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_lp_scheduling.h#L885) | Return type: `const RoutingDimension* const ` \u003cbr /\u003e |\n| [`ResourceAssignmentOptimizer`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_lp_scheduling.h#L848) | \u003cbr /\u003e Arguments: `const RoutingModel::ResourceGroup* resource_group, LocalDimensionCumulOptimizer* optimizer, LocalDimensionCumulOptimizer* mp_optimizer` \u003cbr /\u003e |"]]