August Challenge of the Month Discussion

Hi Jeffrey Chin

it means that ..

Solutions with the first the number= 77.74
are 322,151

1 2 3 4 5 6 7 8 9 10 11 12 13 15 18 27 29 45
1 2 3 4 5 6 7 8 9 10 11 12 13 16 32 35 47
1 2 3 4 5 6 7 8 9 10 11 12 14 15 18 19 33 48
1 2 3 4 5 6 7 8 9 10 11 12 14 15 19 25 28 48
1 2 3 4 5 6 7 8 9 10 11 12 14 15 22 27 32 39

Solutions with the first the number= 83,60
are 175.825

2 14 15 19 21 23 26 28 29 32 39
2 14 15 19 21 25 26 35 43 44
2 14 15 19 21 26 28 32 38 49
2 14 15 19 24 26 28 32 40 44
2 14 15 19 25 30 31 32 34 41
2 14 15 19 25 37 38 45 46
2 14 15 19 26 32 34 47 49
2 14 15 20 21 24 29 35 40 44

and so on

the 77.74 appears only in 322,151 solutions of total

the 83,60 appears in 175.825 solutions as first number but appears olso in some of 322,151 of 77.74 as second number ..

1 2 22 25 29 32 37 40 46
1 2 22 31 32 43 47 49
1 2 22 31 37 44 46 47
1 2 23 31 35 39 48 49
1 2 23 35 39 40 44 47
1 2 24 29 30 34 36 38 41
1 2 24 35 36 37 44 50
1 2 24 35 37 40 41 50
1 2 27 31 36 40 52
1 2 28 35 38 41 42 45
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi Ioannis

maybe u wanna check your program again cos 444.98 appears at least once in one of my solutions..
 
Tell me the solution with 444.98 as first number (the others numbers must be greater than 444.98 ) Jeffrey Chin ?
 
Hi,

Ioannis -- I may be misreading your solution set but the following solution index numbers

1 2 3 4 5 6 7 8 9 10 11 12 13 15 18 27 29 45
and
1 2 3 4 5 6 7 8 9 10 11 12 13 16 32 35 47

sum to
4555.66
and
4556.38

Please check to make sure your program is giving exact matches. Again, if I am misreading your result set, please tell me.

For all -- a few hints that may or may not be of help...

