1. RE: Defeating Murphy's laws and a new challenge
- Posted by rforno at tutopia.com Apr 19, 2003
- 396 views
Pete: What is the value for 'a' in Data[Lendata]+=2*a+1 ? ----- Original Message ----- From: Pete Lomax <petelomax at blueyonder.co.uk> Subject: Re: Defeating Murphy's laws and a new challenge On Thu, 17 Apr 2003 20:03:05 -0300, rforno at tutopia.com wrote: >What perplexes me is that this algorithm defeats Murphy's laws. In fact, it >is nearly impossible to find a data set to make it run slow. >This is the new challenge for all: find this kind of data set. Bored minds think alike.... I was thinking about odd numbers before but realised you'd caught at least a few obvious cases, so I said nowt. A quick experiment or two gave me this nasty little spanner: Data*=2 Data = reverse(sort(Data)) Data[1]+=1 Data[Lendata]+=2*a+1 Not unexpectedly that gives appalling times for sets as low as 30-40. Multiple search threads with random sort patterns? >As this problem is closely related to what is called the knapsack problem, I >wonder if this solution can be applied to it. When I have some more spare >time, I'll give it a try. If you ever do, the program should have both volume and weight limits, with higher volume a better solution for equal weights. > Years ago I wrote a program in APL for filling to >brim a number of diskettes. I'm thinking of translating it into Euphoria. LOL guess what my 15-year old cobol program did? Pete ==^^=============================================================== This email was sent to: rforno at tutopia.com TOPICA - Start your own email discussion group. FREE!
2. RE: Defeating Murphy's laws and a new challenge
- Posted by rforno at tutopia.com Apr 19, 2003
- 430 views
Pete: OK. But anyway, using your approach, I found number sequences that force the program to work really hard. Now I'm analyzing them and perhaps I'll find a way to defeat Murphy once more... Regards. ----- Original Message ----- From: Pete Lomax <petelomax at blueyonder.co.uk> Subject: Re: Defeating Murphy's laws and a new challenge On Fri, 18 Apr 2003 23:00:17 -0300, rforno at tutopia.com wrote: >Pete: >What is the value for 'a' in Data[Lendata]+=2*a+1 ? My apologies. I was updating the wrong ends of the array which is why it defeated all the optimisations. Sorry. I take it all back, I can't find a data set which messes it up either One small point: if the highest value in the array is a partition all by itself, eg {111,9,9,9,9,9,5,1,1,1}, then the partitions are correctly printed but BestVal is zero. Pete ==^^=============================================================== This email was sent to: rforno at tutopia.com TOPICA - Start your own email discussion group. FREE!