SUMO - Simulation of Urban MObility
RODFNet.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A DFROUTER-network
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef RODFNet_h
23 #define RODFNet_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
36 #include <utils/common/StdDefs.h>
37 #include <utils/common/SUMOTime.h>
38 #include <router/ROEdge.h>
39 #include <router/RONet.h>
40 #include "RODFDetector.h"
41 #include "RODFRouteDesc.h"
42 #include "RODFRouteCont.h"
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class RODFNet : public RONet {
53 public:
57  RODFNet(bool amInHighwayMode);
58 
59 
61  ~RODFNet();
62 
63 
64  void buildApproachList();
65 
66  void computeTypes(RODFDetectorCon& dets,
67  bool sourcesStrict) const;
68  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
69  bool keepShortestOnly, int maxFollowingLength) const;
70  double getAbsPos(const RODFDetector& det) const;
71 
72  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
73  const RODFDetectorCon& detectors,
74  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
75 
76  void revalidateFlows(const RODFDetectorCon& detectors,
77  RODFDetectorFlows& flows,
78  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
79 
80 
81  void removeEmptyDetectors(RODFDetectorCon& detectors,
82  RODFDetectorFlows& flows);
83 
84  void reportEmptyDetectors(RODFDetectorCon& detectors,
85  RODFDetectorFlows& flows);
86 
88 
89  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
90 
91  bool hasDetector(ROEdge* edge) const;
92  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
93 
94  double getMaxSpeedFactorPKW() const {
95  return myMaxSpeedFactorPKW;
96  }
97 
98  double getMaxSpeedFactorLKW() const {
99  return myMaxSpeedFactorLKW;
100  }
101 
102  double getAvgSpeedFactorPKW() const {
103  return myAvgSpeedFactorPKW;
104  }
105 
106  double getAvgSpeedFactorLKW() const {
107  return myAvgSpeedFactorLKW;
108  }
109 
110 protected:
111  void revalidateFlows(const RODFDetector* detector,
112  RODFDetectorFlows& flows,
113  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
114  bool isSource(const RODFDetector& det,
115  const RODFDetectorCon& detectors, bool strict) const;
116  bool isFalseSource(const RODFDetector& det,
117  const RODFDetectorCon& detectors) const;
118  bool isDestination(const RODFDetector& det,
119  const RODFDetectorCon& detectors) const;
120 
121  ROEdge* getDetectorEdge(const RODFDetector& det) const;
122  bool isSource(const RODFDetector& det, ROEdge* edge,
123  ROEdgeVector& seen, const RODFDetectorCon& detectors,
124  bool strict) const;
125  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
126  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
127  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
128  const RODFDetectorCon& detectors) const;
129 
130  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
131  bool keepUnfoundEnds,
132  bool keepShortestOnly,
133  ROEdgeVector& visited, const RODFDetector& det,
134  RODFRouteCont& into, const RODFDetectorCon& detectors,
135  int maxFollowingLength,
136  ROEdgeVector& seen) const;
137 
139 
140  bool hasApproaching(ROEdge* edge) const;
141  bool hasApproached(ROEdge* edge) const;
142 
144  const RODFDetectorCon& detectors) const;
145  bool hasSourceDetector(ROEdge* edge,
146  const RODFDetectorCon& detectors) const;
147 
148  struct IterationEdge {
149  int depth;
151  };
152 
153 protected:
155  public:
158 
161 
163  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
164  return nod1.duration_2 > nod2.duration_2;
165  }
166  };
167 
168 private:
170  struct idComp {
171  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
172  return lhs->getID() < rhs->getID();
173  }
174  };
175 
177  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
178 
180  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
181 
182  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
183  mutable std::map<std::string, ROEdge*> myDetectorEdges;
184 
187 
189  std::vector<std::string> myDisallowedEdges;
190 
191 
193 
199 
200 };
201 
202 
203 #endif
204 
205 /****************************************************************************/
206 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1078
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:576
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:157
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:189
~RODFNet()
Destructor.
Definition: RODFNet.cpp:65
double myAvgSpeedFactorLKW
Definition: RODFNet.h:198
double myAvgSpeedFactorPKW
Definition: RODFNet.h:197
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:102
bool myKeepTurnarounds
Definition: RODFNet.h:192
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:692
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:684
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:114
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:180
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:613
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:94
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:661
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:676
int myInBetweenNumber
Definition: RODFNet.h:186
const std::string & getID() const
Returns the id.
Definition: Named.h:66
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:631
int mySourceNumber
Definition: RODFNet.h:186
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:228
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:160
double duration_2
Definition: RODFRouteDesc.h:59
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:170
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:98
int mySinkNumber
Definition: RODFNet.h:186
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:53
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:43
A DFROUTER-network.
Definition: RODFNet.h:52
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:670
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:171
void buildApproachList()
Definition: RODFNet.cpp:70
A route within the DFROUTER.
Definition: RODFRouteDesc.h:54
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:106
A basic edge for routing applications.
Definition: ROEdge.h:77
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:177
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:195
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:652
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:346
double myMaxSpeedFactorLKW
Definition: RODFNet.h:196
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:643
The router&#39;s network representation.
Definition: RONet.h:76
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:170
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:933
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:163
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1031
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:89
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:183
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:154
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:699
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:182
bool myAmInHighwayMode
Definition: RODFNet.h:185
long long int SUMOTime
Definition: TraCIDefs.h:52
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:187
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:590
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:101
int myInvalidNumber
Definition: RODFNet.h:186