The go-to-weight selection in ads

Source: Internet
Author: User

The go-to-weight selection in ads

in the ad presentation strategy, there are some needs to go heavy. This article describes the details of a de-weight issue.

Give an example of an advertiser's weight. If you can show three ads at a time on the page, advertisers will be unhappy if we show two ads that are the same advertiser. Because he will feel his impressions are imaginary, for him is a show, but to his report is said to be two times.

Give another example of the material to be heavy. If a user in the Web browsing, see a lot of similar footage very close to the ads, he will be a little disgusted, and usually do not click on multiple similar footage of the ads, which for advertisers, advertising audiences, advertising platform is unfavorable.

See this problem, the first reaction will be this is what the problem ah, simple to go to the weight of it can not? Yes, it can be solved, but is this the best solution?

I give an example, each of the blocks represents a candidate ad, an ad has two attributes, in two colors, the same color can not be duplicated in the same attribute, altogether need 2 ads.

Now look at the simple go-to-heavy logic, we first selected ad 1, ad 1 's first attribute ( dark brown ) with ad 2 The first attribute conflict, the second attribute of ad 1 (dark blue) conflicts with the second attribute in AD 3 . So ad 1 can only be paired with ad 4 , and the sum of their two values is 9+1=10.

And a change of mind, do not have to choose the first ad to go heavy, then we choose Ads 2 and ad 3, their value of the sum is 8+7=15. This means that simple de-refactoring is not an optimal strategy.

With the above problem, we formalize it into an algorithmic problem. There are N candidate ads, each ad shows the value of Vi (i=[1, ... N]),N candidate ads have been sorted by value, and a show requires K ads. Now to find out the value of K and the largest advertising.

And then a little explanation of the above questions, candidate ads have been sorted by value, which is the logical decision in the advertising system.

After reading the question, the first reaction should be that this is not the 0/1 knapsack problem? But think about it, and 0/1 knapsack problem is a bit different,1.0/1 knapsack problem in the weight Here is the same, an ad to occupy a display position, The ad is the same space as the ad (we're not going to diverge from the mix of material specifications now), but the difference is just that it's a special case of the 0/1 knapsack problem. 2. N candidates have been sorted by value and sorted by value, so they can be pruned ahead of time.

Talk is cheap, Show me the Code

Ad_count = Ad_list.size ();

Current_max_value = 0;

Required_ad_count = 4;

Fetch_list = []

Findmaxvalue (index, Sum_value, fetch_list)

If Index >= ad_count

If Sum_value > Current_max_value

Current_max_value = Sum_value

Fetch_list = fetch_list;

return;

If fetch_list.size () = = Required_ad_count

If Sum_value > Current_max_value

Current_max_value = Sum_value

Fetch_list = fetch_list;

return;

if (Pruning (index, Fetch_count, Sum_value))

return;

value = Ad_list[index].value;

Copy_sum_value = Sum_value;

Copy_index = Index

Copy_fetch_list = Fetch_list.deep_copy ();

Findmaxvalue (index + 1, sum_value, fetch_list);

Copy_sum_value + = value;

Copy_fetch_list fetch_list.append (index);

Copy_index + = 1;

Findmaxvalue (Copy_index, Copy_sum_value, copy_fetch_list);

Pruning (index, Fetch_count sum_value)

int max_value = Sum_value;

Remain_count = Required_ad_count-fetch_count;

For i = Index to Remain_count

If index >= ad_count &&

Max_value < Current_max_value

return true;

Max_value + = Ad_list[i].value;

If Max_value < Current_max_value

return true;

return false;

The go-to-weight selection in ads

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.