public TariffEvaluator (CustomerModelAccessor cma) { accessor = cma; customerInfo = cma.getCustomerInfo(); helper = new TariffEvaluationHelper(); evaluatedTariffs = new HashMap<>(); allocations = new LinkedHashMap<>(); }
if (tariff.getBroker() != currentTariff.getBroker()) { inconvenience += accessor.getBrokerSwitchFactor(revoked); remainingPopulation -= count; double inertiaSample = accessor.getInertiaSample(); if (!revoked && withdraw0 <= 0.0 && signupCost <= 0.0 && inertiaSample < inertia) { double tariffSample = accessor.getTariffChoiceSample();
private double forecastCost (Tariff tariff) { CapacityProfile profile = accessor.getCapacityProfile(tariff); if (0 == profile.getProfile().length) { log.error("Zero-length profile for " + customerInfo.getName()); return 0.0; } setProfileLength(profile.getProfile().length); // NOTE: must call the next function after the previous, // since the previous writes inconv. factors. // Always 0 except for AdaptiveCapacityOriginator double inconv = accessor.getShiftingInconvenienceFactor(tariff); double profileCost = helper.estimateCost(tariff, profile.getProfile(), profile.getStart()); if (Double.isNaN(profileCost)) { log.error(getName() + ": profile cost NaN for tariff " + tariff.getId()); } //double scale = preferredDuration * 24.0 / profile.length; double scale = stdDuration * 24.0 / getProfileLength(); if (Double.isNaN(scale)) { log.error(getName() + ": scale NaN for tariff " + tariff.getId()); } log.debug("tariff {}: profileCost={}, inconv={}, scaled-charge={}, scaled (cost+inconv)={}", tariff.getId(), profileCost, inconv, profileCost * scale, (profileCost + inconv) * scale, (profileCost + inconv) * scale / (profileCost * scale)); return (profileCost + inconv) * scale; }