Do you want an almost equal number of files in each group as well? A quick approach is to randomly split the files into groups, then repeatedly take a large file out of a too big group, and place it into a too small group. The average/target group size is quickly calculated.
Also take a small file out of a too long group, and place it into a too short group. ----- Original Message ----- From: Devon McCormick <devon...@gmail.com> To: J-programming forum <programm...@jsoftware.com> Sent: Friday, May 20, 2016 1:37 PM Subject: Re: [Jprogramming] Even partitions It's an arbitrary grouping so that the sum of file sizes in each group is nearly equal between groups. To roughly approximate a distribution, you could use something like this: szs=. (+/16 4000?@$400) + (+/8 4000?@$2e3) + (+/4 4000?@$5e5) + 4000?@$1e6 On May 20, 2016 10:48 AM, "David Porter" <dpor...@cissoid.net> wrote: > Groups based on what? > > Dave > On 5/20/2016 10:11 AM, Devon McCormick wrote: > >> I have a few thousand photos I want to put into a small number of groups >> as >> equally-sized as possible. It looks like a knapsack problem but I only >> need to get within some tolerant equality. >> >> Has anyone done something like this? >> >> Thanks, >> >> Devon >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm