0/1 knapsack-like minimalization problem and file system access
- To: mathgroup at smc.vnet.net
- Subject: [mg108755] 0/1 knapsack-like minimalization problem and file system access
- From: Peter Sisak <p-kun80 at hotmail.com>
- Date: Tue, 30 Mar 2010 05:02:10 -0500 (EST)
Given the files in a directory, by what method can I receive the list of the files that in size is closest to, but not larger than, an arbitrary x value, given in bytes? Each file can be listed at most once. The file names and their respective sizes must be read in by Mathematica. (The directory contains files with count of around two-three hundred, thus making a brute force "sum then compare" search of all possible combinations would most probably not finish before the next ice age coming...) An extension to the above problem: how to find the lists of files, if there are more than one lists permitted, and the aim is to minimise the total difference between the respective groups and the (identical) x value? (Think archiving data using the least amount of identical-type CDs, or wasting the least amount, and leaving the few odd ones out.) Any ideas how to pull this? Thanks in advance Peter Sisak