40 #define LIMIT_CHILDREN_NUMBER 3 71 for (
int a = n; a < m; ++a) {
94 return exp(-mean) * pow(mean, occ) / (double)
factorial(occ);
124 std::map<int, double>::iterator it;
130 if (it->first < age) {
132 }
else if (it->first >= age && previousAge < age) {
133 prop = ((double)(age - previousAge) / (double)(it->first - previousAge));
134 sum += prop * it->second;
137 previousAge = it->first;
155 std::map<int, double>::iterator it;
156 for (it = myMap->begin(); it != myMap->end(); ++it) {
162 for (it = myMap->begin(); it != myMap->end(); ++it) {
163 it->second = it->second / sum;
172 double p =
RandHelper::rand(static_cast<double>(0.0001), static_cast<double>(1));
174 double scale = exp((-1) * maxVar);
176 p = p * (1 - scale) + scale;
178 double variation = (-1) * log(p);
181 return mean + variation;
183 return mean - variation;
192 std::map<int, double>::iterator it;
199 std::cout <<
"ERROR: incoming at city gates not normalized" << std::endl;
207 std::map<int, double>::iterator it;
214 std::cout <<
"ERROR: outgoing at city gates not normalized" << std::endl;
std::map< int, double > outgoing
#define LIMIT_CHILDREN_NUMBER
double getInverseExpRandomValue(double mean, double maxVar)
int getPeopleOlderThan(int age)
static AGDataAndStatistics & getDataAndStatistics()
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
std::map< int, double > population
int getRandomCityGateByOutgoing()
int getRandomPopDistributed(int n, int m)
std::map< int, double > beginWorkHours
std::map< int, double > incoming
int getPeopleYoungerThan(int age)
std::map< int, double > endWorkHours
double getPropYoungerThan(int age)
int getPoissonsNumberOfChildren(double mean)
void normalizeMapProb(std::map< int, double > *myMap)
int getRandom(int n, int m)
int getRandomCityGateByIncoming()
double poisson(double mean, int occ)