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