47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
126 if (trip.
getType() !=
"default") {
132 depTime += variation;
133 if (depTime.getDay() > 0) {
134 trip.
setDay(depTime.getDay());
135 trip.
setDepTime(depTime.getSecondsInCurrentDay());
146 if (trips.size() != 0) {
147 std::list<AGTrip>::iterator it;
149 int firstTrip = trips.front().getTime() + trips.front().getDay() * 86400;
150 int lastTrip = trips.front().getTime() + trips.front().getDay() * 86400;
151 std::map<int, int> histogram;
152 for (
int i = 0; i < 100; ++i) {
156 for (it = trips.begin(); it != trips.end(); ++it) {
159 if (it->getTime() + 86400 * it->getDay() > lastTrip) {
160 lastTrip = it->getTime() + 86400 * it->getDay();
162 if (it->getTime() + 86400 * it->getDay() < firstTrip) {
163 firstTrip = it->getTime() + 86400 * it->getDay();
166 ++histogram[(it->getTime()) / 3600];
174 for (
int i = 0; i < 100; ++i) {
175 if (histogram[i] > 0) {
176 std::cout <<
"histogram[ hour " << i <<
" ] = " << histogram[i] << std::endl;
180 std::cout <<
"No real trips were generated" << std::endl;
199 std::list<AGTrip> expTrips;
200 std::map<std::string, int> carUsed;
201 std::list<AGTrip>::iterator it;
203 for (it = acts.
trips.begin(); it != acts.
trips.end(); ++it) {
206 AGTrip tr(it->getDep(), it->getArr(), it->getVehicleName(), it->getTime(), currday);
208 if (carUsed.find(tr.getVehicleName()) != carUsed.end()) {
209 ++carUsed.find(tr.getVehicleName())->second;
211 carUsed[tr.getVehicleName()] = 1;
213 std::ostringstream os;
214 os << tr.getVehicleName() <<
":" << carUsed.find(tr.getVehicleName())->second;
215 tr.setVehicleName(os.str());
216 tr.addLayOverWithoutDestination(*it);
219 expTrips.push_back(tr);
225 AGTrip tr(it->getDep(), it->getArr(), it->getVehicleName(), it->getTime(), it->getDay());
227 if (carUsed.find(tr.getVehicleName()) != carUsed.end()) {
228 ++carUsed.find(tr.getVehicleName())->second;
230 carUsed[tr.getVehicleName()] = 1;
232 std::ostringstream os;
233 os << tr.getVehicleName() <<
":" << carUsed.find(tr.getVehicleName())->second;
234 tr.setVehicleName(os.str());
235 tr.addLayOverWithoutDestination(*it);
238 expTrips.push_back(tr);
245 std::cout <<
"total trips generated: " << acts.
trips.size() << std::endl;
246 std::cout <<
"total trips finally taken: " << expTrips.size() << std::endl;
252 std::cout <<
"...sorted by departure time.\n" << std::endl;
void generateActivityTrips()
void varDepTime(AGTrip &trip)
OutputDevice & outputFile
The generated routes.
AGDataAndStatistics & statData
static SUMOReal randNorm(SUMOReal mean, SUMOReal variance, MTRand &rng=myRandomNumberGenerator)
Access to a random number from a normal distribution.
void setType(std::string type)
bool timeTripValidation(AGTrip)
validation: compatibility of the given trip
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)
void addTrip(AGTrip trip)
void generateOutputFile(std::list< AGTrip > &trips)
generate the output file (trips or routes) using a trip list
void importInfoCity()
build the internal city
#define PROGRESS_DONE_MESSAGE()
const std::string & getType() const