public void init (BrokerProxy proxy, int seedId, RandomSeedRepo randomSeedRepo, TimeslotRepo timeslotRepo) { log.info("init(" + seedId + ") " + getUsername()); this.brokerProxyService = proxy; this.timeslotRepo = timeslotRepo; // set up the random generator this.seed = randomSeedRepo.getRandomSeed(CpGenco.class.getName(), seedId, "bid"); normal01 = new NormalDistribution(0.0, 1.0); normal01.reseedRandomGenerator(seed.nextLong()); // set up the supply-curve generating function if (!function.validateCoefficients(coefficients)) log.error("wrong number of coefficients for quadratic"); int to = Competition.currentCompetition().getTimeslotsOpen(); timeslotCoefficients = new double[to][getCoefficients().size()]; }
public void init (BrokerProxy proxy, int seedId, ContextService service) { log.info("init(" + seedId + ") " + getUsername()); timeslotsOpen = Competition.currentCompetition().getTimeslotsOpen(); this.brokerProxyService = proxy; //this.service = service; this.timeslotRepo = (TimeslotRepo)service.getBean("timeslotRepo"); this.weatherReportRepo = (WeatherReportRepo)service.getBean("weatherReportRepo"); this.weatherForecastRepo = (WeatherForecastRepo)service.getBean("weatherForecastRepo"); RandomSeedRepo randomSeedRepo = (RandomSeedRepo)service.getBean("randomSeedRepo"); // set up the random generator this.tsSeed = randomSeedRepo.getRandomSeed(MisoBuyer.class.getName(), seedId, "ts"); // compute offsets for daily and weekly seasonal data int ts = timeslotRepo.currentSerialNumber(); timeslotOffset = ts; DateTime start = timeslotRepo.getDateTimeForIndex(ts); dailyOffset = start.getHourOfDay(); weeklyOffset = (start.getDayOfWeek() - 1) * 24 + dailyOffset; timeseries = new ComposedTS(); timeseries.initialize(ts); }
competition.getTimeslotsOpen()); Timeslot newTs = timeslotRepo.findBySerialNumber(newSerial); if (newTs == null) {
competition.getTimeslotsOpen());