当前位置: 首页>>代码示例>>Python>>正文


Python Schedule.get_audit_text方法代码示例

本文整理汇总了Python中schedule.Schedule.get_audit_text方法的典型用法代码示例。如果您正苦于以下问题:Python Schedule.get_audit_text方法的具体用法?Python Schedule.get_audit_text怎么用?Python Schedule.get_audit_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在schedule.Schedule的用法示例。


在下文中一共展示了Schedule.get_audit_text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_schedule

# 需要导入模块: from schedule import Schedule [as 别名]
# 或者: from schedule.Schedule import get_audit_text [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
开发者ID:widgetOne,项目名称:league_admin,代码行数:60,代码来源:optimizer.py


注:本文中的schedule.Schedule.get_audit_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。