Add stoppage penalty - consider acceleration and braking time, which can dominate short route ETAs.

This commit is contained in:
Kevin Kreiser
2019-02-07 10:24:58 -05:00
committed by Daniel Patterson
parent 6c37b71046
commit 05647adcc6
22 changed files with 590 additions and 173 deletions
+11 -2
View File
@@ -81,6 +81,8 @@ struct BaseParameters
bool generate_hints = true;
SnappingType snapping = SnappingType::Default;
double min_stoppage_penalty = INVALID_MINIMUM_STOPPAGE_PENALTY;
double max_stoppage_penalty = INVALID_MAXIMUM_STOPPAGE_PENALTY;
BaseParameters(const std::vector<util::Coordinate> coordinates_ = {},
const std::vector<boost::optional<Hint>> hints_ = {},
@@ -89,16 +91,23 @@ struct BaseParameters
std::vector<boost::optional<Approach>> approaches_ = {},
bool generate_hints_ = true,
std::vector<std::string> exclude = {},
const SnappingType snapping_ = SnappingType::Default)
const SnappingType snapping_ = SnappingType::Default,
double min_stoppage_penalty_ = INVALID_MINIMUM_STOPPAGE_PENALTY,
double max_stoppage_penalty_ = INVALID_MAXIMUM_STOPPAGE_PENALTY)
: coordinates(coordinates_), hints(hints_), radiuses(radiuses_), bearings(bearings_),
approaches(approaches_), exclude(std::move(exclude)), generate_hints(generate_hints_),
snapping(snapping_)
snapping(snapping_), min_stoppage_penalty(min_stoppage_penalty_),
max_stoppage_penalty(max_stoppage_penalty_)
{
}
// FIXME add validation for invalid bearing values
bool IsValid() const
{
if (min_stoppage_penalty <= 0 || max_stoppage_penalty <= 0 ||
min_stoppage_penalty > max_stoppage_penalty)
return false;
return (hints.empty() || hints.size() == coordinates.size()) &&
(bearings.empty() || bearings.size() == coordinates.size()) &&
(radiuses.empty() || radiuses.size() == coordinates.size()) &&
+3 -5
View File
@@ -78,7 +78,6 @@ struct TableParameters : public BaseParameters
};
AnnotationsType annotations = AnnotationsType::Duration;
double scale_factor = 1;
TableParameters() = default;
@@ -113,7 +112,6 @@ struct TableParameters : public BaseParameters
destinations{std::move(destinations_)}, fallback_speed{fallback_speed_},
fallback_coordinate_type{fallback_coordinate_type_}, annotations{annotations_},
scale_factor{scale_factor_}
{
}
@@ -166,8 +164,8 @@ inline TableParameters::AnnotationsType &operator|=(TableParameters::Annotations
{
return lhs = lhs | rhs;
}
}
}
}
} // namespace api
} // namespace engine
} // namespace osrm
#endif // ENGINE_API_TABLE_PARAMETERS_HPP