Re: Partitioning problem

2011-09-23 Thread Alan Malloy
In the general case this is an NP-complete problem (ie, no algorithm you can write will be good enough), but many simpler cases can be solved quickly by some heuristic or other. See http://en.wikipedia.org/wiki/Partition_problem#Methods for some examples. On Sep 23, 4:51 am, Michael Jaaka wrote:

Re: Partitioning problem

2011-09-23 Thread Michael Jaaka
Good stuff! Thanks! Especially the trick with indexing so the set accepts first state of buckets. Beside this you are ignoring the current candidate computation along rest and just put him into nearest bucket. In mine I'm first looking for the potentially the best and finally put him over there

Re: Partitioning problem

2011-09-23 Thread Chouser
On Fri, Sep 23, 2011 at 7:51 AM, Michael Jaaka wrote: > Hi! > > I have a sequence of natural numbers and I have to partition them into > more or less equals N groups. > Partitioning function is just a sum of numbers in a given group. > > My naive solution is to sort numbers descending then take ea