本文整理匯總了Python中schedule.Schedule.solution_debug_data方法的典型用法代碼示例。如果您正苦於以下問題:Python Schedule.solution_debug_data方法的具體用法?Python Schedule.solution_debug_data怎麽用?Python Schedule.solution_debug_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類schedule.Schedule
的用法示例。
在下文中一共展示了Schedule.solution_debug_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: make_schedule
# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import solution_debug_data [as 別名]
def make_schedule(team_counts, league, sch_tries=500, seed=None, debug=True, reffing=True,
save_play_schedule=False):
from schedule import Schedule
from random import choice, randrange
import random
import pickle
start = datetime.datetime.now()
if seed != None:
random.seed(seed)
try:
if save_play_schedule and os.path.isfile(play_schedule_pkl_path()):
sch = get_schedules(play_schedule_pkl_path())[0]
mut_idx = 0
else:
facilities = league.days
sch = Schedule(league, team_counts, facilities)
#print([num / 4.0 for num in sch.get_game_div_count_list()])
# add play schedule
for div_idx in range(5): # todo: if kept, make this dynamic
for mut_idx in range(sch_tries):
if True:
sch.try_remake_a_few_random_days(div_idx, 1)
sch.try_remake_a_few_random_days(div_idx, randrange(1, sch.daycount+1))
if debug:
print(sch.solution_debug_data(mut_idx, div_idx))
if (sch.fitness_div_list()[div_idx] == 0):
if debug:
print("correct schedule found for division {}!!!!!".format(div_idx))
break
else:
print(sch.solution_debug_data(1))
print(sch.get_audit_text())
raise(FailedToConverge("main make_schedule routine failed to generate schedule in " +
"{} tries.".format(sch_tries)))
if save_play_schedule and not os.path.isfile(play_schedule_pkl_path()):
save_schedules([sch], play_schedule_pkl_path())
# add reffing duties
if reffing:
sch.add_reffing(debug=debug)
if debug:
print(sch.solution_debug_data(mut_idx))
delta = (datetime.datetime.now() - start).total_seconds()
print("total run_emr_job time was {} second and {} iterations".format(delta, mut_idx))
path = '/Users/coulter/Desktop/life_notes/2016_q1/scvl/'
# todo, change this to use print(datetime.datetime.now().date())
save_sch = False
if save_sch:
tag = '2016-09-06a_'
sch.gen_csv(path + tag + "simple.csv")
sch.write_audit_file(path + tag + "audit_2016_spr.csv")
sch_py_obj = path + tag + 'python_file_obj.pickle'
with open(sch_py_obj,'wb') as sch_file:
pickle.dump(sch, sch_file)
except (Exception, KeyboardInterrupt) as e:
print(sch.get_audit_text())
print('Initial traceback was:\n{}'.format(traceback.format_exc()))
raise (e)
return sch