public static ArrayList<ItemType> mockItems( int numberOfItems, Collection<CategoryNode> categories) { Random r = new Random(); ArrayList<ItemType> items = new ArrayList<>(); ExponentialDistribution exp1 = new ExponentialDistribution(1); int averageValuation = 6195; // from TM data int minimumValuation = 400; ExponentialDistribution exp2 = new ExponentialDistribution(averageValuation); for (int i = 0; i < numberOfItems; i++) { double weight = exp1.sample(); int trueValuation; do { trueValuation = (int) (exp2.sample() + 0.5); } while (trueValuation < minimumValuation); ItemType item = new ItemType( weight, "type" + (int) (weight * 10000), trueValuation, CategoryRecord.randomCategory(categories, r.nextDouble())); items.add(item); } CreateItemTypes.normaliseWeights(items); return items; }
private void submitAuction() { double logParam = 2.5; // from TM data. See countCategorySpread.xlsx ItemType type; if (useNewAuctionCategory(++auctionsSubmitted, logParam, r.nextDouble())) { // pick a new type type = CreateItemTypes.pickType(itemTypes, r.nextDouble()); itemTypesUsed.add(type); } else { // use an previously used type type = chooseOldItemType(logParam, itemTypesUsed, r.nextDouble()); } Item newItem = new Item(type, "item" + r.nextInt(100000)); double popularity; if (r.nextDouble() < 0.5) popularity = 0.7; else popularity = 1; Auction auction = new Auction(this, newItem, 2016, 100, 0, popularity); this.bh.getAuctionMessagesToAh().put(auction); }