March 8th, 2003, 12:13 PM
looking for algorithms
I need to write a couple of algorithms for a radio scheduling program I'm writing:
1) I need to organise a bunch of different Ads into a playlist. The ads are to be played various numbers of times. The rules are:
- the same ad should not be played consecutivley
- and I would like the same ads to be as far away from each other in the list as possible so its not repitive.
2) I need to select a number of ads from a pool to fill a certain length of time. That is a need to find a combination of ads that will fill the time. Also if no combination of ads will fit I need to find the best fit whether its slightly over or under
Any pointers, tips, links etc would be greatly appreciated as I am a total noobie to algorithms.
Thanks in advance.
March 16th, 2003, 11:08 AM
Check out priority Queues, they should be able to do what you want with some tinkering
March 16th, 2003, 09:38 PM
Thanks for your suggestion. I will read up on priority queues and hopefully I'll be able to find a solution.
March 24th, 2003, 01:58 AM
you could use an optimised backtracking alg.
March 24th, 2003, 02:23 PM
I will certainly investigate your suggestion , thanks very much.
Could you tell me whether you would use this approach to tackle the first or second problem.
March 26th, 2003, 12:24 PM
actually i think you could use a backtracking algorithm in both problems.
look on the internet for documentation on this kind of alg.
if you don't find anything, send me an email and i'll try to send you a more detailed explanation and maybe a solution.
but i have to tell you that this is not the best solution(the fastest), but since the first returned solution is enough for your program, i think it's very practical for you.
Last edited by heinrich; March 26th, 2003 at 12:26 PM.
March 26th, 2003, 04:17 PM
Oh I see, great, I'll read up on this.
Speed is not the prime concern and I suppose the first returned solution would be sufficient.
Out of interest though what is the fastest solution and what are its disadvantages over the backtracking approach.
Thanks for your help, I really appreciate it.
March 27th, 2003, 07:15 AM
if speed is not your concern, then you can use this alg. in both problems.
the disadvantage of backtracking is that it returnes all solutions and it tries all the posibilities(this is it's weak point), but you can optimize it and it will be faster.
And also you can stop the alg. when you get the 1st solution.
a faster solution (i don't know if it's the fastest) could be using graphs(i'm not sure how they are called in english; they are a more generalized form of binary trees).
March 27th, 2003, 08:39 AM
Oh I understand , thanks for your clarification.
Thanks again for all your help.
March 27th, 2003, 03:03 PM
no pb, my pleasure. hope this helps. and hope to hear from you soon.