Fixup cvrptw_lib::DisplayPlan

This commit is contained in:
Corentin Le Molgat
2018-09-06 17:26:36 +02:00
parent 0f907409cf
commit 3713802c85

View File

@@ -161,7 +161,8 @@ void DisplayPlan(
// Display dropped orders.
std::string dropped;
for (int order = 1; order < routing.nodes(); ++order) {
for (int64 order = 0; order < routing.Size(); ++order) {
if (routing.IsStart(order) || routing.IsEnd(order)) continue;
if (plan.Value(routing.NextVar(order)) == order) {
if (dropped.empty()) {
StringAppendF(&dropped, " %d", routing.IndexToNode(order).value());
@@ -178,12 +179,11 @@ void DisplayPlan(
int group_size = 0;
int64 group_same_vehicle_cost = 0;
std::set<int> visited;
const RoutingModel::NodeIndex kFirstNodeAfterDepot(1);
for (RoutingModel::NodeIndex order = kFirstNodeAfterDepot;
order < routing.nodes(); ++order) {
for (int64 order = 0; order < routing.Size(); ++order) {
if (routing.IsStart(order) || routing.IsEnd(order)) continue;
++group_size;
visited.insert(
plan.Value(routing.VehicleVar(routing.NodeToIndex(order))));
plan.Value(routing.VehicleVar(order)));
if (group_size == max_nodes_per_group) {
if (visited.size() > 1) {
group_same_vehicle_cost += (visited.size() - 1) * same_vehicle_cost;
@@ -227,7 +227,7 @@ void DisplayPlan(
plan.Max(time_var));
}
if (routing.IsEnd(order)) break;
else plan_output += " -> ";
plan_output += " -> ";
order = plan.Value(routing.NextVar(order));
}
plan_output += "\n";