Thanks, Markus, that is certainly above and beyond the expected response. Iāve downloaded it and Iām looking at it now.
Hmm, with the large numbers it crashes on me. It will run out of memory before it reaches 12 billion Ā
An option would be to store the results in a database on disk Ā
5352515049*48 = 16 billion lines like ā12 13 23 34 37 44ā = 16,529,385,600 * 17 bytes = 280,999,555,200 bytes ? 281 GB
I donāt have enough RAM for thatā¦
How did you store the info in your previous app?
Btw when you stop the calculation you have two options:
-
simply kill the thread if you are not interested in the partial calculation (thatās what I do in the example)
-
You could show the partial result but then replace āThread1.Killā with āExitLoop = Trueā which will tell the thread to exit the loops and set the text
6/53 without repetition of numbers in a given position produces approximately 22.9 million unique combinations. Thatās part of the reason for having B have a minimum bound of A + 1, for example, and so on. I am also going to have the program create an array that is as large as however many numbers are selected for wheeling into 6 number combinations (7 to 53), and then fill the array with the selected numbers, but for now I have to start over since the UI portion of the app disappeared on me.
When I would store the output, I stored it in a simple text file in the old software, but have plans to use a database in this one. I donāt retain the data in RAM, I only generate and test it. Then the results either get sent to disk, printer or nowhere.
Yup, I just noticed my maths was way off. Should have used Binomialkoeffizienten (combinatorics?) Ā
Alright, so I have it producing all of the combinations. At first I thought something was wrong because the captured output is all over the place, and jumps huge amounts of combinations, but there was no error in the code generating it. I realized that the loops were running too fast to capture it. Changing the timer tick latency to 1 millisecond did not fix this problemā¦ itās that insanely fast! Who needs a stop button now?! hehe
But, the stop button does work. With the old VB6 compiled .exe, it required 12 hours, 41 minutes on my computer to generate all 22.9 million combinations, without filtering them (but with displaying every one in the text box). In Xojo, even updating the text field every millisecond, the complete run takes just about 6 seconds. I am stunned! This is so much more fast and efficient I am just having to take a few minutes to let it sink in. I knew VB was using pseudocode instead of machine code, and I knew that updating the display every iteration was slowing it down, but holy cow!
6 sec is nice - Iām not getting that so I wonder where the difference lies. How do you capture the output? Do you store it in an array or do you use something else?
And whatās your setup? It is always a good idea to specify platform, Xojo version, and computer hardware when asking questions (as some problems may be specific to them)
Iām curious about that myself. Thatās a huge improvement over VB so Iād really like to know what the variables are.
Iām not yet capturing the output. The goal for that point was to be able to generate all possible combinations, display them while they were being generated and exit the loop when I press the Stop button.
Now Iām just finishing getting the number selection list box set up and populated, and getting the program to count how many numbers have been selected from it, while refusing to run if there are not at least 7 numbers selected. This process is helping me become familiar with what and where the help resources are, and how to use them.
Next up is getting the program to use the selected numbers from an array that is created based on how many are selected, and generating combinations from the array instead of all possible combinations all the time. That should not be too challenging, but itās probably going to be dealt with tomorrow. I have real work to do, too.
I am still in awe about the program running that fast compared to VisualBasic 6. Exact same function, but thereās a difference in speed that is just staggering.
Let us know how you get on
(and maybe you could put your location in your profile? Itās always nice to see where people are coming from)
Btw if you click on following (on the right side in the forum) then you are informed whenever someone posts in one of the threads you are interested in.
Excellent, and done. Thanks for the information. I have made the suggested adjustments.
Just a little follow through on the time it takes for this program to run. It takes 5-6 seconds with no filters coded.
With one filter (limiting how many even numbers are allowed to play in a combination that passes filters), run time in Xojo is now between 1 minute 30 seconds and 2 minutes 35 seconds, depending on settings. Thatās a dramatic drop in speed, but certainly not surprising. If each filter adds no more than 2 minutes 35 seconds to the run time, we will never reach a run time of even 2 hoursā¦