Exemple #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 - t_s(j))}.
        # - chooses his bid b' for the next round so as to
        # satisfy the following equation:
        # clicks_{s*_j} (v_j - t_{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, bid the value v_j

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

        # TODO: Fill this in.
        bid = 0  # change this

        # not expecting to win
        if min_bid > self.value:
            bid = self.value
        # otherwise
        elif slot != 0:
            # ratio of ctr is the same as ratio of positional effect
            bid = self.value - (ctr(t, slot) /
                                ctr(t, slot - 1)) * (self.value -
                                                     (min_bid + 1))
        else:
            bid = self.value

        # pjh: we've got the target, just need to choose bid to
        # satsify the equation above
        # if t == 47:
        #     print("New Agent:")
        #     print(self.id)
        #     print(t)
        #     print(history.agents_spent[self.id])
        #     print()

        return bid
Exemple #2
0
    def expected_utils(self, t, history, reserve):
        """
        Figure out the expected utility of bidding such that we win each
        slot, assuming that everyone else keeps their bids constant from
        the previous round.

        returns a list of utilities per slot.
        """

        info = self.slot_info(t, history, reserve)

        utilities = map(lambda j: ctr(t,j)*(self.value - ( info[j][1] + 1 ) ), range(len(info)))

        return utilities
Exemple #3
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 - t_s(j))}.
        # - chooses his bid b' for the next round so as to
        # satisfy the following equation:
        # clicks_{s*_j} (v_j - t_{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, bid the value v_j

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

        # TODO: Fill this in.
        bid = 0  # change this

        # not expecting to win
        if min_bid > self.value:
            bid = self.value
        # otherwise
        elif slot != 0:
            # ratio of ctr is the same as ratio of positional effect
            bid = self.value - ( ctr(t,slot)/ctr(t,slot-1) ) * ( self.value - (min_bid + 1) )
        else:
            bid = self.value

        # pjh: we've got the target, just need to choose bid to
        # satsify the equation above
        # if t == 47:
        #     print("New Agent:")
        #     print(self.id)
        #     print(t)
        #     print(history.agents_spent[self.id])
        #     print()

        return bid
Exemple #4
0
    def expected_utils(self, t, history, reserve):
        """
        Figure out the expected utility of bidding such that we win each
        slot, assuming that everyone else keeps their bids constant from
        the previous round.

        returns a list of utilities per slot.
        """

        info = self.slot_info(t, history, reserve)

        utilities = map(lambda j: ctr(t, j) * (self.value - (info[j][1] + 1)),
                        range(len(info)))

        return utilities
Exemple #5
0
import base64

import util

s = base64.b64decode('L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syLXzhPweyyMTJULu/6/kXX0KSvoOLSFQ==')

print(util.ctr(s, b'YELLOW SUBMARINE').decode())
Exemple #6
0
import base64

import util

s = base64.b64decode(
    'L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syLXzhPweyyMTJULu/6/kXX0KSvoOLSFQ==')

print(util.ctr(s, b'YELLOW SUBMARINE').decode())