Chris Stebbing wrote: > I have an application which has a two dimensional array of 24 rows > each containing 20 floating point values. I need to analyse every > single combination of every single set of 24 values. Essentially I > only need to obtain the top 5 values for each permutation, many of > which are going to be the same of course.
Since you're dealing with relative sizes of the numbers and not doing any calculations with them, you can easily replace the floats with integers. The integers don't even need to have any relation to the floats, as long as you have a one-to-one relation between the integers and the floats they replaced. But that's not going to make any significant difference if your algorithm for analyzing these numbers isn't any good. What kind of analysis are you doing? Where did these numbers come from? What do all these permutations represent? I'm going to rephrase your problem as I understand it: For every group of 24 numbers, you need to select the five greatest, right? You generate the groups of 24 numbers as follows: You have 24 sets of 20 numbers each. For the first number in your 24-list, select a number from set 1. For the second number, select from set 2, and so on. Assuming all 4800 numbers are distinct, there are 20^24 permutations of numbers. The orders of the sets of 20 numbers don't matter since you're only concerned about one from each -- the order of the remaining 19 numbers doesn't matter. But that's still 16e30, which is huge. > Idea A) I had originally thought of a looping mechanism to get a set > of 24 values, sort them, grab the top 5 and so on. However, there > are 20 ^ 24 combinations, and I suspect this will be incredibly time > consuming. That's an understatement. > Idea B) Then I thought about just comparing within the loops, and > only grabbing the top 5 values - but again I'm doing billions of > comparisons and so perhaps this is just as bad. > > Idea C) I then thought that perhaps I could start off with a subset > of the permutations, and try to determine whether the other values > outside the permutations would affect the order, and analyse that > way... I'm not even sure I have this idea straight in my head yet nor > whether it would a) work, or b) be any faster than the two ideas above. > > I don't need any more than 3 decimal place accuracy, so I could > convert these values to integers, if that makes any difference. > > Does anyone have any suggestions for me? Yes. Get clarification on what this analysis is really supposed to do. -- Rob _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

