Example #1
0
    os.makedirs(args.log_dir)
logger = logging.getLogger('main')
logger.setLevel(logging.DEBUG)

file_name_time = f"{datetime.now().strftime('%Y%m%d-%H%M%S')}"
file_name = f"{args.log_dir}/{file_name_time}"

fh = logging.FileHandler(file_name + '.log')
fh.setLevel(logging.DEBUG)
sh = logging.StreamHandler()
sh.setLevel(logging.INFO)
logger.addHandler(fh)
logger.addHandler(sh)

#Config File
parameters = u.get_info_file(args.parameters)
episodes = parameters['episodes']
parameters['log_path'] = args.log_dir
action_interval = parameters['action_interval']

#start wandb
u.wand_init("TLC - Results C2",
            f"new_dqn: {ntpath.basename(args.parameters)[:-5]}", "new_dqn")

# create world
world = World(args.config_file, thread_num=args.thread)

# create agents
agents = []

#parameters['buffer_size'] = parameters['buffer_size']*len(world.intersections)
Example #2
0
if not os.path.exists(args.log_dir):
    os.makedirs(args.log_dir)

file_name_time = f"{datetime.now().strftime('%Y%m%d-%H%M%S')}"
file_name = f"{args.log_dir}/{file_name_time}"
logger = logging.getLogger('main')
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler(file_name + ".log")
fh.setLevel(logging.DEBUG)
sh = logging.StreamHandler()
sh.setLevel(logging.INFO)
logger.addHandler(fh)
logger.addHandler(sh)

#Get file with informations
info_file = u.get_info_file(args.info_file)
offset_phase_train = info_file['offset_phase_train']
offset_phase = info_file['offset_phase']
flag_default_reward = info_file['flag_default_reward']
flag_mean_reward = info_file['flag_mean_reward']

episodes = args.episodes if info_file['flag_arg_episode'] else info_file['episodes']

#start wandb
u.wand_init("TLC - Results", f"ES_DQN: {ntpath.basename(args.info_file)[:-5]}",'ES_DQN')

# create world
world = World(args.config_file, thread_num=args.thread)

# define tempo de amarelo
yellow_phase_time = 0