Filtering Using Priority Vector and "Types"

Here, we demonstrate how we can filter IGs by "type". This leverages the priority filtering feature available in Fledge. While this is not the only way (or likely the best), it serves as a starting point.

Setup

We will join 3 IGs hardcoded to each bid a different amount. Since they are hardcoded they will always bid if present, and the scoreAds function returns the bid as the score, so the highest bid will win each time.

However, we will also provide "type filters" on the IGs priorityVector, and then demonstrate that the IGs are filtered for the auction by seeing the non-highest bidding win, b/c it was the only one invited. (Note this is not limited to a single IG, this is for demo purposes).

Steps

  1. We will join one IG each for kyle, cartman, and kenny. Each IG will use their name as the type, part of the IG name, and refer to a creative of their name (.png) and bidding function of their name. Kyle's IG will always bid $4, Kenny always $3, and Cartman always $2. Therefore, if we don't filter, Kyle will always win; if we filter then that IG will win.
    IG joining code here. Bidding functions for Kyle, Cartman, and Kenny.
  2. We then run the auctions. The filter is accomplished by first putting two fields in the IG priorityVector: a known constant b, set to 1, and then a type for the given character, set to 1. Then, during the auction we use the `b` to initially set every IG to negative, followed by only adding 2 if the type is the target; this means that only the target IG will have a priority >= 0, which means it will be the only one that bids.
    Auction Running here. see priorityVector and prioritySignals.

We run in order:

  1. No Filter: should result in image of Kyle.
  2. Filter=cartman, should result in image of Cartman.
  3. Filter=kenny, should result in image of Kenny.
  4. Filter=kyle, should result in image of Kyle. (is the default anyway, but just for fun).

The results are appended into the 'resultsgohere' element, and we await results, so should appear in order.