Skip to content

Commit

Permalink
Adjusting custom statistics for unplanned stops and unplanned plan units
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerd committed Apr 22, 2024
1 parent 8f6caa0 commit 1ceddfd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 14 additions & 8 deletions factory/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,20 @@ func DefaultCustomResultStatistics(solution nextroute.Solution) schema.CustomRes
}
}

unplannedStops := common.MapSlice(
solution.UnPlannedPlanUnits().SolutionPlanUnits(),
toSolutionOutputStops,
)

return schema.CustomResultStatistics{
ActivatedVehicles: vehicleCount,
UnplannedStops: solution.UnPlannedPlanUnits().Size(),
MaxTravelDuration: maxTravelDuration,
MaxDuration: maxDuration,
MinTravelDuration: minTravelDuration,
MinDuration: minDuration,
MaxStopsInVehicle: maxStops,
MinStopsInVehicle: minStops,
ActivatedVehicles: vehicleCount,
UnplannedPlanUnits: solution.UnPlannedPlanUnits().Size(),
UnplannedStops: len(unplannedStops),
MaxTravelDuration: maxTravelDuration,
MaxDuration: maxDuration,
MinTravelDuration: minTravelDuration,
MinDuration: minDuration,
MaxStopsInVehicle: maxStops,
MinStopsInVehicle: minStops,
}
}
4 changes: 4 additions & 0 deletions schema/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ type CustomResultStatistics struct {
// UnplannedStops is the number of stops that were not planned in the
// solution.
UnplannedStops int `json:"unplanned_stops"`
// UnplannedPlanUnits is the number of plan units that were not planned in the
// solution. A plan unit can consist of multiple stops. e.g. a pickup and
// dropoff stop.
UnplannedPlanUnits int `json:"unplanned_units"`
// MaxTravelDuration is the maximum travel duration of a vehicle in the
// solution.
MaxTravelDuration int `json:"max_travel_duration"`
Expand Down

0 comments on commit 1ceddfd

Please sign in to comment.