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.dev/sumo
3 // Copyright (C) 2001-2024 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  bool isAllowed(const ROEdge* const edge) const;
139 
140  struct IterationEdge {
141  int depth;
143  };
144 
145 protected:
147  public:
150 
153 
155  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
156  return nod1.duration_2 > nod2.duration_2;
157  }
158  };
159 
160 private:
162  struct idComp {
163  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
164  return lhs->getID() < rhs->getID();
165  }
166  };
167 
169  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
170 
172  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
173 
174  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
175  mutable std::map<std::string, ROEdge*> myDetectorEdges;
176 
179 
181  std::vector<std::string> myDisallowedEdges;
182 
184 
186 
192 
193 };
long long int SUMOTime
Definition: GUI.h:35
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:33
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A container for RODFDetectors.
Definition: RODFDetector.h:216
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:155
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:152
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:149
A DFROUTER-network.
Definition: RODFNet.h:42
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:910
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:88
double myAvgSpeedFactorPKW
Definition: RODFNet.h:190
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:111
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:84
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:175
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:188
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:181
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:174
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:567
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:675
int myInBetweenNumber
Definition: RODFNet.h:178
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:640
bool myKeepTurnarounds
Definition: RODFNet.h:185
~RODFNet()
Destructor.
Definition: RODFNet.cpp:59
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1055
int mySinkNumber
Definition: RODFNet.h:178
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:98
int mySourceNumber
Definition: RODFNet.h:178
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:633
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:343
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:46
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:681
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1008
SUMOVehicleClass myAllowedVClass
Definition: RODFNet.h:183
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:581
bool isAllowed(const ROEdge *const edge) const
Definition: RODFNet.cpp:64
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:184
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:622
double myMaxSpeedFactorLKW
Definition: RODFNet.h:189
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:167
void buildApproachList()
Definition: RODFNet.cpp:73
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:169
bool myAmInHighwayMode
Definition: RODFNet.h:177
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:96
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:92
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:647
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:654
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:660
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:668
double myAvgSpeedFactorLKW
Definition: RODFNet.h:191
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:151
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:604
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:172
int myInvalidNumber
Definition: RODFNet.h:178
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:162
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:163
A route within the DFROUTER.
Definition: RODFRouteDesc.h:44
double duration_2
Definition: RODFRouteDesc.h:49