Review fixes.

This commit is contained in:
Vladimir Byko-Ianko 2019-01-24 14:41:33 +03:00 committed by Vlad Mihaylenko
parent 18e3eaecce
commit 2477bc30b0
3 changed files with 14 additions and 11 deletions

View file

@ -17,7 +17,7 @@ using namespace traffic;
namespace
{
feature::TAltitude constexpr mountainSicknessAltitudeM = 3000;
feature::TAltitude constexpr kMountainSicknessAltitudeM = 2500;
enum class Purpose
{
@ -52,10 +52,12 @@ double GetPedestrianClimbPenalty(double tangent, feature::TAltitude altitudeM)
return 1.0 + 2.0 * (-tangent);
// Climb.
if (altitudeM < mountainSicknessAltitudeM)
return 1.0 + 10.0 * tangent;
else
return 1.0 + 30.0 * tangent;
// The upper the penalty is more:
// |1 + 10 * tangent| for altitudes lower than |kMountainSicknessAltitudeM|
// |1 + 20 * tangent| for 4000 meters
// |1 + 30 * tangent| for 5500 meters
// |1 + 40 * tangent| for 7000 meters
return 1.0 + (10.0 + max(0, altitudeM - kMountainSicknessAltitudeM) * 10.0 / 1500) * tangent;
}
double GetBicycleClimbPenalty(double tangent, feature::TAltitude altitudeM)
@ -64,10 +66,10 @@ double GetBicycleClimbPenalty(double tangent, feature::TAltitude altitudeM)
return 1.0;
// Climb.
if (altitudeM < mountainSicknessAltitudeM)
if (altitudeM < kMountainSicknessAltitudeM)
return 1.0 + 30.0 * tangent;
else
return 1.0 + 50.0 * tangent;
return 1.0 + 50.0 * tangent;
}
double GetCarClimbPenalty(double /* tangent */, feature::TAltitude /* altitude */) { return 1.0; }

View file

@ -473,7 +473,8 @@ RouterResultCode IndexRouter::DoCalculateRoute(Checkpoints const & checkpoints,
if (redressResult != RouterResultCode::NoError)
return redressResult;
LOG(LINFO, ("Route length:", route.GetTotalDistanceMeters()));
LOG(LINFO, ("Route length:", route.GetTotalDistanceMeters(), "meters. ETA:",
route.GetTotalTimeSec(), "seconds."));
m_lastRoute = make_unique<SegmentedRoute>(checkpoints.GetStart(), checkpoints.GetFinish(),
route.GetSubroutes());

View file

@ -512,7 +512,7 @@ UNIT_TEST(RussiaPriut11Elbrus)
integration::CalculateRouteAndTestRouteTime(
integration::GetVehicleComponents<VehicleType::Pedestrian>(),
MercatorBounds::FromLatLon(43.31475, 42.46035), {0., 0.},
MercatorBounds::FromLatLon(43.35254, 42.43788), 37300.8 /* expectedTimeSeconds */);
MercatorBounds::FromLatLon(43.35254, 42.43788), 32588.6 /* expectedTimeSeconds */);
}
// Test on going down from Elbrus mountain to Priut11.
@ -521,5 +521,5 @@ UNIT_TEST(RussiaElbrusPriut11)
integration::CalculateRouteAndTestRouteTime(
integration::GetVehicleComponents<VehicleType::Pedestrian>(),
MercatorBounds::FromLatLon(43.35254, 42.43788), {0., 0.},
MercatorBounds::FromLatLon(43.31475, 42.46035), 5980.33 /* expectedTimeSeconds */);
MercatorBounds::FromLatLon(43.31475, 42.46035), 5998.61 /* expectedTimeSeconds */);
}