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-2016 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  SUMOReal 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 
95 protected:
96  void revalidateFlows(const RODFDetector* detector,
97  RODFDetectorFlows& flows,
98  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
99  bool isSource(const RODFDetector& det,
100  const RODFDetectorCon& detectors, bool strict) const;
101  bool isFalseSource(const RODFDetector& det,
102  const RODFDetectorCon& detectors) const;
103  bool isDestination(const RODFDetector& det,
104  const RODFDetectorCon& detectors) const;
105 
106  ROEdge* getDetectorEdge(const RODFDetector& det) const;
107  bool isSource(const RODFDetector& det, ROEdge* edge,
108  ROEdgeVector& seen, const RODFDetectorCon& detectors,
109  bool strict) const;
110  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
111  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
112  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
113  const RODFDetectorCon& detectors) const;
114 
115  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
116  bool keepUnfoundEnds,
117  bool keepShortestOnly,
118  ROEdgeVector& visited, const RODFDetector& det,
119  RODFRouteCont& into, const RODFDetectorCon& detectors,
120  int maxFollowingLength,
121  ROEdgeVector& seen) const;
122 
124 
125  bool hasApproaching(ROEdge* edge) const;
126  bool hasApproached(ROEdge* edge) const;
127 
129  const RODFDetectorCon& detectors) const;
130  bool hasSourceDetector(ROEdge* edge,
131  const RODFDetectorCon& detectors) const;
132 
133  struct IterationEdge {
134  int depth;
136  };
137 
138 protected:
140  public:
143 
146 
148  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
149  return nod1.duration_2 > nod2.duration_2;
150  }
151  };
152 
153 private:
155  struct idComp {
156  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
157  return lhs->getID() < rhs->getID();
158  }
159  };
160 
162  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
163 
165  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
166 
167  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
168  mutable std::map<std::string, ROEdge*> myDetectorEdges;
169 
172 
174  std::vector<std::string> myDisallowedEdges;
175 
176 
178 
179 };
180 
181 
182 #endif
183 
184 /****************************************************************************/
185 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1054
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:576
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:142
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:174
~RODFNet()
Destructor.
Definition: RODFNet.cpp:65
long long int SUMOTime
Definition: SUMOTime.h:43
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:154
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:631
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:692
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:156
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:684
bool myKeepTurnarounds
Definition: RODFNet.h:177
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:165
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:613
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:114
int myInBetweenNumber
Definition: RODFNet.h:171
int mySourceNumber
Definition: RODFNet.h:171
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:170
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:227
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:661
SUMOReal getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:676
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:145
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:346
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:155
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:699
const std::string & getID() const
Returns the id.
Definition: Named.h:66
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:643
int mySinkNumber
Definition: RODFNet.h:171
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:57
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
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:101
void buildApproachList()
Definition: RODFNet.cpp:70
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
A route within the DFROUTER.
Definition: RODFRouteDesc.h:54
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:162
The router&#39;s network representation.
Definition: RONet.h:76
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:934
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1007
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:88
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:168
SUMOReal duration_2
Definition: RODFRouteDesc.h:59
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:652
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:167
#define SUMOReal
Definition: config.h:213
bool myAmInHighwayMode
Definition: RODFNet.h:170
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:590
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:148
int myInvalidNumber
Definition: RODFNet.h:171