57 double pop = 0, work = 0;
58 std::vector<AGStreet*>::iterator it;
61 pop += (*it)->getPopulation();
62 work += (*it)->getWorkplaceNumber();
83 std::vector<AGStreet*>::iterator itS;
85 if (*itS == itE.second) {
90 if (itS ==
streets.end() && !itE.second->isInternal()) {
91 streets.push_back(static_cast<AGStreet*>(itE.second));
98 std::vector<AGStreet*>::iterator it;
99 int workPositionCounter = 0;
104 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
106 ++workPositionCounter;
109 }
catch (
const std::bad_alloc& e) {
110 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
117 std::cout <<
"--> work position: " << std::endl;
118 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
127 if (nbrWorkers <= 0) {
140 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
153 std::list<AGBusLine>::iterator it;
162 std::vector<AGStreet*>::iterator it;
165 int idHouseholds = 0;
174 numAdults[i] = -numAdults[i];
175 }
else if (totalChildrenLeft > 0) {
177 totalChildrenLeft -= numChilds[i];
182 for (
int i = 0; i < numSecondPers; i++) {
183 int index = i % numAdults.size();
184 if (numAdults[index] >= 0) {
185 numAdults[index] += 1;
187 numAdults[index] -= 1;
191 people += (*it)->getPopulation();
192 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
196 households.back().generatePeople(abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
199 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
200 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
213 std::list<AGHousehold>::iterator itt;
215 if (itt->getAdultNbr() == 1) {
217 if (itt->getAdults().front().isWorking()) {
221 if (itt->getAdultNbr() == 2) {
223 if (itt->getAdults().front().isWorking()) {
226 if (itt->getAdults().back().isWorking()) {
230 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
242 std::cout <<
"--> population: " << std::endl;
243 std::cout <<
" |-> city households: " << nbrHH << std::endl;
244 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
245 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
246 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
249 std::cout <<
" |-> city children: " << nbrChild << std::endl;
264 std::list<AGHousehold>::iterator it;
267 shortage = !it->allocateChildrenSchool();
291 std::list<AGHousehold>::iterator it;
299 if (it->retiredHouseholders()) {
302 shortage = !it->allocateAdultsWork();
304 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"));