Eclipse SUMO - Simulation of Urban MObility
RODFNet.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // A DFROUTER-network
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
26 #include <utils/common/StdDefs.h>
27 #include <utils/common/SUMOTime.h>
28 #include <router/ROEdge.h>
29 #include <router/RONet.h>
30 #include "RODFDetector.h"
31 #include "RODFRouteDesc.h"
32 #include "RODFRouteCont.h"
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
42 class RODFNet : public RONet {
43 public:
47  RODFNet(bool amInHighwayMode);
48 
49 
51  ~RODFNet();
52 
53 
54  void buildApproachList();
55 
56  void computeTypes(RODFDetectorCon& dets,
57  bool sourcesStrict) const;
58  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
59  bool keepShortestOnly, int maxFollowingLength) const;
60  double getAbsPos(const RODFDetector& det) const;
61 
62  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
63  const RODFDetectorCon& detectors,
64  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
65 
66  void revalidateFlows(const RODFDetectorCon& detectors,
67  RODFDetectorFlows& flows,
68  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
69 
70 
71  void removeEmptyDetectors(RODFDetectorCon& detectors,
72  RODFDetectorFlows& flows);
73 
74  void reportEmptyDetectors(RODFDetectorCon& detectors,
75  RODFDetectorFlows& flows);
76 
78 
79  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
80 
81  bool hasDetector(ROEdge* edge) const;
82  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
83 
84  double getMaxSpeedFactorPKW() const {
85  return myMaxSpeedFactorPKW;
86  }
87 
88  double getMaxSpeedFactorLKW() const {
89  return myMaxSpeedFactorLKW;
90  }
91 
92  double getAvgSpeedFactorPKW() const {
93  return myAvgSpeedFactorPKW;
94  }
95 
96  double getAvgSpeedFactorLKW() const {
97  return myAvgSpeedFactorLKW;
98  }
99 
100 protected:
101  void revalidateFlows(const RODFDetector* detector,
102  RODFDetectorFlows& flows,
103  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
104  bool isSource(const RODFDetector& det,
105  const RODFDetectorCon& detectors, bool strict) const;
106  bool isFalseSource(const RODFDetector& det,
107  const RODFDetectorCon& detectors) const;
108  bool isDestination(const RODFDetector& det,
109  const RODFDetectorCon& detectors) const;
110 
111  ROEdge* getDetectorEdge(const RODFDetector& det) const;
112  bool isSource(const RODFDetector& det, ROEdge* edge,
113  ROEdgeVector& seen, const RODFDetectorCon& detectors,
114  bool strict) const;
115  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
116  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
117  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
118  const RODFDetectorCon& detectors) const;
119 
120  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
121  bool keepUnfoundEnds,
122  bool keepShortestOnly,
123  ROEdgeVector& visited, const RODFDetector& det,
124  RODFRouteCont& into, const RODFDetectorCon& detectors,
125  int maxFollowingLength,
126  ROEdgeVector& seen) const;
127 
129 
130  bool hasApproaching(ROEdge* edge) const;
131  bool hasApproached(ROEdge* edge) const;
132 
134  const RODFDetectorCon& detectors) const;
135  bool hasSourceDetector(ROEdge* edge,
136  const RODFDetectorCon& detectors) const;
137 
138  struct IterationEdge {
139  int depth;
141  };
142 
143 protected:
145  public:
148 
151 
153  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
154  return nod1.duration_2 > nod2.duration_2;
155  }
156  };
157 
158 private:
160  struct idComp {
161  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
162  return lhs->getID() < rhs->getID();
163  }
164  };
165 
167  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
168 
170  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
171 
172  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
173  mutable std::map<std::string, ROEdge*> myDetectorEdges;
174 
177 
179  std::vector<std::string> myDisallowedEdges;
180 
181 
183 
189 
190 };
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:33
long long int SUMOTime
Definition: SUMOTime.h:31
const std::string & getID() const
Returns the id.
Definition: Named.h:73
A container for RODFDetectors.
Definition: RODFDetector.h:218
A container for flows.
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:79
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:153
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:150
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:147
A DFROUTER-network.
Definition: RODFNet.h:42
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:922
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:88
double myAvgSpeedFactorPKW
Definition: RODFNet.h:187
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:109
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:84
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:173
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:185
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:179
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:172
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:565
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:681
int myInBetweenNumber
Definition: RODFNet.h:176
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:641
bool myKeepTurnarounds
Definition: RODFNet.h:182
~RODFNet()
Destructor.
Definition: RODFNet.cpp:58
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1067
int mySinkNumber
Definition: RODFNet.h:176
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:96
int mySourceNumber
Definition: RODFNet.h:176
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:632
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:341
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:46
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:688
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1020
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:579
void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, ROEdgeVector &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, ROEdgeVector &seen) const
Definition: RODFNet.cpp:182
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:620
double myMaxSpeedFactorLKW
Definition: RODFNet.h:186
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:165
void buildApproachList()
Definition: RODFNet.cpp:63
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:167
bool myAmInHighwayMode
Definition: RODFNet.h:175
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:96
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:92
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:650
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:659
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:665
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:673
double myAvgSpeedFactorLKW
Definition: RODFNet.h:188
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:149
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:602
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:170
int myInvalidNumber
Definition: RODFNet.h:176
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:53
A basic edge for routing applications.
Definition: ROEdge.h:70
The router's network representation.
Definition: RONet.h:62
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable
Definition: RODFNet.h:160
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:161
A route within the DFROUTER.
Definition: RODFRouteDesc.h:44
double duration_2
Definition: RODFRouteDesc.h:49