def get_schedule(count_of_machines, count_of_jobs, list_of_weights): sch = gready_schedule(count_of_machines, count_of_jobs, list_of_weights) b_max = get_time_of_schedule(sch, count_of_machines, count_of_jobs, list_of_weights) best_schedule = None best_schedule_time = float('+inf') constructor = DFSSchedule() constructor.construct_dfs_schedule(count_of_machines, count_of_jobs, list_of_weights, [0] * count_of_jobs, 0, b_max) return constructor.best_schedule
def get_schedule(count_of_machines, count_of_jobs, list_of_weights, epsilon): b_min = max(list_of_weights) sch = gready_schedule(count_of_machines, count_of_jobs, list_of_weights) b_max = get_time_of_schedule(sch, count_of_machines, count_of_jobs, list_of_weights) while (float(b_max) / float(b_min) > epsilon): tmp_sch = get_schedule_or_none(count_of_machines, count_of_jobs, list_of_weights, (float(b_max) + float(b_min)) / 2) if tmp_sch == None: b_min = (float(b_max) + float(b_min)) / 2 else: sch = tmp_sch b_max = (float(b_max) + float(b_min)) / 2 return sch