34 #define LIMIT_CHILDREN_NUMBER 3 65 for (
int a = n; a < m; ++a) {
88 return exp(-mean) * pow(mean, occ) / (double)
factorial(occ);
118 std::map<int, double>::iterator it;
124 if (it->first < age) {
126 }
else if (it->first >= age && previousAge < age) {
127 prop = ((double)(age - previousAge) / (double)(it->first - previousAge));
128 sum += prop * it->second;
131 previousAge = it->first;
149 std::map<int, double>::iterator it;
150 for (it = myMap->begin(); it != myMap->end(); ++it) {
156 for (it = myMap->begin(); it != myMap->end(); ++it) {
157 it->second = it->second / sum;
166 double p =
RandHelper::rand(static_cast<double>(0.0001), static_cast<double>(1));
168 double scale = exp((-1) * maxVar);
170 p = p * (1 - scale) + scale;
172 double variation = (-1) * log(p);
175 return mean + variation;
177 return mean - variation;
186 std::map<int, double>::iterator it;
193 std::cout <<
"ERROR: incoming at city gates not normalized" << std::endl;
201 std::map<int, double>::iterator it;
208 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)