SUMO - Simulation of Urban MObility
AGDataAndStatistics.h
Go to the documentation of this file.
00001 /****************************************************************************/
00010 // Contains various data, statistical values and functions from input used
00011 // by various objects
00012 /****************************************************************************/
00013 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00014 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00015 // activitygen module
00016 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
00017 /****************************************************************************/
00018 //
00019 //   This file is part of SUMO.
00020 //   SUMO is free software: you can redistribute it and/or modify
00021 //   it under the terms of the GNU General Public License as published by
00022 //   the Free Software Foundation, either version 3 of the License, or
00023 //   (at your option) any later version.
00024 //
00025 /****************************************************************************/
00026 #ifndef AGDATAANDSTATISTICS_H
00027 #define AGDATAANDSTATISTICS_H
00028 
00029 
00030 // ===========================================================================
00031 // included modules
00032 // ===========================================================================
00033 #ifdef _MSC_VER
00034 #include <windows_config.h>
00035 #else
00036 #include <config.h>
00037 #endif
00038 
00039 #include <iostream>
00040 #include <map>
00041 #include "AGSchool.h"
00042 #include "AGPosition.h"
00043 
00044 
00045 // ===========================================================================
00046 // class definitions
00047 // ===========================================================================
00048 class AGDataAndStatistics {
00049 public:
00053     SUMOReal speedTimePerKm;                            //number of seconds for one km
00054     SUMOReal carPreference;                         //prob. to choose the car (compared to the bus)
00055 
00059     int inhabitants;
00060     int households;
00061     int limitAgeChildren;
00062     int limitAgeRetirement;
00063     int limitEndAge;
00064     SUMOReal carRate;
00065     SUMOReal unemployement;
00066     SUMOReal maxFootDistance;
00067     int incomingTraffic;
00068     int outgoingTraffic;
00069     SUMOReal freeTimeActivityRate;
00070     SUMOReal uniformRandomTrafficRate;
00071     SUMOReal departureVariation;
00072 
00073     std::map<int, SUMOReal> beginWorkHours;             //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
00074     std::map<int, SUMOReal> endWorkHours;               //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
00075     std::map<int, AGPosition> busStations;              //<id, position>
00076     //std::map<SchoolType, int> schoolCapacity;
00077     std::map<int, SUMOReal> population;                     //<bracket's end age, number> (number only used in term of PROPORTION: it should be normalized)
00078     //std::map<int, SUMOReal> childrenAccompagniment;       //<bracket's end age, probability>
00083     std::map<int, SUMOReal> incoming;
00084     std::map<int, SUMOReal> outgoing;
00085 
00089     int workPositions;
00090     SUMOReal factorInhabitants;
00091     SUMOReal factorWorkPositions;
00092 
00097     //probability of picking an old-people household (compared to working and have children adults)
00098     SUMOReal oldAgeHhProb;
00099     //probability of having a second adult (old in case of old householders) in the household.
00100     SUMOReal secondPersProb;
00101     //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
00102     SUMOReal meanNbrChildren;
00103 
00107     //int childrenNbr;
00108     //int oldPeopleNbr;
00109     int AdultNbr;
00110     int householdsNbr;
00111     //households far from public transports
00112     int hhFarFromPT;
00113 
00114     static AGDataAndStatistics& getDataAndStatistics() ;
00115 
00120     int getRandom(int n, int m);
00128     int getRandomPopDistributed(int n, int m);
00136     int getPoissonsNumberOfChildren(SUMOReal mean);
00143     int getPeopleOlderThan(int age);
00144     int getPeopleYoungerThan(int age);
00145     SUMOReal getPropYoungerThan(int age);
00151     void consolidateStat();
00160     SUMOReal getInverseExpRandomValue(SUMOReal mean, SUMOReal maxVar);
00166     int getRandomCityGateByIncoming();
00167     int getRandomCityGateByOutgoing();
00168 
00169 private:
00170     AGDataAndStatistics() {}
00171 
00179     SUMOReal poisson(SUMOReal mean, int occ);
00183     int factorial(int n);
00184 
00185     //function normalizing the map's probabilities: Sum(floats) = 1
00186     void normalizeMapProb(std::map<int, SUMOReal> *myMap);
00187 };
00188 
00189 #endif
00190 
00191 /****************************************************************************/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines