64 double pop = 0, work = 0;
65 std::vector<AGStreet*>::iterator it;
68 pop += (*it)->getPopulation();
69 work += (*it)->getWorkplaceNumber();
78 neededWorkPositionsInCity *= double(1.05);
89 std::map<std::string, ROEdge*>::const_iterator itE;
90 std::vector<AGStreet*>::iterator itS;
94 if (*itS == itE->second) {
100 streets.push_back(static_cast<AGStreet*>(itE->second));
107 std::vector<AGStreet*>::iterator it;
108 int workPositionCounter = 0;
113 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
115 ++workPositionCounter;
118 }
catch (
const std::bad_alloc& e) {
119 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
126 std::cout <<
"--> work position: " << std::endl;
127 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
136 if (nbrWorkers <= 0) {
149 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
162 std::list<AGBusLine>::iterator it;
171 std::vector<AGStreet*>::iterator it;
174 int idHouseholds = 0;
183 numAdults[i] = -numAdults[i];
184 }
else if (totalChildrenLeft > 0) {
186 totalChildrenLeft -= numChilds[i];
191 for (
int i = 0; i < numSecondPers; i++) {
192 int index = i % numAdults.size();
193 if (numAdults[index] >= 0) {
194 numAdults[index] += 1;
196 numAdults[index] -= 1;
200 people += (*it)->getPopulation();
201 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
205 households.back().generatePeople(
abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
208 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
209 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
222 std::list<AGHousehold>::iterator itt;
224 if (itt->getAdultNbr() == 1) {
226 if (itt->getAdults().front().isWorking()) {
230 if (itt->getAdultNbr() == 2) {
232 if (itt->getAdults().front().isWorking()) {
235 if (itt->getAdults().back().isWorking()) {
239 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
251 std::cout <<
"--> population: " << std::endl;
252 std::cout <<
" |-> city households: " << nbrHH << std::endl;
253 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
254 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
255 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
258 std::cout <<
" |-> city children: " << nbrChild << std::endl;
273 std::list<AGHousehold>::iterator it;
276 shortage = !it->allocateChildrenSchool();
300 std::list<AGHousehold>::iterator it;
308 if (it->retiredHouseholders()) {
311 shortage = !it->allocateAdultsWork();
313 std::cout <<
"===> ERROR: Not enough work positions in the city for all working people..." << std::endl;
324 std::list<AGAdult>::iterator itA;
330 std::cout <<
"not enough work for incoming people..." << std::endl;
336 std::list<AGHousehold>::iterator itt;
338 if (itt->getAdultNbr() == 1) {
339 if (itt->getAdults().front().isWorking()) {
343 if (itt->getAdultNbr() == 2) {
344 if (itt->getAdults().front().isWorking()) {
347 if (itt->getAdults().back().isWorking()) {
352 std::cout <<
" |-> working people: " <<
peopleIncoming.size() + workingP << std::endl;
353 std::cout <<
" |-> working people in city: " << workingP << std::endl;
354 std::cout <<
" |-> working people from outside: " <<
peopleIncoming.size() << std::endl;
362 std::list<AGHousehold>::iterator it;
380 if (newRate < 0 || newRate >= 1) {
387 it->generateCars(newRate);
389 nbrAdults += it->getAdultNbr();
413 std::cout <<
"first completed in getStreet() of City: Consolidation of data not needed in ActivityGen any more" << std::endl;
416 std::vector<AGStreet*>::iterator it =
streets.begin();
418 if ((*it)->getID() == edge) {
423 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
424 throw (std::runtime_error(
"Street not found with edge id " + edge));
430 throw (std::runtime_error(
"No street found in this city"));
static const T & getRandomFrom(const std::vector< T > &v)
Returns a random element from the given vector.
int getPeopleOlderThan(int age)
AGDataAndStatistics & statData
int getRandomCityGateByOutgoing()
A model of the street in the city.
An internal edge which models vehicles driving across a junction. This is currently not used for rout...
void generatePopulation()
int getRandomPopDistributed(int n, int m)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const AGStreet & getStreet(const std::string &edge)
static OptionsCont & getOptions()
Retrieves the options.
std::list< AGBusLine > busLines
An adult person who can have a job.
const AGStreet & getRandomStreet()
void generateOutgoingWP()
void generateWorkPositions()
int getPeopleYoungerThan(int age)
double factorWorkPositions
std::list< AGHousehold > households
static double rand()
Returns a random real number in [0, 1)
std::vector< AGStreet * > streets
std::list< AGAdult > peopleIncoming
int getPoissonsNumberOfChildren(double mean)
const std::map< std::string, ROEdge * > & getEdgeMap() const
void generateIncomingPopulation()
std::vector< AGPosition > cityGates
std::map< int, AGPosition > busStations
std::vector< AGWorkPosition > workPositions