64 std::vector<AGStreet*>::iterator it;
67 pop += (*it)->getPopulation();
68 work += (*it)->getWorkplaceNumber();
77 neededWorkPositionsInCity *=
SUMOReal(1.05);
88 std::map<std::string, ROEdge*>::const_iterator itE;
89 std::vector<AGStreet*>::iterator itS;
93 if (*itS == itE->second) {
99 streets.push_back(static_cast<AGStreet*>(itE->second));
106 std::vector<AGStreet*>::iterator it;
107 int workPositionCounter = 0;
112 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
114 ++workPositionCounter;
117 }
catch (
const std::bad_alloc& e) {
118 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
125 std::cout <<
"--> work position: " << std::endl;
126 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
135 if (nbrWorkers <= 0) {
148 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
161 std::list<AGBusLine>::iterator it;
170 std::vector<AGStreet*>::iterator it;
173 int idHouseholds = 0;
182 numAdults[i] = -numAdults[i];
183 }
else if (totalChildrenLeft > 0) {
185 totalChildrenLeft -= numChilds[i];
190 for (
int i = 0; i < numSecondPers; i++) {
191 int index = i % numAdults.size();
192 if (numAdults[index] >= 0) {
193 numAdults[index] += 1;
195 numAdults[index] -= 1;
199 people += (*it)->getPopulation();
200 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
204 households.back().generatePeople(
abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
207 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
208 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
221 std::list<AGHousehold>::iterator itt;
223 if (itt->getAdultNbr() == 1) {
225 if (itt->getAdults().front().isWorking()) {
229 if (itt->getAdultNbr() == 2) {
231 if (itt->getAdults().front().isWorking()) {
234 if (itt->getAdults().back().isWorking()) {
238 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
250 std::cout <<
"--> population: " << std::endl;
251 std::cout <<
" |-> city households: " << nbrHH << std::endl;
252 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
253 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
254 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
257 std::cout <<
" |-> city children: " << nbrChild << std::endl;
272 std::list<AGHousehold>::iterator it;
275 shortage = !it->allocateChildrenSchool();
298 std::list<AGHousehold>::iterator it;
302 if (it->retiredHouseholders()) {
305 shortage = !it->allocateAdultsWork();
307 std::cout <<
"===> ERROR: Not enough work positions in the city for all working people..." << std::endl;
315 std::list<AGAdult>::iterator itA;
321 std::cout <<
"not enough work for incoming people..." << std::endl;
327 std::list<AGHousehold>::iterator itt;
329 if (itt->getAdultNbr() == 1) {
330 if (itt->getAdults().front().isWorking()) {
334 if (itt->getAdultNbr() == 2) {
335 if (itt->getAdults().front().isWorking()) {
338 if (itt->getAdults().back().isWorking()) {
343 std::cout <<
" |-> working people: " <<
peopleIncoming.size() + workingP << std::endl;
344 std::cout <<
" |-> working people in city: " << workingP << std::endl;
345 std::cout <<
" |-> working people from outside: " <<
peopleIncoming.size() << std::endl;
353 std::list<AGHousehold>::iterator it;
371 if (newRate < 0 || newRate >= 1) {
378 it->generateCars(newRate);
380 nbrAdults += it->getAdultNbr();
404 std::cout <<
"first completed in getStreet() of City: Consolidation of data not needed in ActivityGen any more" << std::endl;
407 std::vector<AGStreet*>::iterator it =
streets.begin();
409 if ((*it)->getID() == edge) {
414 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
415 throw (std::runtime_error(
"Street not found with edge id " + edge));
421 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.
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 vehicles driving across a junction. This is currently not used for rout...
void generatePopulation()
int getRandomPopDistributed(int n, int m)
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::vector< AGStreet * > streets
std::list< AGAdult > peopleIncoming
int getPoissonsNumberOfChildren(SUMOReal mean)
void generateIncomingPopulation()
std::vector< AGPosition > cityGates
std::map< int, AGPosition > busStations
std::vector< AGWorkPosition > workPositions