Collection<String> all_airlines = profile.getAirlineCodes();
Histogram<String> histogram = new ObjectHistogram<String>();
histogram.put(all_airlines);
// Embed a Gaussian distribution
Gaussian gauss_rng = new Gaussian(rng, 0, all_airlines.size());
this.airlines = new FlatHistogram<String>(gauss_rng, histogram);
// Flights Per Airport
histogram = profile.getHistogram(SEATSConstants.HISTOGRAM_FLIGHTS_PER_AIRPORT);
this.airports = new FlatHistogram<String>(rng, histogram);
for (String airport_code : histogram.values()) {
histogram = profile.getFightsPerAirportHistogram(airport_code);
assert(histogram != null) : "Unexpected departure airport code '" + airport_code + "'";
this.flights_per_airport.put(airport_code, new FlatHistogram<String>(rng, histogram));
} // FOR
// Flights Per Departure Time
histogram = profile.getHistogram(SEATSConstants.HISTOGRAM_FLIGHTS_PER_DEPART_TIMES);
this.flight_times = new FlatHistogram<String>(rng, histogram);
// Figure out how many flights that we want for each day
this.today = new TimestampType();
// Sometimes there are more flights per day, and sometimes there are fewer
int flightsPerDayMin = (int)Math.round(SEATSConstants.FLIGHTS_PER_DAY_MIN * getScaleFactor());
int flightsPerDayMax = (int)Math.round(SEATSConstants.FLIGHTS_PER_DAY_MAX * getScaleFactor());
Gaussian gaussian = new Gaussian(rng, flightsPerDayMin, flightsPerDayMax);
this.total = 0;
boolean first = true;
for (long t = this.today.getTime() - (days_past * SEATSConstants.MICROSECONDS_PER_DAY);
t < this.today.getTime(); t += SEATSConstants.MICROSECONDS_PER_DAY) {
TimestampType timestamp = new TimestampType(t);
if (first) {
this.start_date = timestamp;
first = false;
}
int num_flights = gaussian.nextInt();
this.flights_per_day.put(timestamp, num_flights);
this.total += num_flights;
} // FOR
if (this.start_date == null) this.start_date = this.today;
profile.setFlightStartDate(this.start_date);
// This is for upcoming flights that we want to be able to schedule
// new reservations for in the benchmark
profile.setFlightUpcomingDate(this.today);
for (long t = this.today.getTime(), last_date = this.today.getTime() + (days_future * SEATSConstants.MICROSECONDS_PER_DAY);
t <= last_date; t += SEATSConstants.MICROSECONDS_PER_DAY) {
TimestampType timestamp = new TimestampType(t);
int num_flights = gaussian.nextInt();
this.flights_per_day.put(timestamp, num_flights);
this.total += num_flights;
} // FOR
// Update profile