예제 #1
0
    def bid(self, t, history, reserve):
        # The Balanced bidding strategy (BB) is the strategy for a player j that, given
        # bids b_{-j},
        # - targets the slot s*_j which maximizes his utility, that is,
        # s*_j = argmax_s {clicks_s (v_j - p_s(j))}.
        # - chooses his bid b' for the next round so as to
        # satisfy the following equation:
        # clicks_{s*_j} (v_j - p_{s*_j}(j)) = clicks_{s*_j-1}(v_j - b')
        # (p_x is the price/click in slot x)
        # If s*_j is the top slot, we (arbitrarily) choose
        #        b' = (v_j + p_0(j)) / 2. We can 
        # thus deal with all slots uniformly by defining clicks_{-1} = 2 clicks_0.
        #

        # initialize parameters
        if self.NUMBER_OF_PLAYERS == 0 or self.TOTAL_CLICKS == 0 or self.NUMBER_OF_SLOTS == 0:
            self.initialize_parameters(t, history)
            # print "Number of players: ", self.NUMBER_OF_PLAYERS
            # print "Number of slots: ", self.NUMBER_OF_SLOTS
            # print "Total clicks", self.TOTAL_CLICKS

        prev_round = history.round(t-1)
        
        (slot, min_bid, max_bid) = self.target_slot(t, history, reserve)

        num_default = self.defaults(t, history, reserve)

        bid = 0
        if num_default == 0:
            bid = (min_bid + max_bid)/2
        elif num_default > 0 and num_default <= 1:
            bid = (.25*min_bid + .75*max_bid)
        elif num_default > 1:
            bid = max_bid

        budget_effect = self.budget_factor(t, history, reserve)
        click_effect = self.clicks_factor(t)

        # print "defaults: ", num_default
        # print "bid (pre factors): ", bid, min_bid, max_bid
        # print "slot: ", slot
        # print "budget: ", budget_effect
        # print "click: ", click_effect
  
        bid = bid*budget_effect*click_effect

        if bid > max_bid:
            bid = max_bid

        if bid > self.value:
            bid = self.value
        if bid < reserve+1.01 and reserve+1.01 < self.value:
            return reserve+1.01

        if self.value < 75 and budget_effect > 1:
            return self.value

        return iround(bid)-0.01
예제 #2
0
 def clicks_slot(self, t, slot):
     return iround(iround(30*math.cos(math.pi*t/24) + 50)*(.75**slot))