[英]Given an array of objects of varying durations, how can you find all possible arrangements within a given time frame
So if you have a set objects that each have different duration values, like songs for example - and you want to create a bunch of playlists that all fit within a specific timeframe, what would be the easiest way of going about this? 因此,如果您有一组对象,每个对象具有不同的持续时间值(例如歌曲),并且想要创建一堆都适合特定时间范围的播放列表,那么最简单的方法是什么?
Example: 例:
Maximum duration: 5:00 最长持续时间:5:00
Possible Combinations: (Song 1, Song 2), (Song 2, Song 1), (Song 2, Song 5), (Song 5, Song 2), (Song 3, Song 5), (Song 5, Song 3), (Song 4). 可能的组合:(歌曲1,歌曲2),(歌曲2,歌曲1),(歌曲2,歌曲5),(歌曲5,歌曲2),(歌曲3,歌曲5),(歌曲5,歌曲3) ,(歌曲4)。
I am curious about neural networks, but do not know much about them or if they would be easily applied to this problem. 我对神经网络很好奇,但是对神经网络知之甚少,或者它们是否可以轻松地应用于此问题。 The target language is php. 目标语言是php。
It would be ideal if an allowed variance could be provided like +/- 0:30 so that generated playlists could fall either below or above the maximum limit by the given amount. 理想的情况是,可以提供允许的差异(例如+/- 0:30),以使生成的播放列表可以低于或高于最大限制达到给定的数量。
Any help would be appreciated, just trying to figure out how to begin approaching this problem, Thanks! 任何帮助将不胜感激,只是试图找出如何开始解决这个问题,谢谢!
This is a bin-packing problem. 这是一个装箱问题。 You can sort the list and then you can try to fill the time frames with the best fit,the next fit, the first fit or worst fit. 您可以对列表进行排序,然后尝试用最适合,最适合,最适合或最不适合的时间范围填充时间范围。 Imagine you have more then one time frame and you need to find the smallest amount of time frames with a given playlist. 假设您有一个以上的时间范围,并且您需要找到具有给定播放列表的最小时间范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.