7

尝试对以下内容进行一些研究,但没有成功。以为我会在这里问,以防有人以前遇到过。

我帮助一个志愿者经营的广播电台满足他们的技术需求。出现的主要事情之一是他们希望以编程方式安排他们的广告。

有很多简洁而复杂的广告规则引擎,但我们所需要的只是一些非常简单的东西(以及任何值得思考的经验)。

如果可能的话,我想用 SQL 写一些东西来处理这些实体。理想情况下,如果有人为其他广告媒体(网络等)写过类似的东西,那将非常有帮助。

实体:

  • 广告(包括类别、每天播放次数、开始日期、结束日期或永久播放)
  • 广告类别(餐厅、健康、食品店等)

为了过度简化问题,这将是一个优雅的 sql 语句。到达那里... :)

我希望能够使用上述两个实体每天生成一个播放列表,其中:

  • 在彼此的 x 个广告内没有播放同一类别的两个广告。
  • (很高兴)可以推送高促销广告

此时,没有“广告位”可以填充。没有“一天中的时间”考虑。

我们将当天的广告排成队列,并在歌曲/节目之间浏览它们等。我们知道每小时必须填充多少,等等。

任何想法/想法/链接/示例?我将继续寻找并希望能遇到一些东西,而不是长期学习。

4

2 回答 2

1

非常有趣的问题,SMO。现在它看起来像一个约束规划问题,因为您不是在寻找一个最佳解决方案,只是一个满足您指定的所有约束的解决方案。对于那些想要结束这个问题的人,我想说他们需要检查一下约束编程。它比任何运筹学网站都更接近于 stackoverflow。

研究约束规划和调度——我敢打赌你会发现一个类似的问题太甜了!

请让我们随时了解您的进展。

于 2010-06-05T02:39:58.393 回答
0

暂时忽略 T-SQL 请求,因为这不太可能是编写此代码的最佳语言......

One of my favorites approaches to tough 'layout' problems like this is Simulated Annealing. It's a good approach because you don't need to think HOW to solve the actual problem: all you define is a measure of how good the current layout is (a score if you will) and then you allow random changes that either increase or decrease that score. Over many iterations you gradually reduce the probability of moving to a worse score. This 'simulated annealing' approach reduces the probability of getting stuck in a local minimum.

So in your case the scoring function for a given layout might be based on the distance to the next advert in the same category and the distance to another advert of the same series. If you later have time of day considerations you can easily add them to the score function.

Initially you allocate the adverts sequentially, evenly or randomly within their time window (doesn't really matter which). Now you pick two slots and consider what happens to the score when you switch the contents of those two slots. If either advert moves out of its allowed range you can reject the change immediately. If both are still in range, does it move you to a better overall score? Initially you take changes randomly even if they make it worse but over time you reduce the probability of that happening so that by the end you are moving monotonically towards a better score.

Easy to implement, easy to add new 'rules' that affect score, can easily adjust run-time to accept a 'good enough' answer, ...

Another approach would be to use a genetic algorithm, see this similar question: Best Fit Scheduling Algorithm this is likely harder to program but will probably converge more quickly on a good answer.

于 2010-06-05T02:59:38.500 回答