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:

 - Song 1 : 1:30 
 - Song 2 : 2:56 
 - Song 3 : 3:56 
 - Song 4 : 4:54 
 - Song 5 : 1:00

Maximum duration: 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). 

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. 

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. 

Any help would be appreciated, just trying to figure out how to begin approaching this problem, Thanks!