2323from ietf .person .models import Person
2424from ietf .meeting import models
2525
26- OPTIMISER_MAX_CYCLES = 80
26+ # 40 runs of the optimiser for IETF 106 with cycles=160 resulted in 16
27+ # zero-violation invocations, with a mean number of runs of 91 and
28+ # std-dev 41. On the machine used, 160 cycles had a runtime of about
29+ # 30 minutes. Setting default to 160, as 80 or 100 seems too low to have
30+ # a reasonable rate of success in generating zero-cost schedules.
31+
32+ OPTIMISER_MAX_CYCLES = 160
2733
2834
2935class Command (BaseCommand ):
@@ -62,6 +68,7 @@ def __init__(self, stdout, meeting_number, name=None, max_cycles=OPTIMISER_MAX_C
6268 def run (self ):
6369 """Schedule all sessions"""
6470
71+
6572 beg_time = time .time ()
6673 self .schedule .fill_initial_schedule ()
6774 violations , cost = self .schedule .total_schedule_cost ()
@@ -309,8 +316,8 @@ def optimise_schedule(self):
309316 random .shuffle (items )
310317
311318 if self .verbosity >= 2 :
312- self .stdout .write ('== Optimiser starting run {}, dynamic cost after last run {} =='
313- .format (run_count , intcomma ( last_run_cost ) ))
319+ self .stdout .write ('== Optimiser starting run {}, dynamic cost after last run {:, } =='
320+ .format (run_count , last_run_cost ))
314321 self .stdout .write ('Dynamic violations in last optimiser run: {}'
315322 .format (last_run_violations ))
316323 if shuffle_next_run :
@@ -321,8 +328,11 @@ def optimise_schedule(self):
321328 for original_timeslot , session in items :
322329 best_cost = self .calculate_dynamic_cost ()[1 ]
323330 if best_cost == 0 :
331+ if self .verbosity >= 1 and self .stdout .isatty ():
332+ sys .stderr .write ('\n ' )
324333 if self .verbosity >= 2 :
325334 self .stdout .write ('Optimiser found an optimal schedule' )
335+
326336 return run_count
327337 best_timeslot = None
328338
@@ -351,7 +361,7 @@ def optimise_schedule(self):
351361 if self .verbosity >= 1 and self .stdout .isatty ():
352362 sys .stderr .write ('\n ' )
353363 if self .verbosity >= 2 :
354- self .stdout .write ('Optimiser did not find perfect schedule, using best schedule at dynamic cost {}'
364+ self .stdout .write ('Optimiser did not find perfect schedule, using best schedule at dynamic cost {:, }'
355365 .format (self .best_cost ))
356366 self .schedule = self .best_schedule
357367
0 commit comments