57 double pop = 0, work = 0;
58 std::vector<AGStreet*>::iterator it;
61 pop += (*it)->getPopulation();
62 work += (*it)->getWorkplaceNumber();
85 std::vector<AGStreet*>::iterator itS;
87 if (*itS == itE.second) {
92 if (itS ==
streets.end() && !itE.second->isInternal()) {
103 std::vector<AGStreet*>::iterator it;
104 int workPositionCounter = 0;
107 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
109 ++workPositionCounter;
112 }
catch (
const std::bad_alloc&) {
113 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
120 std::cout <<
"--> work position:" << std::endl;
121 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
130 if (nbrWorkers <= 0) {
144 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
157 std::list<AGBusLine>::iterator it;
166 std::vector<AGStreet*>::iterator it;
169 int idHouseholds = 0;
178 numAdults[i] = -numAdults[i];
179 }
else if (totalChildrenLeft > 0) {
181 totalChildrenLeft -= numChilds[i];
186 for (
int i = 0; i < numSecondPers; i++) {
187 int index = i % numAdults.size();
188 if (numAdults[index] >= 0) {
189 numAdults[index] += 1;
191 numAdults[index] -= 1;
195 people += (*it)->getPopulation();
196 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
200 households.back().generatePeople(abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
203 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
204 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
216 std::list<AGHousehold>::iterator itt;
218 if (itt->getAdultNbr() == 1) {
221 if (itt->getAdultNbr() == 2) {
224 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
236 std::cout <<
"--> population:" << std::endl;
237 std::cout <<
" |-> city households: " << nbrHH << std::endl;
238 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
239 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
240 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
243 std::cout <<
" |-> city children: " << nbrChild << std::endl;
258 std::list<AGHousehold>::iterator it;
261 shortage = !it->allocateChildrenSchool();
285 std::list<AGHousehold>::iterator it;
293 if (it->retiredHouseholders()) {
296 shortage = !it->allocateAdultsWork();
298 std::cout <<
"===> ERROR: Not enough work positions in the city for all working people..." << std::endl;
309 std::list<AGAdult>::iterator itA;
315 std::cout <<
"not enough work for incoming people..." << std::endl;
321 std::list<AGHousehold>::iterator itt;
323 if (itt->getAdultNbr() == 1) {
324 if (itt->getAdults().front().isWorking()) {
328 if (itt->getAdultNbr() == 2) {
329 if (itt->getAdults().front().isWorking()) {
332 if (itt->getAdults().back().isWorking()) {
337 std::cout <<
" |-> working people: " <<
peopleIncoming.size() + workingP << std::endl;
338 std::cout <<
" |-> working people in city: " << workingP << std::endl;
339 std::cout <<
" |-> working people from outside: " <<
peopleIncoming.size() << std::endl;
347 std::list<AGHousehold>::iterator it;
365 if (newRate < 0 || newRate >= 1) {
372 it->generateCars(newRate);
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)->getID() == edge) {
408 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
409 throw ProcessError(
"Street not found with edge id " + edge);
415 throw ProcessError(
TL(
"No street that allows passenger vehicles found in this city."));
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
An adult person who can have a job.
std::vector< AGStreet * > streets
std::vector< AGStreet * > passengerStreets
std::list< AGHousehold > households
std::vector< AGPosition > cityGates
void generateWorkPositions()
void generateOutgoingWP()
AGDataAndStatistics & statData
std::vector< AGWorkPosition > workPositions
std::list< AGBusLine > busLines
void generateIncomingPopulation()
const AGStreet & getStreet(const std::string &edge)
const AGStreet & getRandomStreet()
void generatePopulation()
std::list< AGAdult > peopleIncoming
int getPeopleYoungerThan(int age)
int getPeopleOlderThan(int age)
int getPoissonsNumberOfChildren(double mean)
int getRandomCityGateByOutgoing()
int getRandomPopDistributed(int n, int m)
std::map< int, AGPosition > busStations
double factorWorkPositions
A model of the street in the city.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
const NamedObjectCont< ROEdge * > & getEdgeMap() const
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
static const T & getRandomFrom(const std::vector< T > &v, SumoRNG *rng=nullptr)
Returns a random element from the given vector.