routing: Fix VRP Initial solution samples (Fix #4111)
This commit is contained in:
@@ -149,7 +149,8 @@ public class InitialRoutes
|
||||
|
||||
// Solve the problem.
|
||||
// [START solve]
|
||||
Assignment solution = routing.SolveWithParameters(searchParameters);
|
||||
Assignment solution = routing.SolveFromAssignmentWithParameters(
|
||||
initialSolution, searchParameters);
|
||||
// [END solve]
|
||||
|
||||
// Print solution on console.
|
||||
|
||||
@@ -145,7 +145,8 @@ public class VrpInitialRoutes {
|
||||
|
||||
// Solve the problem.
|
||||
// [START solve]
|
||||
Assignment solution = routing.solveWithParameters(searchParameters);
|
||||
Assignment solution = routing.solveFromAssignmentWithParameters(
|
||||
initialSolution, searchParameters);
|
||||
// [END solve]
|
||||
|
||||
// Print solution on console.
|
||||
|
||||
@@ -88,6 +88,7 @@ struct DataModel {
|
||||
// [START solution_printer]
|
||||
void PrintSolution(const DataModel& data, const RoutingIndexManager& manager,
|
||||
const RoutingModel& routing, const Assignment& solution) {
|
||||
LOG(INFO) << "Objective: " << solution.ObjectiveValue();
|
||||
int64_t max_route_distance{0};
|
||||
for (int vehicle_id = 0; vehicle_id < data.num_vehicles; ++vehicle_id) {
|
||||
int64_t index = routing.Start(vehicle_id);
|
||||
|
||||
Reference in New Issue
Block a user