#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    England
    Posts
    5
    Rep Power
    0

    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.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    7
    Rep Power
    0
    Check out priority Queues, they should be able to do what you want with some tinkering
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    England
    Posts
    5
    Rep Power
    0
    Hi TEMM,

    Thanks for your suggestion. I will read up on priority queues and hopefully I'll be able to find a solution.

    Much appreciated.
  6. #4
  7. digital sinner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    sinner's land
    Posts
    68
    Rep Power
    12
    you could use an optimised backtracking alg.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    England
    Posts
    5
    Rep Power
    0
    Hi heinrich,

    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.

    Cheers mate
  10. #6
  11. digital sinner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    sinner's land
    Posts
    68
    Rep Power
    12
    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.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    England
    Posts
    5
    Rep Power
    0
    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.
  14. #8
  15. digital sinner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    sinner's land
    Posts
    68
    Rep Power
    12
    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).
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    England
    Posts
    5
    Rep Power
    0
    Oh I understand , thanks for your clarification.

    Thanks again for all your help.
  18. #10
  19. digital sinner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    sinner's land
    Posts
    68
    Rep Power
    12
    no pb, my pleasure. hope this helps. and hope to hear from you soon.

IMN logo majestic logo threadwatch logo seochat tools logo