Algorithm design, "randomising" timetable schedule in Python although open to other languages.

Posted by S1syphus on Stack Overflow See other posts from Stack Overflow or by S1syphus
Published on 2010-04-28T16:35:55Z Indexed on 2010/04/29 0:27 UTC
Read the original article Hit count: 933

Before I start I should add I am a musician and not a native programmer, this was undertook to make my life easier.

Here is the situation, at work I'm given a new csv file each which contains a list of sound files, their length, and the minimum total amount of time they must be played.

I create a playlist of exactly 60 minutes, from this excel file.

Each sample played the by the minimum number of instances, but spread out from each other; so there will never be a period where for where one sound is played twice in a row or in close proximity to itself.

Secondly, if the minimum instances of each song has been used, and there is still time with in the 60 min, it needs to fill the remaining time using sounds till 60 minutes is reached, while adhering to above.

The smallest duration possible is 15 seconds, and then multiples of 15 seconds.


Here is what I came up with in python and the problems I'm having with it, and as one user said its buggy due to the random library used in it.

So I'm guessing a total rethink is on the table, here is where I need your help.

Whats is the best way to solve the issue, I have had a brief look at things like knapsack and bin packing algorithms, while both are relevant neither are appropriate and maybe a bit beyond me.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about algorithm-design