1. The total "possible" combination is 2^54 - 1 (if you don't count the selection of 0 things).

2. Since there are no negative numbers, you can eliminate any values > the target value. Here, that allows us to reduce the number of items in the search data by one, to 53.

3. If you sort the original set in ascending order, and then take a running total, you will notice that the first 22 items sum to > the target value. Therefore, you can eliminate immediately any combinations of 53 things taken > 21 at a time.

4. For an exhaustive search, the problem now is reduced from Sum(Combin(54,1...54)) to Sum(Combin(53,1...21))

There are now 761,008,457,488,847 unique potential solutions. This number is nearly 24 times less than the original 2^54.

5. That number, though, is still far too high to be practical. If you can process 10,000,000,000 entries in a day, it will take 200+ years to go through the list.

6. The key to resolving the above is to break out of sequences that are going nowhere. If you can do that early, you can probably reduce the total searches by factors of thousands or even millions.

The above discussion deals with making brute force methods more efficient. The Solver solutions and Sharad's routine appear to be much more efficient in the search. Ionannis and Jeffrey Chin have other approaches which will be quite informative when posted, too.

Good job all.
 
Jay,

just a lateral thought :

we could reduce those 200 years down to a single year *if* we were able to incorporate into the code a method for splitting up the search into 200 different spreadhseets, sent to 200 volunteers, or a month if you split it down amongst 4,000

(not practical for accounts departments, yes, but let's forget abotu that, we're just interested in finding the solutions)

how easy would it be to slice the search up into 4,000 manageable segments - each segment being the next set to be searched when the spreadsheet was next copied and ran ?

surely it's possible to do this and then have the code email it's particular segment set of solutions back to the original person or project leader

[I'd been thinking about this along the lines of the SETI project where rather than have a single computer trying to analyse zillions of bits of info : packets of info are farmed out to volunteers across the world who each analyse their own little segment then post their results back]

I'm not saying we *need* 4,000 volunteers, what we need is the code that could do this.....

I don't know much about arrays in VBA, but know a simple way to allocate ranges of permutations based on their "binary address" (for want of a better way to describe it).... this would allow a block of 10,000,000 combinations to be checked easily

but if we could get the next version of the spreadhseet to check the next 10,000,000 combos, etc etc, that would work.....

any thoughts anyone ? it's way beyond my VBA skills right now

Chris
 
TO Jay Petrulis
I check my macro and is ok ...

so where is the error .. to me or to you ..

No .. we are both right ...

Look what happens ..

go to

http://www.mrexcel.com/challenge.shtml

Mrexcel give two sets of numbers

one with "." and one with ","

my version of Excel requires the decimal place to be a comma so i used the second set ...

but all the numbers are the some except the 83,6 and the 507,8

895,39
83,6
280,71
1021,70
219,10
1587,52
507,8
628,89

second set

which are 83.06 and 507.08

first set

895.39
83.06
280.71
1021.7
219.1
1587.52
507.08
628.89

the difference is 0.54 and 0.72

so 4556.38 + 0.54 =4556.92

so 4555.66 + 0.54 + 0.72 =4556.92

the solutions with these two numbers had sum 4556.92 with the second set, the set i used but with the fisrt have other sums which depends if the solution use one of them or both ...
 
On 2002-08-18 02:48, Chris Davison wrote:
Jay,

just a lateral thought :

we could reduce those 200 years down to a single year *if* we were able to incorporate into the code a method for splitting up the search into 200 different spreadhseets, sent to 200 volunteers, or a month if you split it down amongst 4,000

(not practical for accounts departments, yes, but let's forget abotu that, we're just interested in finding the solutions)

how easy would it be to slice the search up into 4,000 manageable segments - each segment being the next set to be searched when the spreadsheet was next copied and ran ?

surely it's possible to do this and then have the code email it's particular segment set of solutions back to the original person or project leader

[I'd been thinking about this along the lines of the SETI project where rather than have a single computer trying to analyse zillions of bits of info : packets of info are farmed out to volunteers across the world who each analyse their own little segment then post their results back]

I'm not saying we *need* 4,000 volunteers, what we need is the code that could do this.....

I don't know much about arrays in VBA, but know a simple way to allocate ranges of permutations based on their "binary address" (for want of a better way to describe it).... this would allow a block of 10,000,000 combinations to be checked easily

but if we could get the next version of the spreadhseet to check the next 10,000,000 combos, etc etc, that would work.....

any thoughts anyone ? it's way beyond my VBA skills right now

Chris

Hi Chris,

The partitioning of the problem will work, but that won't really help unless somebody comes up with a way to break Combin(53,12), for instance, into smaller parts.

C(53,1...7) shouldn't take too long, but the cap at 21 would take an enormous amount of time using a brute force approach.

After taking a closer look at the problem and writing a routine that will at least give me a benchmark, I am now more than ever convinced that the optimal non-Solver approaches are those of Ionnis and Sharad K., although we'll have to wait until Ioannis posts the routine.

Sharad and Ioannis are on the right track for large data sets....

Suppose that we find a solution 1,2,3,4,5 when selecting 5 items. Any future paths should ideally eliminate that path from the run.

What I am referring to here is that when you are searching for solutions of 6 numbers, you should never even get to

1,2,3,4,5,6
or
1,2,3,4,5,7 and so forth.

When you carry this out further, that entire solution path removes a ton of unnecessary searches.

I haven't quite figured out how Sharad's recersion works, but that approach seems to work really well. It appears that the routine starts with a pivot and exhausts the solutions for that single entry. Then, it removes the number from the set and continues. Over time, the original set of 54 is reduced, which really speeds things up.

Currently, all I have is an incomplete iteration method. The recursion routine I already posted goes through the combinations 3 times (!!!!!), so it is unworkable. My current thinking is along the lines of Sharad K.'s and also using multidimensional arrays to visualize the solution paths. That is still only a concept right now with no implementation.

OK, anybody up for any side bets on the winner? We've yet to hear from Damon Ostrander (my $$$ is on him if he jumps in :grin: ). Sharad and Ioannis are at the top right now. Mark W. and the Solver routines have to be considered top contenders, too. Jeffrey Chin's random search is along the lines of Tim C.'s first post in the newsgroup thread that started it all. Tim C. has some reservations about this, though.

We still don't know if others have already offered great stuff privately.

Of additional interest, especially with the Solver-type solutions, check out the following thread

http://groups.google.com/groups?hl=...008e.0202121923.69589444%40posting.google.com

Dana DeLouis, a MS MVP, is terrific with the Solver and Harlan Grove makes some nice posts about this problem type.

_________________
Bye,
Jay

EDIT: Forgot to add some reservations about the "winning" entry -- the processing power needed to exhaustively search all the combinations is beyond the scale of anything but a distributed computer system or a supercomputer, so if anybody comes up with a guarantee that all the answers are available within a few hours, I will be a bit disbelieving. :smile:

Also, to solve for 1 or 2 chosen at a time (or 52 or 53) doesn't require any VBA. 1 is obvious. For two, type the values in column A (starting at a1). Name this range DataRange or such. In C1, type the target value and name the cell GoalValue.

in B1, enter the following
=MATCH(ROUND(GoalValue-A1,2),DataRange,0)

and copy down the list. Any non-error values will indicate the row of a matched pair. Duplicates might mess this a bit, but this is relatively easy to get the case of n choose 2.
This message was edited by Jay Petrulis on 2002-08-20 12:57
 
.. I re check my macro and work fine (i use the second set of numbers) ..

.. I checked it with small amout of numbers, from 10 to 16 and i dint find any bugs

-16 NUMBER TEST-

I use 16 numbers from 1 to 16
Total combinations 2^16-1=65.535
check =34
Total solutions found =306

Then with simbly brute force macro I found all the 65535 combinations and their sums
I put Autofilter on columns and count the combinations with sum equal to 34 (count=306)

.. If it works with from 16 (10, 12 …) why not with 53 ?

So, is my computer so fast or my macro is too smart ?, that found all solutions in less than a week !!!

lets find out ...

My macro is based on brute force method but with some ways off rejecting compinations, (some mention by Jay Petrulis Above)

I put a counter in my macro to find how many combinations checks ..
After an hour the counter was at 384.030.162 and find 10.014 solutions

the results for a day is 9.216.723.888 and 240.336 solutions

if i dont reject any combination the time needed is 2^53 -1

total =2^53 -1 =9.007.199.254.740.990

total/9.216.723.888/365=2677 years

but the macro reject compinations ..

.. the computer check 384.030.162/hour but the solutions varies from 6000 to 15000 (or more)per hour ..

In one day the find minimum 72.000 solutions

The first Solutions come is a second which was the
"1 2 3 4 5 6 7 8 9 10 11 12 13 15 18 27 29 45"
afher 62407 compinations

the solution's serial is 790.190.095.890

(with solution's serial i mean that the first combination is "1" serial 1, second combinations "1 2"=serial 2, combinations "53"=9.007.199.254.740.990 (the last, i maded a macro to find solution's serial number)

it reject 790.190.095.890-62407=790.190.033.483 !!!

the 72.000 solution is
" 1 2 4 5 7 9 11 12 13 15 29 31 44 45"
with serial =1.311.442.473.057.290

in one day reach the 1.311.442.473.057.290
combination

to reach all

9.007.199.254.740.990/1.311.442.473.057.290=6,87 days

My macro made less than 6,87 (3 or 4 )days because we compute this time with the worst speed of solutions, 6000/hour (not the best 15000/hour) ...........
 
some correction to above ..

if the macro finds 72.000 solutions per day
3000/hour, 3000*24=72000 per day ..
the 72000th solutions is
"1 2 4 5 7 9 11 12 13 15 29 31 44 45"
with serial =1.311.442.473.057.290

in one day reach the 1.311.442.473.057.290
combination

to reach the last solutions

9.007.199.254.740.990/1.311.442.473.057.290=6,87 days

My macro made less than 6,87 (3 or 4 )days because we compute this time with speed 3000/hour
But the speed varies from 6000 to 15000 (and more)per hour for the first numbers 01, 02, 03, which have 593968 solutions, 83% of total solutions and 7.881.299.347.898.370
compinations , 87,5 % of total.


01- 77,74 has 322.151 solutions
02- 83,60 has 175.825 solutions
03- 89,40 has 95.992 solutions
04-116,14 has 51.315 solutions
05-126,69 has 28.659 solutions
06-144,77 has 16.142 solutions
...
..
.

01- 77,74 has 4.503.599.627.370.500 compinations
02- 83,60 has 2.251.799.813.685.250 compinations
03- 89,40 has 1.125.899.906.842.620 compinations
04-116,14 has 562.949.953.421.312 compinations
05-126,69 has 281.474.976.710.656 compinations
06-144,77 has 140.737.488.355.328 compinations

...
..
.
 

Forum statistics

Threads
1,223,753
Messages
6,174,307
Members
452,554
Latest member
Louis1225

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top