473,378 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Need to divide a group

489 256MB
this is a general example of what I am trying to do.
I have a group of 50 people and have 12 tables, I need to put two people at each table but can't have the same two people together. I've tried doing a random numbering, but I still end up with the same two people at the same table. Does anyone have any idea how I can do this. Any help would be appreciated.

Thanks.
Dec 13 '22 #1

✓ answered by NeoPa

Hi Tom.

Be very clear - Your task is an extremely complicated one. If there even is a solution then I don't know of it. Many have tried before (Similar concept at least) and I know of none that have succeeded :-(

I did work out a solution whereby you can guarantee that each random number will use a different item from any selection(Dealing Cards), if that's any use to you.

7 8041
NeoPa
32,556 Expert Mod 16PB
Hi Tom.

I'm thoroughly confused. I can't imagine a scenario, that fits your description even remotely, where any person could ever be at more than one table - let alone at multiple tables where the table pairings are the same as any others.

Is there maybe something important missing from the question?
Dec 13 '22 #2
CD Tom
489 256MB
Sorry for the confusion so let me see if i can explain it better. I'll use a different example
I have 4 or 6 lanes. (The lane number can very between 4 or 6) each lane will have two people assigned to it. Lane 1 and Lane 2 will have two people assigned. 3 and 4 will have two people assigned these people race down the lanes you have a winner for Lane 1 and 2 and a winner for lanes 3 and 4.
The people can run this race up to twelve times. but the two racers cannot run against each other again. The database has a master file with maybe 500 people in it, People register for this event so I never know how many there will be at any event until registration is complete. Then I have to come up with an assignment list as to what table people will be assigned to.
I don't know if this makes sense, but I hope so.
Again Thanks
Dec 15 '22 #3
NeoPa
32,556 Expert Mod 16PB
Hi Tom.

I was rather worried this might be leading in that direction. Worried because this is a lot more complicated than one might think who doesn't have a clear understanding of what is involved. It's often easier to explain something in common language that covers much of the situation without the full purport necessarily being appreciated. So is the case here.

To start with, or possibly even - before we can even start with this - we need to be even more clear about the logic rules where two runners cannot compete against each other more than once. Does this mean ever? Must each compete against every other once & only once? What is the significance of 6 & 8 lane races? Would this be equivalent to 3 or 4 separate 2-lane races or is there some (as yet unexplained) significance or connection between the 3 or 4 pairs of competitors all running together? It would be simpler if there was none. So, before we continue in earnest, we absolutely must understand the starting parameters of the problem.

When we have a clear understanding of what we're trying to achieve then we need to decide how to store the information about who has already faced off against whom. This can be (is) messy as there is no easy place to both store it and retrieve it conveniently for later use. In order to avoid a repeat match then this data will need to be retrievable at the time of, or before, the random numbers are generated that will indicate who should be matched with whom.

Why "at the time of, or before"? If we only find out that a match is invalid after it's been suggested then we'll need to run the process again, and possibly yet again ad infinitum, until a valid match is found.

Consider also, that this approach will be unreliable in the following scenario :
We are working with a subset of competitors from A to D.
A has matched with B & C already but not with D.
B has matched with A already but not with C or D.
Neither C nor D has never matched within this subset before.
Consider further that the first match that comes up is C & D. A perfectly valid match. However this leaves A & B left and we know such a match is invalid. A possible solution would be A & D followed by B & C.

Notice how this desired result is not reachable simply by finding & selecting one valid pair after another.

