Eclipse SUMO - Simulation of Urban MObility
AGDataAndStatistics.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // activitygen module
5 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 // SPDX-License-Identifier: EPL-2.0
11 /****************************************************************************/
20 // Contains various data, statistical values and functions from input used
21 // by various objects
22 /****************************************************************************/
23 #ifndef AGDATAANDSTATISTICS_H
24 #define AGDATAANDSTATISTICS_H
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #include <config.h>
31 
32 #include <iostream>
33 #include <map>
34 #include "AGSchool.h"
35 #include "AGPosition.h"
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
42 public:
46  double speedTimePerKm; //number of seconds for one km
47  double carPreference; //prob. to choose the car (compared to the bus)
48 
57  double carRate;
58  double unemployement;
59  double laborDemand;
66 
67  std::map<int, double> beginWorkHours; //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
68  std::map<int, double> endWorkHours; //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
69  std::map<int, AGPosition> busStations; //<id, position>
70  //std::map<SchoolType, int> schoolCapacity;
71  std::map<int, double> population; //<bracket's end age, number> (number only used in term of PROPORTION: it should be normalized)
72  //std::map<int, double> childrenAccompagniment; //<bracket's end age, probability>
77  std::map<int, double> incoming;
78  std::map<int, double> outgoing;
79 
86 
91  //probability of picking an old-people household (compared to working and have children adults)
92  double oldAgeHhProb;
93  //probability of having a second adult (old in case of old householders) in the household.
95  //this s the mean number of children pro household (not old). This value is used in the Poisson-lay for determining the number of children in each family
97 
101  //int childrenNbr;
102  //int oldPeopleNbr;
103  int AdultNbr;
105  //households far from public transports
107 
109 
114  int getRandom(int n, int m);
122  int getRandomPopDistributed(int n, int m);
130  int getPoissonsNumberOfChildren(double mean);
137  int getPeopleOlderThan(int age);
138  int getPeopleYoungerThan(int age);
139  double getPropYoungerThan(int age);
145  void consolidateStat();
154  double getInverseExpRandomValue(double mean, double maxVar);
162 
163 private:
165 
173  double poisson(double mean, int occ);
177  int factorial(int n);
178 
179  //function normalizing the map's probabilities: Sum(floats) = 1
180  void normalizeMapProb(std::map<int, double>* myMap);
181 };
182 
183 #endif
184 
185 /****************************************************************************/
AGDataAndStatistics::meanNbrChildren
double meanNbrChildren
Definition: AGDataAndStatistics.h:96
AGDataAndStatistics::householdsNbr
int householdsNbr
Definition: AGDataAndStatistics.h:104
AGDataAndStatistics::consolidateStat
void consolidateStat()
Definition: AGDataAndStatistics.cpp:100
AGDataAndStatistics::outgoingTraffic
int outgoingTraffic
Definition: AGDataAndStatistics.h:62
AGDataAndStatistics::uniformRandomTrafficRate
double uniformRandomTrafficRate
Definition: AGDataAndStatistics.h:64
AGDataAndStatistics::workPositions
int workPositions
Definition: AGDataAndStatistics.h:83
AGDataAndStatistics::factorInhabitants
double factorInhabitants
Definition: AGDataAndStatistics.h:84
AGDataAndStatistics::limitAgeRetirement
int limitAgeRetirement
Definition: AGDataAndStatistics.h:55
AGDataAndStatistics::departureVariation
double departureVariation
Definition: AGDataAndStatistics.h:65
AGDataAndStatistics::speedTimePerKm
double speedTimePerKm
Definition: AGDataAndStatistics.h:46
AGDataAndStatistics::population
std::map< int, double > population
Definition: AGDataAndStatistics.h:71
AGSchool.h
AGDataAndStatistics::getPeopleOlderThan
int getPeopleOlderThan(int age)
Definition: AGDataAndStatistics.cpp:142
AGDataAndStatistics::carPreference
double carPreference
Definition: AGDataAndStatistics.h:47
AGDataAndStatistics::busStations
std::map< int, AGPosition > busStations
Definition: AGDataAndStatistics.h:69
AGDataAndStatistics
Definition: AGDataAndStatistics.h:41
AGDataAndStatistics::getInverseExpRandomValue
double getInverseExpRandomValue(double mean, double maxVar)
Definition: AGDataAndStatistics.cpp:162
AGDataAndStatistics::secondPersProb
double secondPersProb
Definition: AGDataAndStatistics.h:94
AGDataAndStatistics::beginWorkHours
std::map< int, double > beginWorkHours
Definition: AGDataAndStatistics.h:67
AGDataAndStatistics::outgoing
std::map< int, double > outgoing
Definition: AGDataAndStatistics.h:78
AGDataAndStatistics::getRandomCityGateByOutgoing
int getRandomCityGateByOutgoing()
Definition: AGDataAndStatistics.cpp:198
AGDataAndStatistics::limitEndAge
int limitEndAge
Definition: AGDataAndStatistics.h:56
AGDataAndStatistics::AGDataAndStatistics
AGDataAndStatistics()
Definition: AGDataAndStatistics.h:164
AGDataAndStatistics::incomingTraffic
int incomingTraffic
Definition: AGDataAndStatistics.h:61
AGDataAndStatistics::getRandomPopDistributed
int getRandomPopDistributed(int n, int m)
Definition: AGDataAndStatistics.cpp:57
AGDataAndStatistics::getPeopleYoungerThan
int getPeopleYoungerThan(int age)
Definition: AGDataAndStatistics.cpp:137
AGDataAndStatistics::factorWorkPositions
double factorWorkPositions
Definition: AGDataAndStatistics.h:85
AGDataAndStatistics::getRandom
int getRandom(int n, int m)
Definition: AGDataAndStatistics.cpp:47
AGDataAndStatistics::normalizeMapProb
void normalizeMapProb(std::map< int, double > *myMap)
Definition: AGDataAndStatistics.cpp:147
AGDataAndStatistics::unemployement
double unemployement
Definition: AGDataAndStatistics.h:58
AGDataAndStatistics::factorial
int factorial(int n)
Definition: AGDataAndStatistics.cpp:92
AGDataAndStatistics::maxFootDistance
double maxFootDistance
Definition: AGDataAndStatistics.h:60
AGPosition.h
AGDataAndStatistics::endWorkHours
std::map< int, double > endWorkHours
Definition: AGDataAndStatistics.h:68
AGDataAndStatistics::incoming
std::map< int, double > incoming
Definition: AGDataAndStatistics.h:77
AGDataAndStatistics::oldAgeHhProb
double oldAgeHhProb
Definition: AGDataAndStatistics.h:92
AGDataAndStatistics::inhabitants
int inhabitants
Definition: AGDataAndStatistics.h:52
AGDataAndStatistics::laborDemand
double laborDemand
Definition: AGDataAndStatistics.h:59
AGDataAndStatistics::getPropYoungerThan
double getPropYoungerThan(int age)
Definition: AGDataAndStatistics.cpp:117
AGDataAndStatistics::freeTimeActivityRate
double freeTimeActivityRate
Definition: AGDataAndStatistics.h:63
config.h
AGDataAndStatistics::AdultNbr
int AdultNbr
Definition: AGDataAndStatistics.h:103
AGDataAndStatistics::getPoissonsNumberOfChildren
int getPoissonsNumberOfChildren(double mean)
Definition: AGDataAndStatistics.cpp:74
AGDataAndStatistics::hhFarFromPT
int hhFarFromPT
Definition: AGDataAndStatistics.h:106
AGDataAndStatistics::carRate
double carRate
Definition: AGDataAndStatistics.h:57
AGDataAndStatistics::poisson
double poisson(double mean, int occ)
Definition: AGDataAndStatistics.cpp:87
AGDataAndStatistics::getDataAndStatistics
static AGDataAndStatistics & getDataAndStatistics()
Definition: AGDataAndStatistics.cpp:41
AGDataAndStatistics::limitAgeChildren
int limitAgeChildren
Definition: AGDataAndStatistics.h:54
AGDataAndStatistics::getRandomCityGateByIncoming
int getRandomCityGateByIncoming()
Definition: AGDataAndStatistics.cpp:183
AGDataAndStatistics::households
int households
Definition: AGDataAndStatistics.h:53