1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2004-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file ROJTREdge.h 11 /// @author Daniel Krajzewicz 12 /// @author Michael Behrisch 13 /// @author Yun-Pang Floetteroed 14 /// @date Tue, 20 Jan 2004 15 /// @version $Id$ 16 /// 17 // An edge the jtr-router may route through 18 /****************************************************************************/ 19 #ifndef ROJTREdge_h 20 #define ROJTREdge_h 21 22 23 // =========================================================================== 24 // included modules 25 // =========================================================================== 26 #include <config.h> 27 28 #include <string> 29 #include <map> 30 #include <vector> 31 #include <utils/common/ValueTimeLine.h> 32 #include <router/ROEdge.h> 33 34 35 // =========================================================================== 36 // class declarations 37 // =========================================================================== 38 class ROLane; 39 40 41 // =========================================================================== 42 // class definitions 43 // =========================================================================== 44 /** 45 * @class ROJTREdge 46 * @brief An edge the jtr-router may route through 47 * 48 * A router edge extended by the definition about the probability a 49 * vehicle chooses a certain following edge over time. 50 */ 51 class ROJTREdge : public ROEdge { 52 public: 53 /** @brief Constructor 54 * 55 * @param[in] id The id of the edge 56 * @param[in] from The node the edge begins at 57 * @param[in] to The node the edge ends at 58 * @param[in] index The numeric id of the edge 59 */ 60 ROJTREdge(const std::string& id, RONode* from, RONode* to, int index, const int priority); 61 62 63 /// @brief Destructor 64 ~ROJTREdge(); 65 66 67 /** @brief Adds information about a connected edge 68 * 69 * Makes this edge know the given following edge. Calls ROEdge::addFollower. 70 * 71 * Additionally it generates the entry for the given following edge 72 * in myFollowingDefs. 73 * 74 * @param[in] s The following edge 75 * @see ROEdge::addFollower 76 */ 77 void addSuccessor(ROEdge* s, ROEdge* via = nullptr, std::string dir = ""); 78 79 80 /** @brief adds the information about the percentage of using a certain follower 81 * 82 * @param[in] follower The following edge 83 * @param[in] begTime Time begin (in seconds) for which this probability is valid 84 * @param[in] endTime Time end (in seconds) for which this probability is valid 85 * @param[in] probability The probability to use the given follower 86 */ 87 void addFollowerProbability(ROJTREdge* follower, 88 double begTime, double endTime, double probability); 89 90 91 /** @brief Returns the next edge to use 92 * @param[in] veh The vehicle to choose the next edge for 93 * @param[in] time The time at which the next edge shall be entered (in seconds) 94 * @param[in] avoid The set of edges to avoid 95 * @return The chosen edge 96 */ 97 ROJTREdge* chooseNext(const ROVehicle* const veh, double time, const std::set<const ROEdge*>& avoid) const; 98 99 100 /** @brief Sets the turning definition defaults 101 * @param[in] def The turning percentage defaults 102 */ 103 void setTurnDefaults(const std::vector<double>& defs); 104 105 106 private: 107 /// @brief Definition of a map that stores the probabilities of using a certain follower over time 108 typedef std::map<ROJTREdge*, ValueTimeLine<double>*, ComparatorIdLess> FollowerUsageCont; 109 110 /// @brief Storage for the probabilities of using a certain follower over time 111 FollowerUsageCont myFollowingDefs; 112 113 /// @brief The defaults for turnings 114 std::vector<double> myParsedTurnings; 115 116 117 private: 118 /// @brief invalidated copy constructor 119 ROJTREdge(const ROJTREdge& src); 120 121 /// @brief invalidated assignment operator 122 ROJTREdge& operator=(const ROJTREdge& src); 123 124 125 }; 126 127 128 #endif 129 130 /****************************************************************************/ 131 132