That is a different problem from what I was suggesting to solve with q: I'll note, also, that you have left undefined what "small number of groups" means, and how tolerant you are on "as equally sized as possible".
That said, let's say you wanted to split them into four groups. A reasonable first approximation would be: _1000 ]\ ({~ ?~@#)szs And a plausible further approximation would be: parts=:3 :0 r=. _1000 ]\ ({~ ?~@#) y for.y do. r=. ($r)$(<0 _1) C.,(/: +/"1) /:~"1 r end. ) (This typically gets me a difference between the smallest and largest group that is less than the largest value.) But, yeah, if you want the best possible arrangement this becomes an example of the knapsack problem. -- Raul On Fri, May 20, 2016 at 1:37 PM, Devon McCormick <devon...@gmail.com> wrote: > 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