63 std::vector<AGStreet>::iterator it;
66 pop += it->getPopulation();
67 work += it->getWorkplaceNumber();
76 neededWorkPositionsInCity *=
SUMOReal(1.05);
87 std::map<std::string, ROEdge*>::const_iterator itE;
88 std::vector<AGStreet>::iterator itS;
92 if (itS->getName() == itE->second->getID()) {
105 std::vector<AGStreet>::iterator it;
106 int workPositionCounter = 0;
111 for (
int i = 0; i < it->getWorkplaceNumber(); ++i) {
113 ++workPositionCounter;
116 }
catch (
const std::bad_alloc& e) {
117 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
124 std::cout <<
"--> work position: " << std::endl;
125 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
134 if (nbrWorkers <= 0) {
147 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
160 std::list<AGBusLine>::iterator it;
169 std::vector<AGStreet>::iterator it;
172 unsigned int idHouseholds = 0;
181 numAdults[i] = -numAdults[i];
182 }
else if (totalChildrenLeft > 0) {
184 totalChildrenLeft -= numChilds[i];
189 for (
int i = 0; i < numSecondPers; i++) {
190 unsigned int index = i % numAdults.size();
191 if (numAdults[index] >= 0) {
192 numAdults[index] += 1;
194 numAdults[index] -= 1;
198 people += it->getPopulation();
199 while (people > 0 && idHouseholds < (
unsigned int)numAdults.size()) {
203 households.back().generatePeople(
abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
206 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
207 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
220 std::list<AGHousehold>::iterator itt;
222 if (itt->getAdultNbr() == 1) {
224 if (itt->getAdults().front().isWorking()) {
228 if (itt->getAdultNbr() == 2) {
230 if (itt->getAdults().front().isWorking()) {
233 if (itt->getAdults().back().isWorking()) {
237 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
249 std::cout <<
"--> population: " << std::endl;
250 std::cout <<
" |-> city households: " << nbrHH << std::endl;
251 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
252 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
253 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
256 std::cout <<
" |-> city children: " << nbrChild << std::endl;
271 std::list<AGHousehold>::iterator it;
274 shortage = !it->allocateChildrenSchool();
297 std::list<AGHousehold>::iterator it;
301 if (it->retiredHouseholders()) {
304 shortage = !it->allocateAdultsWork();
306 std::cout <<
"===> ERROR: Not enough work positions in the city for all working people..." << std::endl;
314 std::list<AGAdult>::iterator itA;
320 std::cout <<
"not enough work for incoming people..." << std::endl;
326 std::list<AGHousehold>::iterator itt;
328 if (itt->getAdultNbr() == 1) {
329 if (itt->getAdults().front().isWorking()) {
333 if (itt->getAdultNbr() == 2) {
334 if (itt->getAdults().front().isWorking()) {
337 if (itt->getAdults().back().isWorking()) {
342 std::cout <<
" |-> working people: " <<
peopleIncoming.size() + workingP << std::endl;
343 std::cout <<
" |-> working people in city: " << workingP << std::endl;
344 std::cout <<
" |-> working people from outside: " <<
peopleIncoming.size() << std::endl;
352 std::list<AGHousehold>::iterator it;
365 if (newRate < 0 || newRate >= 1) {
372 it->generateCars(newRate);
374 nbrAdults += it->getAdultNbr();
398 std::cout <<
"first completed in getStreet() of City: Consolidation of data not needed in ActivityGen any more" << std::endl;
401 std::vector<AGStreet>::iterator it =
streets.begin();
403 if (it->getName() == edge) {
408 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
409 throw(std::runtime_error(
"Street not found with edge id " + edge));
415 throw(std::runtime_error(
"No street found in this city"));
SUMOReal factorInhabitants
int getPeopleOlderThan(int age)
static SUMOReal rand()
Returns a random real number in [0, 1)
AGDataAndStatistics & statData
int getRandomCityGateByOutgoing()
A model of the street in the city.
An internal edge which models driving across a junction. This is currently not used for routing...
void generatePopulation()
int getRandomPopDistributed(int n, int m)
std::vector< AGStreet > streets
const AGStreet & getStreet(const std::string &edge)
const std::map< std::string, ROEdge * > & getEdgeMap() const
std::list< AGBusLine > busLines
An adult person who can have a job.
SUMOReal factorWorkPositions
const AGStreet & getRandomStreet()
void generateOutgoingWP()
void generateWorkPositions()
int getPeopleYoungerThan(int age)
std::list< AGHousehold > households
std::list< AGAdult > peopleIncoming
int getPoissonsNumberOfChildren(SUMOReal mean)
void generateIncomingPopulation()
std::vector< AGPosition > cityGates
std::map< int, AGPosition > busStations
std::vector< AGWorkPosition > workPositions