Permutations and Combinations

tangoman66

Registered User.
Local time
Today, 11:17
Joined
Jan 30, 2004
Messages
98
I have a table with 12 subjects in it which need to be arranged into groups of four i.e. (1/2/3/4), (5/6/7/8), (9/10/11/12) or (1/2/3/7), (4,5,6,8), (9,10,11,12). It does not matter whether they are in numerical order or not.
I aren't sure but I believe there are about 100 million ways to do this.

Is it possible to get access to fill in the table for me????
 
Just how many posts on this topic are you going to start?
 
I havnt decided yet ;) Depends on how many problems I get. However I believe that if I get this little problem solved then it will be my last post on te matter. Have you got any ideas?
 
I am not suggesting that you don't ask questions. I am strongly suggesting that you stick to a single thread for a single problem. I have tried to help you but expecting me to keep track of your posts so I can tell who has suggested what is a little bit of an imposition. I do have other things to do than think about your problem or waste my time thinking about it if someone else has provided a useful solution in another thread.

You keep coming up with solutions and asking us how to implement them but you have yet to completely describe your problem. This latest post is a case in point. Of what possible use is it to have Access make a table with millions of rows? Why should any of us spend our time coming up with a solution when you don't even know what you will do with the table once you have it!
 
I have a query that will look at each option block ID and show how many people can take 3/2/1 choice from that given block. It is based on another query that simply calculates how many of their choices in each column of the option block. The query also compares them and sortsthem in descending order using the 3 choices granted column. I know that if I can get Access to fill in the table it takes all of its information from then I will be able to determine an optimum option block and this will fulfil my requirements for the database.
 
thanks for the link! I will try to understand it as much as I can.

Could I export my data to excel use you idea and then import it again?

I am not very good with coding so it might not be a very quick solution.

The basic idea is that I have 12 subjects and want as many permutations as possible i.e. 12! = 479001600 which is a lot. rather than having to type these in myself and head to an early grave i want access to create them for me. i will have a play around with the solution on the link and hoipefully everything will turn out ok.

cheers,

hilly
 
Pat is right

Tho i will give you this:

Try:

sub Test
dim i1 as integer
dim i2 as integer
dim i3 as integer
dim i4 as integer
for i1 = 1 to 12
for i2 = 1 to 12
for i3 = 1 to 12
for i4 = 1 to 12
debug.print i1,i2,i3,i4
next i4
next i3
next i2
next i1
end sub

You by now should be able to addapt it....

Greets & *Big Sigh*
 
Thanks mailman, I will try as you suggest but where abouts do I enter the coding?

I have so far managed to get a query to find all the permutations of the 12 items but Access will not let me make a table / update a table with them because it says there is an argument error, yet the query runs fine in normal mode :confused: .

I have another idea and that is to find the permutations in groups of four (believed to be about 11000) but I aren't sure how to then combine the groups of four into blocks of twelve with no repeating groups. I can get them into groups of four by the way.

Cheers,

Hilly
 
namliam said:
Pat is right

Tho i will give you this:

Try:

sub Test
dim i1 as integer
dim i2 as integer
dim i3 as integer
dim i4 as integer
for i1 = 1 to 12
for i2 = 1 to 12
for i3 = 1 to 12
for i4 = 1 to 12
debug.print i1,i2,i3,i4
next i4
next i3
next i2
next i1
end sub

You by now should be able to addapt it....

Greets & *Big Sigh*



Surely you don’t want duplicate values in the results:
ie.

1,1,1,1,1,1,1,1,1,1,1,1
1,2,1,1,1,1,1,1,1,1,1,1
1,3,1,1,1,1,1,1,1,1,1,1

etc.
etc.

I’m going to the Pub!!

Rob
 
robthedog said:
Surely you don’t want duplicate values in the results:
ie.

1,1,1,1,1,1,1,1,1,1,1,1
1,2,1,1,1,1,1,1,1,1,1,1
1,3,1,1,1,1,1,1,1,1,1,1

etc.
etc.

I’m going to the Pub!!

Rob
Zzzzz, my bad
 
You're right I dont want duplicate values in my results.

I have managed to create a query that will find all the permutations of the 12 subjects with no duplicates. HOWEVER as there are 479001600 of them I cannot copy them into a table as access cannot cope with the amount.

Would it be possible to adapt my current working queries (that look up values in the table I manually input the permutations into) so that they use the query that creates all the permutations as their data source???

Thanks for all your help. :)

Hilly,
 
Can I ask just one question as, as Pat says, this has been going on for a while?

Why?

I think you are totally misguided in what you should be using a database for or are just so conceptually off that you don't actually know what you are doing.
 

Users who are viewing this thread

Back
Top Bottom