Welcome Guest
Log In | Register )
The time is now 2:02 am
All times shown are
Eastern Time (GMT-5:00)

finding smallest wheelPrevious TopicNext Topic

Topic closed. Posted 3 years ago. No replies.

Page 1 of 1
PrintE-mailLink
Buckau's avatar - elgandorad
New Member
Townsville
Australia
Member #8333
October 26, 2004
18 Posts
Offline
Posted: March 21, 2009, 8:15 pm - IP Logged
Hi I am trying to create a function that will compare one list of elements against another list of elements and find the smallest number of enters from the first list that will contain all the elements in the second list.
e.g. lets say I have 8 items constructed in to blocks of 6 items this will give me an array containing 6 elements x 28 rows
Array1(28,6)

1) - 1, 2, 3, 4, 5, 6
2) - 1, 2, 3, 4, 5, 7
3) - 1, 2, 3, 4, 5, 8
4) - 1, 2, 3, 4, 6, 7
5) - 1, 2, 3, 4, 6, 8
6) - 1, 2, 3, 4, 7, 8
7) - 1, 2, 3, 5, 6, 7
8) - 1, 2, 3, 5, 6, 8
9) - 1, 2, 3, 5, 7, 8
10) - 1, 2, 3, 6, 7, 8
11) - 1, 2, 4, 5, 6, 7
12) - 1, 2, 4, 5, 6, 8
13) - 1, 2, 4, 5, 7, 8
14) - 1, 2, 4, 6, 7, 8
15) - 1, 2, 5, 6, 7, 8
16) - 1, 3, 4, 5, 6, 7
17) - 1, 3, 4, 5, 6, 8
18) - 1, 3, 4, 5, 7, 8
19) - 1, 3, 4, 6, 7, 8
20) - 1, 3, 5, 6, 7, 8
21) - 1, 4, 5, 6, 7, 8
22) - 2, 3, 4, 5, 6, 7
23) - 2, 3, 4, 5, 6, 8
24) - 2, 3, 4, 5, 7, 8
25) - 2, 3, 4, 6, 7, 8
26) - 2, 3, 5, 6, 7, 8
27) - 2, 4, 5, 6, 7, 8
28) - 3, 4, 5, 6, 7, 8

I now wont to reduce this array to the smallest amount or rows that will contain all the element combinations of a second array that uses the same 8 items but is constructed in blocks of 5 items giving me 56 rows of 5 elements Array2(56,5)
e.g.
Array2(56,5)
1 - 1, 2, 3, 4, 5
2 - 1, 2, 3, 4, 6
3 - 1, 2,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5,6,7,8

I have tried comparing each set of elements from Array2 against each set of elements in array1 and counting how many times each row in array1 matches all the elements in array2 but all the rows come up with the same answer of 16

1) - 1, 2, 3, 4, 5, 6, 16
2) - 1, 2, 3, 4, 5, 7, 16
3) - 1, 2, 3, 4, 5, 8, 16
4) - 1, 2, 3, 4, 6, 7, 16
5) - 1, 2, 3, 4, 6, 8, 16
6) - 1, 2, 3, 4, 7, 8, 16
7) - 1, 2, 3, 5, 6, 7, 16
8) - 1, 2, 3, 5, 6, 8, 16
9) - 1, 2, 3, 5, 7, 8, 16
10) - 1, 2, 3, 6, 7, 8, 16
11) - 1, 2, 4, 5, 6, 7, 16
12) - 1, 2, 4, 5, 6, 8, 16
13) - 1, 2, 4, 5, 7, 8, 16
14) - 1, 2, 4, 6, 7, 8, 16
15) - 1, 2, 5, 6, 7, 8, 16
16) - 1, 3, 4, 5, 6, 7, 16
17) - 1, 3, 4, 5, 6, 8, 16
18) - 1, 3, 4, 5, 7, 8, 16
19) - 1, 3, 4, 6, 7, 8, 16
20) - 1, 3, 5, 6, 7, 8, 16
21) - 1, 4, 5, 6, 7, 8, 16
22) - 2, 3, 4, 5, 6, 7, 16
23) - 2, 3, 4, 5, 6, 8, 16
24) - 2, 3, 4, 5, 7, 8, 16
25) - 2, 3, 4, 6, 7, 8, 16
26) - 2, 3, 5, 6, 7, 8, 16
27) - 2, 4, 5, 6, 7, 8, 16
28) - 3, 4, 5, 6, 7, 8, 16

I am using VBA in Access2000
Can any one offer a solution to this for me to try out?
Thanks

Always trying good luck

Steve