def main(args): if args.dt is not None: if args.abr == 'pensieve': pensiedt.PensieveDT().main(args) elif args.abr == 'robustmpc': robustmdt.RobustMPCDT().main(args) elif args.abr == 'hotdash': hotdadt.HotdashDT().main(args) else: if args.abr == 'pensieve': pensieve.Pensieve().main(args) elif args.abr == 'robustmpc': robustmpc.RobustMPC().main(args) elif args.abr == 'hotdash': hotdash.Hotdash().main(args)
def run(args): if args.abr == 'pensieve': teacher = pensieve.Pensieve() elif args.abr == 'robustmpc': teacher = robustmpc.RobustMPC() elif args.abr == 'hotdash': teacher = hotdash.Hotdash() else: raise NotImplementedError input_dict = {'args': args, 'teacher': teacher} handler_class = make_request_handler(input_dict=input_dict) server_address = (IP_ADDR, IP_PORT) httpd = ThreadedHTTPServer(server_address, handler_class) mlog(fnc="run()", msg="Listening on IP {}, port {}".format(IP_ADDR, IP_PORT)) httpd.serve_forever()
args.traces) if args.abr == 'hotdash': net_env = env_hotdash.Environment(all_cooked_time=all_cooked_time, all_cooked_bw=all_cooked_bw, all_file_names=all_file_names) else: net_env = env.Environment(all_cooked_time=all_cooked_time, all_cooked_bw=all_cooked_bw, all_file_names=all_file_names) if args.abr == 'pensieve': teacher = pensieve.Pensieve() student = pensilin.Pensilin() #test = pensieve.Pensieve() elif args.abr == 'robustmpc': teacher = robustmpc.RobustMPC() student = robustlin.Robustlin() elif args.abr == 'hotdash': teacher = hotdash.Hotdash() student = hotdlin.Hotdlin() else: raise NotImplementedError # Step 1: Initialization for the first iteration trace = get_rollouts(env=net_env, policy=teacher, args=args, n_batch_rollouts=n_batch_rollouts, policy1=teacher) states.extend((state for state, _, _ in trace)) actions.extend((action for _, action, _ in trace))