Re: Code works fine except...

2009-05-09 Thread Arnaud Delobelle
John Yeung gallium.arsen...@gmail.com writes: On May 5, 11:37 pm, Ross ross.j...@gmail.com wrote: On May 5, 10:33 am, MRAB goo...@mrabarnett.plus.com wrote: Here's my approach (incomplete): FYI... I was testing your code further and discovered a strange outcome... when there are 16

Re: Code works fine except...

2009-05-07 Thread MRAB
John Yeung wrote: On May 7, 12:30 am, Ross ross.j...@gmail.com wrote: If I were to set up a dictionary that counted players used in the bye list and only allowed players to be added to the bye list if they were within 2 of the least used player, would this be a good approach for managing bye

Re: Code works fine except...

2009-05-07 Thread Ross
On May 7, 1:11 am, John Yeung gallium.arsen...@gmail.com wrote: On May 7, 12:30 am, Ross ross.j...@gmail.com wrote: If I were to set up a dictionary that counted players used in the bye list and only allowed players to be added to the bye list if they were within 2 of the least used

Re: Code works fine except...

2009-05-07 Thread John Yeung
On May 7, 8:32 pm, Ross ross.j...@gmail.com wrote: I've managed to solve the problem. If you go in order, the discrepancy between the player with the least amount of byes and the greatest amount of byes is only 1. I don't mean to rain on your parade, but that's not the case for all values.

Re: Code works fine except...

2009-05-06 Thread MRAB
John Yeung wrote: On May 5, 11:37 pm, Ross ross.j...@gmail.com wrote: On May 5, 10:33 am, MRAB goo...@mrabarnett.plus.com wrote: Here's my approach (incomplete): FYI... I was testing your code further and discovered a strange outcome... when there are 16 people for 7 courts, every 7th round

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 5, 10:49 am, Ross ross.j...@gmail.com wrote: I'm interested to see what you did. From your description, it sounds like I've tried what you've done, but when I implemented my version, it took minutes to evaluate for bigger numbers. If that isn't the case with yours, I'd be interested in

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 6, 3:29 am, MRAB goo...@mrabarnett.plus.com wrote: I have the feeling that if the number of rounds is restricted then the difference between the minimum and maximum number of byes could be 2 because of the requirement that players shouldn't play each other more than once, meaning that

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 6, 3:29 am, MRAB goo...@mrabarnett.plus.com wrote: I have the feeling that if the number of rounds is restricted then the difference between the minimum and maximum number of byes could be 2 because of the requirement

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 6, 3:29 am, MRAB goo...@mrabarnett.plus.com wrote: I have the feeling that if the number of rounds is restricted then the difference between the minimum and maximum number of byes could be 2 because of the requirement

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 6, 3:29 am, MRAB goo...@mrabarnett.plus.com wrote: I have the feeling that if the number of rounds is restricted then the difference between the minimum and maximum number of byes could be 2 because of the requirement

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 7, 12:30 am, Ross ross.j...@gmail.com wrote: If I were to set up a dictionary that counted players used in the bye list and only allowed players to be added to the bye list if they were within 2 of the least used player, would this be a good approach for managing bye selection or would

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I went ahead with the approach I mentioned earlier, generating all possible matches

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I went ahead

Re: Code works fine except...

2009-05-05 Thread MRAB
Ross wrote: On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 1:33 pm, MRAB goo...@mrabarnett.plus.com wrote: Ross wrote: On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 10:33 am, MRAB goo...@mrabarnett.plus.com wrote: Ross wrote: On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 11:37 pm, Ross ross.j...@gmail.com wrote: On May 5, 10:33 am, MRAB goo...@mrabarnett.plus.com wrote: Here's my approach (incomplete): FYI... I was testing your code further and discovered a strange outcome... when there are 16 people for 7 courts, every 7th round your code

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 10:16 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 3, 11:29 pm, Chris Rebert c...@rebertia.com wrote: Probably not the cause of the problem, but where did the magic numbers 1.072 and 1.08 come from? It is perhaps not the most direct cause of the problem, in the sense

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:01 am, Ross ross.j...@gmail.com wrote: On May 3, 10:16 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 3, 11:29 pm, Chris Rebert c...@rebertia.com wrote: Probably not the cause of the problem, but where did the magic numbers 1.072 and 1.08 come from? It is

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 8:29 pm, John Machin sjmac...@lexicon.net wrote: On May 4, 12:36 pm, Ross ross.j...@gmail.com wrote: For the past couple weeks, I've been working on an algorithm to schedule tennis leagues given court constraints and league considerations (i.e. whether it's a singles or a

Re: Code works fine except...

2009-05-04 Thread Aahz
In article 8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com, Ross ross.j...@gmail.com wrote: def test_round_robin(players, rounds, courts, doubles = False): players = range(players) for week in round_robin(players,rounds,courts): if doubles == True:

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 12:15 pm, a...@pythoncraft.com (Aahz) wrote: In article 8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com, Ross  ross.j...@gmail.com wrote: def test_round_robin(players, rounds, courts, doubles = False):    players = range(players)    for week in

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 10:01 am, Ross ross.j...@gmail.com wrote: The magic numbers that everyone is wondering about are indeed used for spreading out the bye selection and I got them by simply calculating a line of best fit when plotting several courts: byes ratios. But that doesn't really help you. When

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:59 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 4, 10:01 am, Ross ross.j...@gmail.com wrote: The magic numbers that everyone is wondering about are indeed used for spreading out the bye selection and I got them by simply calculating a line of best fit when plotting

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 8:56 pm, Ross ross.j...@gmail.com wrote: Anyways, you're right that seq[0] is always evaluated. That's why my algorithm works fine when there are odd numbers of players in a league. It doesn't work fine for all odd numbers of players. For example, 15 players on 3 courts should

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:33 pm, John Yeung gallium.arsen...@gmail.com wrote: On May 4, 8:56 pm, Ross ross.j...@gmail.com wrote: Anyways, you're right that seq[0] is always evaluated. That's why my algorithm works fine when there are odd numbers of players in a league. It doesn't work fine for all odd

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 11:01 pm, Ross ross.j...@gmail.com wrote: Anyways, I'm new to programming and this has been a good learning experience. I'm glad that you've been trying, and seem to be sticking it out despite sometimes getting negative feedback here. Next time around, I'll be sure to thoroughly

Re: Code works fine except...

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 7:36 PM, Ross ross.j...@gmail.com wrote: For the past couple weeks, I've been working on an algorithm to schedule tennis leagues given court constraints and league considerations (i.e. whether it's a singles or a doubles league). Here were my requirements when I was

Re: Code works fine except...

2009-05-03 Thread John Machin
On May 4, 12:36 pm, Ross ross.j...@gmail.com wrote: For the past couple weeks, I've been working on an algorithm to schedule tennis leagues given court constraints and league considerations (i.e. whether it's a singles or a doubles league). Here were my requirements when I was designing this

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 10:36 pm, Ross ross.j...@gmail.com wrote: def round_robin(players, rounds): [snip] def test_round_robin(players, rounds, courts, doubles = False):     players = range(players)     for week in round_robin(players,rounds,courts): [snip] First things first: I take it the call to

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 11:29 pm, Chris Rebert c...@rebertia.com wrote: Probably not the cause of the problem, but where did the magic numbers 1.072 and 1.08 come from? It is perhaps not the most direct cause of the problem, in the sense that the magic numbers could take various values and the problem would