@Override public double getTariffChoiceSample () { return gen.nextDouble(); }
void initialize (int ts) { // set up the ring buffer ring = new double[timeslotsOpen]; // set up the white noise generator lastWalk = tsSeed.nextGaussian() * walkSd; lastSmooth = lastWalk; }
public TariffEvaluationWrapper (String type, CustomerInfo customer) { this.type = type; customerInfo = customer; day = gen.nextInt(VillageConstants.DAYS_OF_BOOTSTRAP + VillageConstants.DAYS_OF_COMPETITION); }
/** * Constructor that creates a new seed with a random value. * To keep the logfile simple, constructors are not logged in this * class; only the init() method is logged. */ public RandomSeed (String classname, long requesterId, String purpose) { super(); this.value = this.nextLong(); init(classname, requesterId, purpose, value); }
|| ((minCost == cost) && gen.nextFloat() > OfficeComplexConstants.SAME)) { minCost = cost; minIndex = j; || minIndex == -1) { minIndex = (int) (gen.nextDouble() * counter) + OfficeComplexConstants.START_OF_LAUNCH_BREAK_HOUR - 1;
private TariffEvaluator createTariffEvaluator () { TariffEvaluationWrapper wrapper = new TariffEvaluationWrapper(); TariffEvaluator te = new TariffEvaluator(wrapper); te.initializeInconvenienceFactors(config.getTouFactor(), config.getTieredRateFactor(), config.getVariablePricingFactor(), config.getInterruptibilityFactor()); double weight = generator.nextDouble() * config.getWeightInconvenience(); double expDuration = config.getMinDefaultDuration() + generator.nextInt(config.getMaxDefaultDuration() - config.getMinDefaultDuration()); te.withInconvenienceWeight(weight) .withInertia(config.getNsInertia()) .withPreferredContractDuration(expDuration) .withRationality(config.getRationalityFactor()) .withTariffEvalDepth(config.getTariffCount()) .withTariffSwitchFactor(config.getBrokerSwitchFactor()); te.initializeRegulationFactors(car.getHomeChargeKW() * car.getCurtailmentFactor(), car.getHomeChargeKW() * car.getDischargeFactor(), car.getHomeChargeKW() * car.getDownRegFactor()); return te; }
/** * This function fills out the vector containing the days that the person is * going to be sick. When a person is sick he stays in bed. * * @param mean * @param dev * @return vector with sick days */ Vector<Integer> createSicknessVector (double mean, double dev) { // Create auxiliary variables int days = (int) (dev * gen.nextGaussian() + mean); Vector<Integer> v = new Vector<Integer>(days); for (int i = 0; i < days; i++) { int x = gen.nextInt(OfficeComplexConstants.DAYS_OF_COMPETITION + OfficeComplexConstants.DAYS_OF_BOOTSTRAP) + 1; ListIterator<Integer> iter = v.listIterator(); while (iter.hasNext()) { int temp = (int) iter.next(); if (x == temp) { x = x + 1; iter = v.listIterator(); } } v.add(x); } java.util.Collections.sort(v); return v; }
int rand = gen.nextInt(temp.size()); int quarter = temp.get(rand); if (gen.nextFloat() > VillageConstants.STORAGE_HEATER_POSSIBILITY) start = (VillageConstants.STORAGE_HEATER_START + 1) + gen.nextInt(VillageConstants.STORAGE_HEATER_START - 1); else start = 1 + gen.nextInt(VillageConstants.STORAGE_HEATER_START);
private void ensureSeeds () { if (null == opSeed) { RandomSeedRepo repo = service.getRandomSeedRepo(); opSeed = repo.getRandomSeed( LiftTruck.class.getName() + "-" + name, 0, "model"); evalSeed = repo.getRandomSeed( LiftTruck.class.getName() + "-" + name, 0, "eval"); normal = new NormalDistribution(0.0, 1.0); normal.reseedRandomGenerator(opSeed.nextLong()); } }
|| ((minCost == cost) && gen.nextFloat() > OfficeComplexConstants.SAME)) { minCost = cost; minIndex = j; || minIndex == -1) { minIndex = (int) (gen.nextDouble() * counter) + OfficeComplexConstants.START_OF_FUNCTION_HOURS;
int days = (int) (dev * gen.nextGaussian() + mean); Vector<Integer> v = new Vector<Integer>(days); gen.nextInt(VillageConstants.DAYS_OF_COMPETITION + VillageConstants.DAYS_OF_BOOTSTRAP) + 1; ListIterator<Integer> iter = v.listIterator();
private void ensureSeeds () { if (null == opSeed) { RandomSeedRepo repo = service.getRandomSeedRepo(); opSeed = repo.getRandomSeed( ColdStorage.class.getName() + "-" + name, 0, "model"); evalSeed = repo.getRandomSeed( ColdStorage.class.getName() + "-" + name, 0, "eval"); normal01 = new NormalDistribution(0.0, 1.0); normal01.reseedRandomGenerator(opSeed.nextLong()); } }
@Override public double getTariffChoiceSample () { return evalSeed.nextDouble(); }
|| ((minCost == cost) && gen.nextFloat() > VillageConstants.SAME)) { minCost = cost; minIndex = j; minIndex = (int) (gen.nextDouble() * possibleHours.size());
double generateValue (int ts) { // retrieve daily value, add daily noise double dv = getDailyValue(ts) + tsSeed.nextGaussian() * dailySd; // retrieve weekly value, add weekly noise double wv = getWeeklyValue(ts) + tsSeed.nextGaussian() * weeklySd; // run a step of the random walk, return sum lastWalk = (1.0 - walkz) * lastWalk + tsSeed.nextGaussian() * walkSd; lastSmooth = walkAlpha * lastWalk + (1.0 - walkAlpha) * lastSmooth; double result = mean + dv + wv + lastSmooth; log.debug("Demand ts {}: {}", ts, result); return result; }
/** * This function selects the shift of the worker. There three different * shifts: 00:00 - 08:00 08:00 - 16:00 and 16:00 - 24:00. * * @param gen * @return */ int createWorkingStartHour () { int x = gen.nextInt(VillageConstants.NUMBER_OF_SHIFTS); return (x * VillageConstants.HOURS_OF_SHIFT_WORK * VillageConstants.QUARTERS_OF_HOUR); }
randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("WaterHeaterSaturation")); int x = 1 + gen.nextInt(VillageConstants.PERCENTAGE); int limit = Integer.parseInt(conf.getProperty("InstantHeater")); power = (int) (VillageConstants.INSTANT_HEATER_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.INSTANT_HEATER_POWER_MEAN); cycleDuration = VillageConstants.INSTANT_HEATER_DURATION_CYCLE; type = HeaterType.InstantHeater; power = (int) (VillageConstants.STORAGE_HEATER_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.STORAGE_HEATER_POWER_MEAN); cycleDuration = VillageConstants.STORAGE_HEATER_DURATION_CYCLE; type = HeaterType.StorageHeater;
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()]; }