From: Meino Christian Cramer Date: 2006-07-09T04:41:36+09:00 Subject: Re: Algorithm searched ... From: Yohanes Santoso Subject: Re: Algorithm searched ... Date: Sun, 9 Jul 2006 04:34:24 +0900 Hi Yohanes ! Thank you very much fior your reply and your program! :) Nice to know, that others Rubyist has same problems. Far nicer to know, that they have already solved the problem, hahahaha ! In another thread in this mailinglist there is a discussion why to prefer Ruby. The friendly replies to my initial posting are the expression of one *BIG* reason (at least for me) for that. Have a nice weekend ! :) mcc > Meino Christian Cramer writes: > > > It may be that this is equivalent to the "backpacker's problem" -- > > This problem is known as the binary (0/1) knapsack problem. > There is a program called ``bestfit`` > (http://oskarsapps.mine.nu/bestfit.html) that would find the optimal > solution. > > I do not use that because I prefer similarly named files to be put in > a media. So, I wrote my own implementation (attached) that solved that > using greedy approximation. You can choose whether to group by name or > by size. > > For my files, the grouping produced by the greedy approximation (both > by name or size) is about 90% close to the optimum grouping. It is > acceptable for me. You may find it useful. > > > YS. > >