Re: Code works fine except...

2009-05-09 Thread Arnaud Delobelle
John Yeung writes: > On May 5, 11:37 pm, Ross wrote: > >> On May 5, 10:33 am, MRAB 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 produces 4 b

Re: Code works fine except...

2009-05-07 Thread John Yeung
On May 7, 8:32 pm, Ross 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. For example, with

Re: Code works fine except...

2009-05-07 Thread Ross
On May 7, 1:11 am, John Yeung wrote: > On May 7, 12:30 am, Ross 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 fo

Re: Code works fine except...

2009-05-07 Thread MRAB
John Yeung wrote: On May 7, 12:30 am, Ross 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 usi

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 7, 12:30 am, Ross 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 using a dictio

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB 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 >

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB 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 >

Re: Code works fine except...

2009-05-06 Thread Ross
On May 6, 3:14 pm, John Yeung wrote: > On May 6, 3:29 am, MRAB 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 >

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 6, 3:29 am, MRAB 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 the players have to be

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 5, 10:49 am, Ross 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 seeing your im

Re: Code works fine except...

2009-05-06 Thread MRAB
John Yeung wrote: On May 5, 11:37 pm, Ross wrote: On May 5, 10:33 am, MRAB 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 produces 4 byes instead of the corr

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 11:37 pm, Ross wrote: > On May 5, 10:33 am, MRAB 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 produces 4 byes instead of the correct 2 by

Re: Code works fine except...

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

Re: Code works fine except...

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

Re: Code works fine except...

2009-05-05 Thread MRAB
Ross wrote: On May 5, 12:32 am, John Yeung wrote: On May 5, 1:12 am, John Yeung 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, genera

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 12:32 am, John Yeung wrote: > On May 5, 1:12 am, John Yeung 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, gener

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 1:12 am, John Yeung 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 and then selecting among

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 11:01 pm, Ross 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 comment > my code be

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:33 pm, John Yeung wrote: > On May 4, 8:56 pm, Ross 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, 1

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 8:56 pm, Ross 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 result in 5 byes. Bu

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:59 pm, John Yeung wrote: > On May 4, 10:01 am, Ross 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. > >

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 10:01 am, Ross 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 you do seq[::

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   wrote: > > >def test_round_robin(players, rounds, courts, doubles = False): > >    players = range(players) > >    for week in round_robin(players,round

Re: Code works fine except...

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

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 8:29 pm, John Machin wrote: > On May 4, 12:36 pm, Ross 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 r

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 10:16 pm, John Yeung wrote: > On May 3, 11:29 pm, Chris Rebert 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 v

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:01 am, Ross wrote: > On May 3, 10:16 pm, John Yeung wrote: > > > > > On May 3, 11:29 pm, Chris Rebert 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

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 11:29 pm, Chris Rebert 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 still be there.

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 10:36 pm, Ross 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 round_robin is on

Re: Code works fine except...

2009-05-03 Thread John Machin
On May 4, 12:36 pm, Ross 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 algorithm: > > -E

Re: Code works fine except...

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 7:36 PM, Ross 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 algor

Code works fine except...

2009-05-03 Thread Ross
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 algorithm: -Each player plays against a unique opponent e