58 double pop = 0, work = 0;
59 std::vector<AGStreet*>::iterator it;
62 pop += (*it)->getPopulation();
63 work += (*it)->getWorkplaceNumber();
84 std::vector<AGStreet*>::iterator itS;
86 if (*itS == itE.second) {
91 if (itS ==
streets.end() && !itE.second->isInternal()) {
92 streets.push_back(static_cast<AGStreet*>(itE.second));
99 std::vector<AGStreet*>::iterator it;
100 int workPositionCounter = 0;
105 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
107 ++workPositionCounter;
110 }
catch (
const std::bad_alloc& e) {
111 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
118 std::cout <<
"--> work position: " << std::endl;
119 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
128 if (nbrWorkers <= 0) {
141 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
154 std::list<AGBusLine>::iterator it;
163 std::vector<AGStreet*>::iterator it;
166 int idHouseholds = 0;
175 numAdults[i] = -numAdults[i];
176 }
else if (totalChildrenLeft > 0) {
178 totalChildrenLeft -= numChilds[i];
183 for (
int i = 0; i < numSecondPers; i++) {
184 int index = i % numAdults.size();
185 if (numAdults[index] >= 0) {
186 numAdults[index] += 1;
188 numAdults[index] -= 1;
192 people += (*it)->getPopulation();
193 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
197 households.back().generatePeople(abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
200 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
201 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
214 std::list<AGHousehold>::iterator itt;
216 if (itt->getAdultNbr() == 1) {
218 if (itt->getAdults().front().isWorking()) {
222 if (itt->getAdultNbr() == 2) {
224 if (itt->getAdults().front().isWorking()) {
227 if (itt->getAdults().back().isWorking()) {
231 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
243 std::cout <<
"--> population: " << std::endl;
244 std::cout <<
" |-> city households: " << nbrHH << std::endl;
245 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
246 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
247 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
250 std::cout <<
" |-> city children: " << nbrChild << std::endl;
265 std::list<AGHousehold>::iterator it;
268 shortage = !it->allocateChildrenSchool();
292 std::list<AGHousehold>::iterator it;
300 if (it->retiredHouseholders()) {
303 shortage = !it->allocateAdultsWork();
305 std::cout <<
"===> ERROR: Not enough work positions in the city for all working people..." << std::endl;
316 std::list<AGAdult>::iterator itA;
322 std::cout <<
"not enough work for incoming people..." << std::endl;
328 std::list<AGHousehold>::iterator itt;
330 if (itt->getAdultNbr() == 1) {
331 if (itt->getAdults().front().isWorking()) {
335 if (itt->getAdultNbr() == 2) {
336 if (itt->getAdults().front().isWorking()) {
339 if (itt->getAdults().back().isWorking()) {
344 std::cout <<
" |-> working people: " <<
peopleIncoming.size() + workingP << std::endl;
345 std::cout <<
" |-> working people in city: " << workingP << std::endl;
346 std::cout <<
" |-> working people from outside: " <<
peopleIncoming.size() << std::endl;
354 std::list<AGHousehold>::iterator it;
372 if (newRate < 0 || newRate >= 1) {
379 it->generateCars(newRate);
381 nbrAdults += it->getAdultNbr();
405 std::cout <<
"first completed in getStreet() of City: Consolidation of data not needed in ActivityGen any more" << std::endl;
408 std::vector<AGStreet*>::iterator it =
streets.begin();
410 if ((*it)->getID() == edge) {
415 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
416 throw (std::runtime_error(
"Street not found with edge id " + edge));
422 throw (std::runtime_error(
"No street found in this city"));