48 #ifdef CHECK_MEMORY_LEAKS 50 #endif // CHECK_MEMORY_LEAKS 127 if (trip.
getType() !=
"default") {
133 depTime += variation;
134 if (depTime.getDay() > 0) {
135 trip.
setDay(depTime.getDay());
136 trip.
setDepTime(depTime.getSecondsInCurrentDay());
147 if (trips.size() != 0) {
148 std::list<AGTrip>::iterator it;
150 int firstTrip = trips.front().getTime() + trips.front().getDay() * 86400;
151 int lastTrip = trips.front().getTime() + trips.front().getDay() * 86400;
152 std::map<int, int> histogram;
153 for (
int i = 0; i < 100; ++i) {
157 for (it = trips.begin(); it != trips.end(); ++it) {
160 if (it->getTime() + 86400 * it->getDay() > lastTrip) {
161 lastTrip = it->getTime() + 86400 * it->getDay();
163 if (it->getTime() + 86400 * it->getDay() < firstTrip) {
164 firstTrip = it->getTime() + 86400 * it->getDay();
167 ++histogram[(it->getTime()) / 3600];
173 std::cout <<
"first real trip: " << first.getDay() <<
", " << first.getHour() <<
":" << first.getMinute() <<
":" << first.getSecond() << std::endl;
175 for (
int i = 0; i < 100; ++i) {
176 if (histogram[i] > 0) {
177 std::cout <<
"histogram[ hour " << i <<
" ] = " << histogram[i] << std::endl;
181 std::cout <<
"No real trips were generated" << std::endl;
200 std::list<AGTrip> expTrips;
201 std::map<std::string, int> carUsed;
202 std::list<AGTrip>::iterator it;
204 for (it = acts.
trips.begin(); it != acts.
trips.end(); ++it) {
207 AGTrip tr(it->getDep(), it->getArr(), it->getVehicleName(), it->getTime(), currday);
209 if (carUsed.find(tr.getVehicleName()) != carUsed.end()) {
210 ++carUsed.find(tr.getVehicleName())->second;
212 carUsed[tr.getVehicleName()] = 1;
214 std::ostringstream os;
215 os << tr.getVehicleName() <<
":" << carUsed.find(tr.getVehicleName())->second;
216 tr.setVehicleName(os.str());
217 tr.addLayOverWithoutDestination(*it);
220 expTrips.push_back(tr);
226 AGTrip tr(it->getDep(), it->getArr(), it->getVehicleName(), it->getTime(), it->getDay());
228 if (carUsed.find(tr.getVehicleName()) != carUsed.end()) {
229 ++carUsed.find(tr.getVehicleName())->second;
231 carUsed[tr.getVehicleName()] = 1;
233 std::ostringstream os;
234 os << tr.getVehicleName() <<
":" << carUsed.find(tr.getVehicleName())->second;
235 tr.setVehicleName(os.str());
236 tr.addLayOverWithoutDestination(*it);
239 expTrips.push_back(tr);
246 std::cout <<
"total trips generated: " << acts.
trips.size() << std::endl;
247 std::cout <<
"total trips finally taken: " << expTrips.size() << std::endl;
253 std::cout <<
"...sorted by departure time.\n" << std::endl;
static SUMOReal randNorm(SUMOReal mean, SUMOReal variance, MTRand *rng=0)
Access to a random number from a normal distribution.
void generateActivityTrips()
void varDepTime(AGTrip &trip) const
OutputDevice & outputFile
The generated routes.
AGDataAndStatistics & statData
void setType(std::string type)
void makeActivityTrips(int days=1, int beginTime=0, int endTime=0)
build activities and trips of the population and generate routes
void generatePopulation()
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
SUMOReal departureVariation
#define PROGRESS_FAILED_MESSAGE()
void setDepTime(int time)
void generateWorkPositions()
std::list< AGTrip > trips
#define PROGRESS_BEGIN_MESSAGE(msg)
bool timeTripValidation(const AGTrip &trip) const
validation: compatibility of the given trip
void generateOutputFile(std::list< AGTrip > &trips)
generate the output file (trips or routes) using a trip list
void addTrip(const AGTrip &trip)
void importInfoCity()
build the internal city
#define PROGRESS_DONE_MESSAGE()
const std::string & getType() const