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-2015 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 
35 #include <router/RONet.h>
37 #include "RODFDetector.h"
38 #include "RODFRouteDesc.h"
39 #include "RODFRouteCont.h"
40 #include <utils/common/StdDefs.h>
41 #include <utils/common/SUMOTime.h>
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class RODFNet : public RONet {
52 public:
56  RODFNet(bool amInHighwayMode);
57 
58 
60  ~RODFNet();
61 
62 
63  void buildApproachList();
64 
65  void computeTypes(RODFDetectorCon& dets,
66  bool sourcesStrict) const;
67  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
68  bool keepShortestOnly, int maxFollowingLength) const;
69  SUMOReal getAbsPos(const RODFDetector& det) const;
70 
71  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
72  const RODFDetectorCon& detectors,
73  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
74 
75  void revalidateFlows(const RODFDetectorCon& detectors,
76  RODFDetectorFlows& flows,
77  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
78 
79 
80  void removeEmptyDetectors(RODFDetectorCon& detectors,
81  RODFDetectorFlows& flows);
82 
83  void reportEmptyDetectors(RODFDetectorCon& detectors,
84  RODFDetectorFlows& flows);
85 
87 
88  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
89 
90  bool hasDetector(ROEdge* edge) const;
91  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
92 
93 
94 protected:
95  void revalidateFlows(const RODFDetector* detector,
96  RODFDetectorFlows& flows,
97  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
98  bool isSource(const RODFDetector& det,
99  const RODFDetectorCon& detectors, bool strict) const;
100  bool isFalseSource(const RODFDetector& det,
101  const RODFDetectorCon& detectors) const;
102  bool isDestination(const RODFDetector& det,
103  const RODFDetectorCon& detectors) const;
104 
105  ROEdge* getDetectorEdge(const RODFDetector& det) const;
106  bool isSource(const RODFDetector& det, ROEdge* edge,
107  ROEdgeVector& seen, const RODFDetectorCon& detectors,
108  bool strict) const;
109  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
110  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
111  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
112  const RODFDetectorCon& detectors) const;
113 
114  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
115  bool keepUnfoundEnds,
116  bool keepShortestOnly,
117  ROEdgeVector& visited, const RODFDetector& det,
118  RODFRouteCont& into, const RODFDetectorCon& detectors,
119  int maxFollowingLength,
120  ROEdgeVector& seen) const;
121 
123 
124  bool hasApproaching(ROEdge* edge) const;
125  bool hasApproached(ROEdge* edge) const;
126 
128  const RODFDetectorCon& detectors) const;
129  bool hasSourceDetector(ROEdge* edge,
130  const RODFDetectorCon& detectors) const;
131 
132  struct IterationEdge {
133  int depth;
135  };
136 
137 protected:
139  public:
142 
145 
147  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
148  return nod1.duration_2 > nod2.duration_2;
149  }
150  };
151 
152 private:
154  struct idComp {
155  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
156  return lhs->getID() < rhs->getID();
157  }
158  };
159 
161  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
162 
164  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
165 
166  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
167  mutable std::map<std::string, ROEdge*> myDetectorEdges;
168 
171 
173  std::vector<std::string> myDisallowedEdges;
174 
175 
177 
178 };
179 
180 
181 #endif
182 
183 /****************************************************************************/
184 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1053
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:575
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:141
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:173
~RODFNet()
Destructor.
Definition: RODFNet.cpp:64
long long int SUMOTime
Definition: SUMOTime.h:43
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:153
size_t mySourceNumber
Definition: RODFNet.h:170
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:630
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:691
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:155
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:683
bool myKeepTurnarounds
Definition: RODFNet.h:176
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:164
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:612
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:113
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:169
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:227
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:660
SUMOReal getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:675
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:144
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:345
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:154
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:698
const std::string & getID() const
Returns the id.
Definition: Named.h:65
size_t myInvalidNumber
Definition: RODFNet.h:170
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:642
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:56
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:43
A DFROUTER-network.
Definition: RODFNet.h:51
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:669
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:100
void buildApproachList()
Definition: RODFNet.cpp:69
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:186
A route within the DFROUTER.
Definition: RODFRouteDesc.h:54
A basic edge for routing applications.
Definition: ROEdge.h:73
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:161
The router&#39;s network representation.
Definition: RONet.h:72
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:933
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1006
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:88
size_t mySinkNumber
Definition: RODFNet.h:170
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:167
SUMOReal duration_2
Definition: RODFRouteDesc.h:59
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:651
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:166
#define SUMOReal
Definition: config.h:214
bool myAmInHighwayMode
Definition: RODFNet.h:169
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:589
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:147
size_t myInBetweenNumber
Definition: RODFNet.h:170