45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
80 if (roadClass == 0 || roadClass == 1) {
82 }
else if (roadClass == 2 && edge->
getSpeed() <= 11.) {
84 }
else if (roadClass == 2 && edge->
getSpeed() > 11. && edge->
getSpeed() <= 16.) {
86 }
else if (roadClass == 2 && edge->
getSpeed() > 16.) {
88 }
else if (roadClass == 3 && edge->
getSpeed() <= 11.) {
90 }
else if (roadClass == 3 && edge->
getSpeed() > 11. && edge->
getSpeed() <= 13.) {
92 }
else if (roadClass == 3 && edge->
getSpeed() > 13. && edge->
getSpeed() <= 16.) {
94 }
else if (roadClass == 3 && edge->
getSpeed() > 16.) {
96 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() <= 5.) {
98 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 5. && edge->
getSpeed() <= 7.) {
100 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 7. && edge->
getSpeed() <= 9.) {
102 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 9. && edge->
getSpeed() <= 11.) {
104 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 11. && edge->
getSpeed() <= 13.) {
106 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 13. && edge->
getSpeed() <= 16.) {
108 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 16. && edge->
getSpeed() <= 18.) {
110 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 18. && edge->
getSpeed() <= 22.) {
112 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 22. && edge->
getSpeed() <= 26.) {
114 }
else if ((roadClass >= 4 || roadClass == -1) && edge->
getSpeed() > 26.) {
124 for (std::vector<RORoute*>::const_iterator p = paths.begin(); p != paths.end(); p++) {
125 if (edges == (*p)->getEdgeVector()) {
131 paths.push_back(
new RORoute(routeId, costs, prob, edges, 0, std::vector<SUMOVehicleParameter::Stop>()));
144 for (
int k = 0; k < kPaths; k++) {
145 std::vector<const ROEdge*> edges;
147 for (std::vector<const ROEdge*>::iterator e = edges.begin(); e != edges.end(); e++) {
159 for (
int t = 0; t < numIter; t++) {
162 std::vector<const ROEdge*> edges;
166 for (std::vector<const ROEdge*>::iterator e = edges.begin(); e != edges.end(); e++) {
182 for (
int outer = 0; outer < maxOuterIteration; outer++) {
183 for (
int inner = 0; inner < maxInnerIteration; inner++) {
205 int unstableEdges = 0;
210 if (inner == 0 && outer == 0) {
213 newFlow += (edge->
getHelpFlow() - oldFlow) / (inner + 1);
217 if (
abs(newFlow - oldFlow) / newFlow > tolerance) {
220 }
else if (newFlow == 0.) {
221 if (oldFlow != 0. && (
abs(newFlow - oldFlow) / oldFlow > tolerance)) {
234 if (unstableEdges == 0) {
241 bool newRoute =
false;
244 std::vector<const ROEdge*> edges;
273 const std::map<const ROEdge* const, SUMOReal>::const_iterator i =
myPenalties.find(e);
280 const std::map<const ROEdge* const, SUMOReal>::const_iterator i =
myPenalties.find(e);
void incremental(const int numIter)
const std::vector< ODCell * > & getCells()
void setHelpFlow(const SUMOReal flow)
SUMOAbstractRouter< ROEdge, ROVehicle > & myRouter
EdgeType getType() const
Returns the type of the edge.
SUMOReal getHelpFlow() const
ROMAAssignments(const SUMOTime begin, const SUMOTime end, RONet &net, ODMatrix &matrix, SUMOAbstractRouter< ROEdge, ROVehicle > &router)
Constructor.
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
void setProbability(SUMOReal prob)
Sets the probability of the route.
unsigned int getLaneNo() const
Returns the number of lanes this edge has.
std::vector< RORoute * > pathsVector
the list of paths / routes
bool addRoute(std::vector< const ROEdge * > &edges, std::vector< RORoute * > &paths, std::string routeId, SUMOReal costs, SUMOReal prob)
add a route and check for duplicates
const std::string DEFAULT_VTYPE_ID
void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a travel time value.
const std::map< std::string, ROEdge * > & getEdgeMap() const
void addProbability(SUMOReal prob)
add additional vehicles/probability
A vehicle as used by router.
A single O/D-matrix cell.
std::string origin
Name of the origin district.
static SUMOReal getPenalizedTT(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge including penalties.
void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const SUMOReal penalty, const SUMOReal tolerance, const std::string routeChoiceMethod)
An O/D (origin/destination) matrix.
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
void setCosts(SUMOReal costs)
Sets the costs of the route.
~ROMAAssignments()
Destructor.
SUMOReal vehicleNumber
The number of vehicles.
An edge representing a whole district.
static std::map< const ROEdge *const, SUMOReal > myPenalties
static SUMOReal getTravelTime(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the traveltime on an edge without penalties.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
static SUMOReal getPenalizedEffort(const ROEdge *const e, const ROVehicle *const v, SUMOReal t)
Returns the effort to pass an edge including penalties.
A basic edge for routing applications.
const std::vector< const ROEdge * > & getEdgeVector() const
Returns the list of edges this route consists of.
The router's network representation.
Structure representing possible vehicle parameter.
void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a weight value.
int getPriority() const
get edge priority (road class)
SUMOReal getLength() const
Returns the length of the edge.
SUMOReal getEffort(const ROVehicle *const veh, SUMOReal time) const
Returns the effort for this edge.
void getKPaths(const int kPaths, const SUMOReal penalty)
get the k shortest paths
virtual SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const =0
std::string destination
Name of the destination district.
virtual void compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
SUMOReal getTravelTime(const ROVehicle *const veh, SUMOReal time) const
Returns the travel time for this edge.
static RouteCostCalculator< R, E, V > & getCalculator()
SUMOReal capacityConstraintFunction(const ROEdge *edge, const SUMOReal flow) const
A basic edge for routing applications.
static ROVehicle * myDefaultVehicle
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
A complete router's route.