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 /****************************************************************************/
19 // Contains various data, statistical values and functions from input used
20 // by various objects
21 /****************************************************************************/
22 #ifndef AGDATAANDSTATISTICS_H
23 #define AGDATAANDSTATISTICS_H
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #include <config.h>
30 
31 #include <iostream>
32 #include <map>
33 #include "AGSchool.h"
34 #include "AGPosition.h"
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
41 public:
45  double speedTimePerKm; //number of seconds for one km
46  double carPreference; //prob. to choose the car (compared to the bus)
47 
56  double carRate;
57  double unemployement;
58  double laborDemand;
65 
66  std::map<int, double> beginWorkHours; //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
67  std::map<int, double> endWorkHours; //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
68  std::map<int, AGPosition> busStations; //<id, position>
69  //std::map<SchoolType, int> schoolCapacity;
70  std::map<int, double> population; //<bracket's end age, number> (number only used in term of PROPORTION: it should be normalized)
71  //std::map<int, double> childrenAccompagniment; //<bracket's end age, probability>
76  std::map<int, double> incoming;
77  std::map<int, double> outgoing;
78 
85 
90  //probability of picking an old-people household (compared to working and have children adults)
91  double oldAgeHhProb;
92  //probability of having a second adult (old in case of old householders) in the household.
94  //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
96 
100  //int childrenNbr;
101  //int oldPeopleNbr;
102  int AdultNbr;
104  //households far from public transports
106 
108 
113  int getRandom(int n, int m);
121  int getRandomPopDistributed(int n, int m);
129  int getPoissonsNumberOfChildren(double mean);
136  int getPeopleOlderThan(int age);
137  int getPeopleYoungerThan(int age);
138  double getPropYoungerThan(int age);
144  void consolidateStat();
153  double getInverseExpRandomValue(double mean, double maxVar);
161 
162 private:
164 
172  double poisson(double mean, int occ);
176  int factorial(int n);
177 
178  //function normalizing the map's probabilities: Sum(floats) = 1
179  void normalizeMapProb(std::map<int, double>* myMap);
180 };
181 
182 #endif
183 
184 /****************************************************************************/
AGDataAndStatistics::meanNbrChildren
double meanNbrChildren
Definition: AGDataAndStatistics.h:95
AGDataAndStatistics::householdsNbr
int householdsNbr
Definition: AGDataAndStatistics.h:103
AGDataAndStatistics::consolidateStat
void consolidateStat()
Definition: AGDataAndStatistics.cpp:99
AGDataAndStatistics::outgoingTraffic
int outgoingTraffic
Definition: AGDataAndStatistics.h:61
AGDataAndStatistics::uniformRandomTrafficRate
double uniformRandomTrafficRate
Definition: AGDataAndStatistics.h:63
AGDataAndStatistics::workPositions
int workPositions
Definition: AGDataAndStatistics.h:82
AGDataAndStatistics::factorInhabitants
double factorInhabitants
Definition: AGDataAndStatistics.h:83
AGDataAndStatistics::limitAgeRetirement
int limitAgeRetirement
Definition: AGDataAndStatistics.h:54
AGDataAndStatistics::departureVariation
double departureVariation
Definition: AGDataAndStatistics.h:64
AGDataAndStatistics::speedTimePerKm
double speedTimePerKm
Definition: AGDataAndStatistics.h:45
AGDataAndStatistics::population
std::map< int, double > population
Definition: AGDataAndStatistics.h:70
AGSchool.h
AGDataAndStatistics::getPeopleOlderThan
int getPeopleOlderThan(int age)
Definition: AGDataAndStatistics.cpp:141
AGDataAndStatistics::carPreference
double carPreference
Definition: AGDataAndStatistics.h:46
AGDataAndStatistics::busStations
std::map< int, AGPosition > busStations
Definition: AGDataAndStatistics.h:68
AGDataAndStatistics
Definition: AGDataAndStatistics.h:40
AGDataAndStatistics::getInverseExpRandomValue
double getInverseExpRandomValue(double mean, double maxVar)
Definition: AGDataAndStatistics.cpp:161
AGDataAndStatistics::secondPersProb
double secondPersProb
Definition: AGDataAndStatistics.h:93
AGDataAndStatistics::beginWorkHours
std::map< int, double > beginWorkHours
Definition: AGDataAndStatistics.h:66
AGDataAndStatistics::outgoing
std::map< int, double > outgoing
Definition: AGDataAndStatistics.h:77
AGDataAndStatistics::getRandomCityGateByOutgoing
int getRandomCityGateByOutgoing()
Definition: AGDataAndStatistics.cpp:197
AGDataAndStatistics::limitEndAge
int limitEndAge
Definition: AGDataAndStatistics.h:55
AGDataAndStatistics::AGDataAndStatistics
AGDataAndStatistics()
Definition: AGDataAndStatistics.h:163
AGDataAndStatistics::incomingTraffic
int incomingTraffic
Definition: AGDataAndStatistics.h:60
AGDataAndStatistics::getRandomPopDistributed
int getRandomPopDistributed(int n, int m)
Definition: AGDataAndStatistics.cpp:56
AGDataAndStatistics::getPeopleYoungerThan
int getPeopleYoungerThan(int age)
Definition: AGDataAndStatistics.cpp:136
AGDataAndStatistics::factorWorkPositions
double factorWorkPositions
Definition: AGDataAndStatistics.h:84
AGDataAndStatistics::getRandom
int getRandom(int n, int m)
Definition: AGDataAndStatistics.cpp:46
AGDataAndStatistics::normalizeMapProb
void normalizeMapProb(std::map< int, double > *myMap)
Definition: AGDataAndStatistics.cpp:146
AGDataAndStatistics::unemployement
double unemployement
Definition: AGDataAndStatistics.h:57
AGDataAndStatistics::factorial
int factorial(int n)
Definition: AGDataAndStatistics.cpp:91
AGDataAndStatistics::maxFootDistance
double maxFootDistance
Definition: AGDataAndStatistics.h:59
AGPosition.h
AGDataAndStatistics::endWorkHours
std::map< int, double > endWorkHours
Definition: AGDataAndStatistics.h:67
AGDataAndStatistics::incoming
std::map< int, double > incoming
Definition: AGDataAndStatistics.h:76
AGDataAndStatistics::oldAgeHhProb
double oldAgeHhProb
Definition: AGDataAndStatistics.h:91
AGDataAndStatistics::inhabitants
int inhabitants
Definition: AGDataAndStatistics.h:51
AGDataAndStatistics::laborDemand
double laborDemand
Definition: AGDataAndStatistics.h:58
AGDataAndStatistics::getPropYoungerThan
double getPropYoungerThan(int age)
Definition: AGDataAndStatistics.cpp:116
AGDataAndStatistics::freeTimeActivityRate
double freeTimeActivityRate
Definition: AGDataAndStatistics.h:62
config.h
AGDataAndStatistics::AdultNbr
int AdultNbr
Definition: AGDataAndStatistics.h:102
AGDataAndStatistics::getPoissonsNumberOfChildren
int getPoissonsNumberOfChildren(double mean)
Definition: AGDataAndStatistics.cpp:73
AGDataAndStatistics::hhFarFromPT
int hhFarFromPT
Definition: AGDataAndStatistics.h:105
AGDataAndStatistics::carRate
double carRate
Definition: AGDataAndStatistics.h:56
AGDataAndStatistics::poisson
double poisson(double mean, int occ)
Definition: AGDataAndStatistics.cpp:86
AGDataAndStatistics::getDataAndStatistics
static AGDataAndStatistics & getDataAndStatistics()
Definition: AGDataAndStatistics.cpp:40
AGDataAndStatistics::limitAgeChildren
int limitAgeChildren
Definition: AGDataAndStatistics.h:53
AGDataAndStatistics::getRandomCityGateByIncoming
int getRandomCityGateByIncoming()
Definition: AGDataAndStatistics.cpp:182
AGDataAndStatistics::households
int households
Definition: AGDataAndStatistics.h:52