SUMO - Simulation of Urban MObility

AGDataAndStatistics.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Contains various data, statistical values and functions from input used
00008 // by various objects
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00012 // activitygen module
00013 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
00014 /****************************************************************************/
00015 //
00016 //   This program is free software; you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation; either version 2 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef AGDATAANDSTATISTICS_H
00023 #define AGDATAANDSTATISTICS_H
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <iostream>
00036 #include <map>
00037 #include "AGSchool.h"
00038 #include "AGPosition.h"
00039 
00040 
00041 // ===========================================================================
00042 // class definitions
00043 // ===========================================================================
00044 class AGDataAndStatistics {
00045 public:
00049     SUMOReal speedTimePerKm;                            //number of seconds for one km
00050     SUMOReal carPreference;                         //prob. to choose the car (compared to the bus)
00051 
00055     int inhabitants;
00056     int households;
00057     int limitAgeChildren;
00058     int limitAgeRetirement;
00059     int limitEndAge;
00060     SUMOReal carRate;
00061     SUMOReal unemployement;
00062     SUMOReal maxFootDistance;
00063     int incomingTraffic;
00064     int outgoingTraffic;
00065     SUMOReal freeTimeActivityRate;
00066     SUMOReal uniformRandomTrafficRate;
00067     SUMOReal departureVariation;
00068 
00069     std::map<int, SUMOReal> beginWorkHours;             //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
00070     std::map<int, SUMOReal> endWorkHours;               //<hour, probability> (number only used in term of PROPORTION: it should be normalized)
00071     std::map<int, AGPosition> busStations;              //<id, position>
00072     //std::map<SchoolType, int> schoolCapacity;
00073     std::map<int, SUMOReal> population;                     //<bracket's end age, number> (number only used in term of PROPORTION: it should be normalized)
00074     //std::map<int, SUMOReal> childrenAccompagniment;       //<bracket's end age, probability>
00079     std::map<int, SUMOReal> incoming;
00080     std::map<int, SUMOReal> outgoing;
00081 
00085     int workPositions;
00086     SUMOReal factorInhabitants;
00087     SUMOReal factorWorkPositions;
00088 
00093     //probability of picking an old-people household (compared to working and have children adults)
00094     SUMOReal oldAgeHhProb;
00095     //probability of having a second adult (old in case of old householders) in the household.
00096     SUMOReal secondPersProb;
00097     //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
00098     SUMOReal meanNbrChildren;
00099 
00103     //int childrenNbr;
00104     //int oldPeopleNbr;
00105     int AdultNbr;
00106     int householdsNbr;
00107     //households far from public transports
00108     int hhFarFromPT;
00109 
00110     static AGDataAndStatistics& getDataAndStatistics() throw();
00111 
00116     int getRandom(int n, int m);
00124     int getRandomPopDistributed(int n, int m);
00132     int getPoissonsNumberOfChildren(SUMOReal mean);
00139     int getPeopleOlderThan(int age);
00140     int getPeopleYoungerThan(int age);
00141     SUMOReal getPropYoungerThan(int age);
00147     void consolidateStat();
00156     SUMOReal getInverseExpRandomValue(SUMOReal mean, SUMOReal maxVar);
00162     int getRandomCityGateByIncoming();
00163     int getRandomCityGateByOutgoing();
00164 
00165 private:
00166     AGDataAndStatistics() {}
00167 
00175     SUMOReal poisson(SUMOReal mean, int occ);
00179     int factorial(int n);
00180 
00181     //function normalizing the map's probabilities: Sum(floats) = 1
00182     void normalizeMapProb(std::map<int, SUMOReal> *myMap);
00183 };
00184 
00185 #endif
00186 
00187 /****************************************************************************/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines