In general this is not true.

m=. 1 1 1 100
nb=. 2

The solution is obvious, but you get

   [bm=: nb %~ +/ m
51.5

   ]'a b'=.(,~nb&-) nb * (-<.) x: bm
1 1


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Aai
> Verzonden: dinsdag 12 april 2011 12:22
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Weight distribution problem
> 
> I'm not sure if the following observation scales down the problem, but may
> be it's of some help.
> 
> One of the problems here is finding a (nice) partitioning of bucket sums
that
> are equal or close to the mean bucketsum. Looking at the two presented
> examples I found the following:
> 
> We have
>   bm : mean bucket sum
>   nb : # buckets
> 
> then you may say
>    (,>:) <. bm
> are two possible sums very close to bm.
> 
> Then we have to find a and b in the following equation:
> 
> (+/m) = +/ (a, b) * (,>:) <. bm
> 
> Finding a and b:
>    b=. nb * (-<.) x: bm
> 
> and a follows from
> 
>    a =. nb - b
> 
> For the low scale example we have:
> 
> nb=. 4
> 
>     ]bm=.nb%~+/m
> 123.25
> 
>     ]'a b'=.(,~nb&-) nb * (-<.) x: bm
> 3 1
> 
>     (+/m) = +/ (a, b) * (,>:) <. bm
> 1
> 
> For the large scale ex. we have:
> nb=.20
> bm=.5273.4
> 
>     ]'a b'=.(,~nb&-) nb * (-<.) x: bm
> 12 8
> 
> Giving bucket sums:
> 
> 12 8 # (,>:)<. bm
> 
> 
> I'm not sure of course if this particular partitioning (a,b) of integer
bucket
> sums is possible.
> 
> --
> Met vriendelijke groet,
> =@@i
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to