compress traffic signals
- handle penalties within edges (not phantom nodes) - changes model from providing penalties on turns to using additional segments
This commit is contained in:
@@ -103,14 +103,17 @@ SegmentDuration CompressedEdgeContainer::ClipDuration(const SegmentDuration dura
|
||||
// ----------> via_node_id -----------> target_node_id
|
||||
// weight_1 weight_2
|
||||
// duration_1 duration_2
|
||||
void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
const EdgeID edge_id_2,
|
||||
const NodeID via_node_id,
|
||||
const NodeID target_node_id,
|
||||
const EdgeWeight weight1,
|
||||
const EdgeWeight weight2,
|
||||
const EdgeDuration duration1,
|
||||
const EdgeDuration duration2)
|
||||
void CompressedEdgeContainer::CompressEdge(
|
||||
const EdgeID edge_id_1,
|
||||
const EdgeID edge_id_2,
|
||||
const NodeID via_node_id,
|
||||
const NodeID target_node_id,
|
||||
const EdgeWeight weight1,
|
||||
const EdgeWeight weight2,
|
||||
const EdgeDuration duration1,
|
||||
const EdgeDuration duration2,
|
||||
const boost::optional<EdgeWeight> node_weight_penalty,
|
||||
const boost::optional<EdgeDuration> node_duration_penalty)
|
||||
{
|
||||
// remove super-trivial geometries
|
||||
BOOST_ASSERT(SPECIAL_EDGEID != edge_id_1);
|
||||
@@ -151,9 +154,11 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
std::vector<OnewayCompressedEdge> &edge_bucket_list1 =
|
||||
m_compressed_oneway_geometries[edge_bucket_id1];
|
||||
|
||||
bool was_empty = edge_bucket_list1.empty();
|
||||
|
||||
// note we don't save the start coordinate: it is implicitly given by edge 1
|
||||
// weight1 is the distance to the (currently) last coordinate in the bucket
|
||||
if (edge_bucket_list1.empty())
|
||||
if (was_empty)
|
||||
{
|
||||
edge_bucket_list1.emplace_back(
|
||||
OnewayCompressedEdge{via_node_id, ClipWeight(weight1), ClipDuration(duration1)});
|
||||
@@ -162,6 +167,14 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
BOOST_ASSERT(0 < edge_bucket_list1.size());
|
||||
BOOST_ASSERT(!edge_bucket_list1.empty());
|
||||
|
||||
// if the via-node offers a penalty, we add the weight of the penalty as an artificial
|
||||
// segment that references SPECIAL_NODEID
|
||||
if (node_weight_penalty && node_duration_penalty)
|
||||
{
|
||||
edge_bucket_list1.emplace_back(OnewayCompressedEdge{
|
||||
via_node_id, ClipWeight(*node_weight_penalty), ClipDuration(*node_duration_penalty)});
|
||||
}
|
||||
|
||||
if (HasEntryForID(edge_id_2))
|
||||
{
|
||||
// second edge is not atomic anymore
|
||||
|
||||
Reference in New Issue
Block a user