Subj : Re: efficient way of processing m combinations of n numbers in p sets To : comp.programming From : Mike Date : Wed Aug 17 2005 12:08 pm In article <1124188190.499826.88190@g44g2000cwa.googlegroups.com>, mykyp@pearcey2001.freeserve.co.uk says... > Hi, > > > I am trying to process all combinations of 6 sets of numbers (using > VB). The > minimum number in each set will be 2 and the maximum number is > definable but will be the same for all 6 sets. The increment in each > set is also definable and is also the same for each set. > If I understand the problem correctly - you don't need to do any significant computation to get the answer. So I assume the problem is as follows: You have n horses H1...Hn, each is at odds O1..On, you have a total of B to bid on the horses, and (finally) you want to minimise the worst case loss (or maximise the worst case gain) resulting from any particular horse winning, by choosing a series of bids B1..Bn, on each horse. I am assuming your odds Oi, for horse Hi, means that if you pay x dollars and the horse wins, you get Oi*x dollars back. This means that if horse Hi wins you pay B1+B2+B3+....+Bn, and get back Oi*Bi. So, the defining equations are: Sum(Bi) = B Wi = Oi*Bi-Sum(Bi) = Oi*Bi - B Now, you want to maximise the minimum value of Wi, this will occur when all the Wi are identical, i.e equal to some value Wmim. So, Wi = Oi*Bi - B = Wmin, thus Bi=(Wmin+B)/Oi Still want to know what Wmin is, so if we sum the above for all i we get... sum(Bi) = sum((wmin+B)/Oi) = (Wmin+B)*Sum(1/Oi) so, if we define P = sum(1/Oi) and do a little more algebra we finally end up with the solution... Your bet Bi on each horse should be Bi = B/(P*Oi), where P = Sum(1/Oi), and your expected return regardless of which horse wins will be Wmin = B*(1/P-1). QED and all that. Mike .