@Before public void setup() { slotInfo = new SlotInfo(); repository = new SimpleAgentRepository(); salesReportSender = new SimpleSalesReportSender(); advertiserInfo = new HashMap<String, AdvertiserInfo>(); AdvertiserInfo info = new AdvertiserInfo(); info.setDistributionWindow(2); info.setDistributionCapacity(10); alice = "alice"; advertiserInfo.put(alice, info); salesAnalyst = new DefaultSalesAnalyst(repository, salesReportSender, 1); }
public static double calculateConversionProbability( User user, Query query, AdvertiserInfo advertiserInfo, double sales) { double criticalSales = advertiserInfo.getDistributionCapacity(); double probability = advertiserInfo.getFocusEffects(query.getType()) * Math.pow( advertiserInfo.getDistributionCapacityDiscounter(), Math.max(0.0, sales - criticalSales)); probability = modifyOddsForComponentSpecialty( user, advertiserInfo.getComponentSpecialty(), advertiserInfo.getComponentBonus(), probability); return probability; }