32#define LIMIT_CHILDREN_NUMBER 3
63 for (
int a = n; a < m; ++a) {
86 return exp(-mean) * pow(mean, occ) / (double)
factorial(occ);
116 std::map<int, double>::iterator it;
122 if (it->first < age) {
124 }
else if (it->first >= age && previousAge < age) {
125 prop = ((double)(age - previousAge) / (double)(it->first - previousAge));
126 sum += prop * it->second;
129 previousAge = it->first;
147 std::map<int, double>::iterator it;
148 for (it = myMap->begin(); it != myMap->end(); ++it) {
154 for (it = myMap->begin(); it != myMap->end(); ++it) {
155 it->second = it->second / sum;
164 double p =
RandHelper::rand(
static_cast<double>(0.0001),
static_cast<double>(1));
166 double scale = exp((-1) * maxVar);
168 p = p * (1 - scale) + scale;
170 double variation = (-1) * log(p);
173 return mean + variation;
175 return mean - variation;
184 std::map<int, double>::iterator it;
191 std::cout <<
"ERROR: incoming at city gates not normalized" << std::endl;
199 std::map<int, double>::iterator it;
206 std::cout <<
"ERROR: outgoing at city gates not normalized" << std::endl;
#define LIMIT_CHILDREN_NUMBER
std::map< int, double > incoming
static AGDataAndStatistics & getDataAndStatistics()
double getInverseExpRandomValue(double mean, double maxVar)
double getPropYoungerThan(int age)
int getPeopleYoungerThan(int age)
int getPeopleOlderThan(int age)
int getRandom(int n, int m)
int getPoissonsNumberOfChildren(double mean)
int getRandomCityGateByOutgoing()
double poisson(double mean, int occ)
void normalizeMapProb(std::map< int, double > *myMap)
std::map< int, double > endWorkHours
int getRandomPopDistributed(int n, int m)
int getRandomCityGateByIncoming()
std::map< int, double > beginWorkHours
std::map< int, double > outgoing
std::map< int, double > population
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)