### Description When running a radio station it is generally a good idea to reduce dead air time. The current algorithm for adding tracks to a block/show can leave a lot of dead air time at the end as it doesn't use a very good algorithm. Adding tracks to a show until it is full while making it as full as possible is a well known problem in computer science. It is the [Subset Sum Problem](https://en.wikipedia.org/wiki/Subset_sum_problem). This PR implements a Randomized Greedy with Local Improvement (RGLI) approximation solution for the Subset Sum Problem. The new algorithm is only used when sort type is random and overflow is not enabled and there is no limit on the number of tracks that can be used. **This is a new feature**: Improvement on an existing feature. **I have not updated the documentation to reflect these changes**: I did not update the documentation because the current scheduling algorithm is not currently documented and its existing features have not changed. ### Testing Notes **What I did:** I first attempted a fully polynomial time approximation scheme solution, however it is really bad at finding good solutions for high density values and can kinda slow the more tracks/time you have. So I instead implemented an RGLI which is O(nlogn) and has been giving much better results. I implemented the solution in a separate project and tested it and timed the values with a normal distribution of 500 songs with a mean of 3 minutes and a standard deviation of 1 minute. With a show size of 1 hour the algorithm took around 10-15 ms to run. When adjusting the block size and track size the algorithm still was pretty quick to run. Am going to be testing on an instance with lots of tracks later, will update PR when I have done that. **How you can replicate my testing:** _How can the reviewer validate this PR?_ ### **Links** Closes #3018 |
||
---|---|---|
.. | ||
auth/adapters | ||
common | ||
configs | ||
controllers | ||
forms | ||
layouts/scripts | ||
logging | ||
models | ||
modules/rest | ||
services | ||
validate | ||
views | ||
Bootstrap.php | ||
airtime-boot.php | ||
assets.json | ||
check.php | ||
preload.php |