56 double pop = 0, work = 0;
57 std::vector<AGStreet*>::iterator it;
60 pop += (*it)->getPopulation();
61 work += (*it)->getWorkplaceNumber();
82 std::vector<AGStreet*>::iterator itS;
84 if (*itS == itE.second) {
89 if (itS ==
streets.end() && !itE.second->isInternal()) {
97 std::vector<AGStreet*>::iterator it;
98 int workPositionCounter = 0;
103 for (
int i = 0; i < (*it)->getWorkplaceNumber(); ++i) {
105 ++workPositionCounter;
108 }
catch (
const std::bad_alloc& e) {
109 std::cout <<
"Number of work positions at bad_alloc exception: " << workPositionCounter << std::endl;
116 std::cout <<
"--> work position: " << std::endl;
117 std::cout <<
" |-> in city: " << workPositionCounter << std::endl;
126 if (nbrWorkers <= 0) {
139 for (
int i = 0; i < nbrOutWorkPositions; ++i) {
152 std::list<AGBusLine>::iterator it;
161 std::vector<AGStreet*>::iterator it;
164 int idHouseholds = 0;
173 numAdults[i] = -numAdults[i];
174 }
else if (totalChildrenLeft > 0) {
176 totalChildrenLeft -= numChilds[i];
181 for (
int i = 0; i < numSecondPers; i++) {
182 int index = i % numAdults.size();
183 if (numAdults[index] >= 0) {
184 numAdults[index] += 1;
186 numAdults[index] -= 1;
190 people += (*it)->getPopulation();
191 while (people > 0 && idHouseholds < (
int)numAdults.size()) {
195 households.back().generatePeople(abs(numAdults[i]), numChilds[i], numAdults[i] < 0);
198 numAdults[i] = numAdults[numAdults.size() - idHouseholds];
199 numChilds[i] = numChilds[numAdults.size() - idHouseholds];
212 std::list<AGHousehold>::iterator itt;
214 if (itt->getAdultNbr() == 1) {
216 if (itt->getAdults().front().isWorking()) {
220 if (itt->getAdultNbr() == 2) {
222 if (itt->getAdults().front().isWorking()) {
225 if (itt->getAdults().back().isWorking()) {
229 nbrChild += itt->getPeopleNbr() - itt->getAdultNbr();
241 std::cout <<
"--> population: " << std::endl;
242 std::cout <<
" |-> city households: " << nbrHH << std::endl;
243 std::cout <<
" |-> city people: " << nbrSingle + nbrCouple + nbrChild << std::endl;
244 std::cout <<
" |-> city single: " << nbrSingle <<
" / (in) couple: " << nbrCouple << std::endl;
245 std::cout <<
" |-> city adults: " << nbrSingle + nbrCouple << std::endl;
248 std::cout <<
" |-> city children: " << nbrChild << std::endl;
263 std::list<AGHousehold>::iterator it;
266 shortage = !it->allocateChildrenSchool();
290 std::list<AGHousehold>::iterator it;
298 if (it->retiredHouseholders()) {
301 shortage = !it->allocateAdultsWork();
303 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;
370 if (newRate < 0 || newRate >= 1) {
377 it->generateCars(newRate);
379 nbrAdults += it->getAdultNbr();
403 std::cout <<
"first completed in getStreet() of City: Consolidation of data not needed in ActivityGen any more" << std::endl;
406 std::vector<AGStreet*>::iterator it =
streets.begin();
408 if ((*it)->getID() == edge) {
413 std::cout <<
"===> ERROR: WRONG STREET EDGE (" << edge <<
") given and not found in street set." << std::endl;
414 throw (std::runtime_error(
"Street not found with edge id " + edge));
420 throw (std::runtime_error(
"No street found in this city"));
An adult person who can have a job.
std::vector< AGStreet * > streets
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(std::mt19937 *rng=nullptr)
Returns a random real number in [0, 1)
static const T & getRandomFrom(const std::vector< T > &v, std::mt19937 *rng=0)
Returns a random element from the given vector.