I'm sorry to say, and hopefully I've explained in a way that you and others reading this can understand - even though the logic is quite involved and complicated - that, while it may be possible to get something that can help you approximate to a solution, getting a full solution is beyond my competence.
Dec 16 '22 #4
CD Tom
489 256MB
i've been working many different ways to try and come up with a solution.
Runners register for the match. this number can be any number of runners. Each runner in the database has a unique identifier.
The number of rounds they can run can be as high as 12 time but usually no lower than 6, this depends on the match director and his decision may be decided by the number of runners that have signed up.
When registration is complete, I need to create a list that shows the runners which lane they will be assigned to for each run.
Runners cannot run against the same person only in this match, they can run against the same person in the next match.
On the first-round lanes 1 and 2 run against each other, 3 and 4 run against each other, and if there are 6 lanes then lanes 5 and 6 run against each other.
After the first round then the runners that were on lanes 1 and 2 can't be matched up again the same with the other lanes. The shooter on lane one can be assigned to any other lane of even the same lane. The lane a runner is assigned to doesn't matter.
After the first group of runners have finished then the next group will take their assigned lanes This continues until all groups have competed. Then the second round will start.
Here's something I've tried.
I started by randomly selecting a runner from those registered and added him to a table with columns for round1 through the number of rounds that are being run, then I randomly picked another runner from the registered runners and added his unique identifier (I do check that the random number hasn't been already used) to the table I continue this until all runners are in the table. then I go through the table and 1 and 2 will run together, 3 and 4 will run together and so on. if there is an odd number then that runner gets a bye. then I go randomly through the registered shooters again and this time put the runner in round2. this worked for me until usually the 3rd or 4th round.
Dec 20 '22 #5
CD Tom
489 256MB
I've come up with an idea but not sure how to implement it. Here's my thoughts.
I have 40 registered runners.
round 1: 1 round 2. 2 round 3. 3 round 4 4 round 5continue for as many rounds as selected.
1--------- 2 ---------- 3---------- 4 -----------5
2--------- 3 ---------- 4 ----------5 -----------6
3--------- 4 ---------- 5---------- 6 -----------7
4--------- 5 ---------- 6 ----------7 -----------8
5--------- 6 -----------7---------- 8 -----------9
6--------- 7 ---------- 8---------- 9 -----------10
etc etc etc etc
What I will do is build a table with columns for round1 through round12 and I will load round1 with the runners Id the same for the rest of the rounds.
I just not sure of a good way to access the registered table to get the correct runners ID
runners 1 to 40 1 against 2, 3 against 4, 5 against 6
in round 2 runners 1 to 40 only I have to start with the second runner in the registered table. but when I get to the 40th runner in the registered table I need to go back so registered runner 40 will be against runner 1
in round 3 runners 1 to 40 only this time I have to start with the third runner in the registered table. then when I to the 39th runner in the registered table i have to go back and start with the 1st registered runner so registered runner 39 will be running against runner 1 and runner 40 against runner 2

If you are not already confused, do you think this will work.
again thanks for any help.
Dec 21 '22 #6
CD Tom
489 256MB
I see that my first thoughts are not going to work. in round 2 runners 3 and 4 and 5 and 6 and so forth.
So how about this.
Again, I'm starting with 40 registered runners. Round1 is pretty straight forward.
Not sure how many rounds there will be but no more than 12.
I know what round number I'll be in so I can use that to setup the table lookup. If I knew how to do that. Round 2 I can start with registered runner 1 and then go to the end to get the runner he will be competing against. but then how do I get back to get next round.
If anybody has any ideas, I would love to hear them.

round1 Round2 Round3 Round4 and Round5
-----1 -------1--------3---------5-----------7
-----2--------40------40-------40----------40
-----3---------2--------4--------6------------8
-----4--------39-------39------39----------39
-----5---------3---------5-------7----------- 9
-----6--------38-------38-------38---------38
-----7---------4---------6--------8---------10
-----8--------37-------37-------37---------37
I've penciled this out and if I've done it right, I think this will work now my only problem will be how to have the program do it.
does anybody have any ideas as to how to make this work.

CD
Dec 21 '22 #7
NeoPa
32,556 Expert Mod 16PB
Hi Tom.

Be very clear - Your task is an extremely complicated one. If there even is a solution then I don't know of it. Many have tried before (Similar concept at least) and I know of none that have succeeded :-(

I did work out a solution whereby you can guarantee that each random number will use a different item from any selection(Dealing Cards), if that's any use to you.
Dec 21 '22 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stephen McCormack | last post by:
Hi, I have a pretty simple problem for a SQL programmer regarding GROUPINGS: I have two tables tblShoppingCarts and tblProducts. The first table stores all shopping cart data. I would like to...
2
by: Jai | last post by:
Say the following are the columns of a table A B C D E F Can a aggregate function like sum be applied to A like sum(a) and then order by b and c similarly aggregate function on d and group by e...
3
by: CitizenPayne | last post by:
I have a problem with an access 97 query I have included the current query output. for every 'SPEC' there are 6 possible values for 'INTMAN' ( 1 to 6). I need to group by 'SPEC' where INTMAN =...
5
by: Amadelle | last post by:
Hi All and thanks in advance, I was wondering what is the best way of grouping data in a dataset. Like using a "Group By" clause in Sql statements. I was thinking of using XML but I don't even...
1
by: karthikpv | last post by:
Hi, I am trying to group nodes in a huge xml file by one of the common fields. I have tried using "for-each-group" and "group-by" but am unable to get it working. Here, I have a list of Ports...
3
by: tomlebold | last post by:
When using Access security can each group have only one password? So all members of the group have the same and/or one password? Then in order to have each member of a group have their own password...
1
by: n.phelge | last post by:
I'm using XSLT and .NET Framework 1.1 to try to transform XML to group by multiple values, and I'm not succeeding. I have source XML that looks like the following: <Data> <Flavor>...
2
by: tsbalaji69 | last post by:
I am populating a xmldocument and only if the selectsinglenode of the given path exist i try to clone. I do this to accommodate same name tags. The issue in which i got stuck is I am able to build...
1
by: beckjoh | last post by:
I have a Postgresql table with the following structure: id | value ----+-------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 1 6 | 2
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.