[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] [Off-Topic] Mix and macth series of values



In article <mac-perl.36533363.E0A711D1@irfmn.mnegri.It>,
valoti@irfmn.mnegri.It wrote:

>given two (or more) series of values, e.g
>0.2
>0.8
>0.8
>0.1
>0.269
>0.8
>(No of cases 1: 6, mean value 1: 0,49)
>
>0.9
>1
>0.85
>0.1
>(No of cases 2: 4, mean value 2: 0,71)
>
>and
>A=No1-No2 (2)
>B=Mean1-Mean2  (-0,22)
>
>Now,  I want to mix these series in order to have A and B as little as
>possible i.e. No of cases and Means of each new series as equal as
>possible.
>Would itbe possible to do this using (Mac)Perl, without superhuman
>efforts? (Y/N)

I think the trick is to find a clever algorithm. Once found, it can
probably be implemented neatly in Perl, but I think finding the algorithm
itself is the hard part. (Assuming, of course, that brute-force isn't the
way to go.) The problem isn't completely well-defined, though: you want to
partition a set of ten number so as to minimize A and B, but what is the
relative importance of minimizing the two? You can certainly obtain A = 0,
but possibly at a cost of B being non-minimal, and you can minimize B
while letting A increase. Also, are you looking for a general solution
(which I am assuming), or do you really just want the answer for this set
of numbers?

(You also might want to check one of Sedgewick's algorithm's books. This
rings a bell but I forget what it is called--it's the problem where you
are trying to stack different-sized pieces of wood....)
-- 
__________________________________________________________________________

Jeff Clites                Online Editor           http://www.MacTech.com/
online@MacTech.com         MacTech Magazine
__________________________________________________________________________

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch