agent.load(network_path + "trained/") agent.run_best_enable() while True: agent.main() env._print() ''' training_progress_log = rysy.Log(network_path + "progress_training.log") testing_progress_log = rysy.Log(network_path + "progress_testing.log") #process training total_games_to_play = 20000 while env.get_games_count() < total_games_to_play: agent.main() #print training progress %, ane score, every 256th iterations if verbose: if env.get_iterations()%256 == 0: env._print() env.render() if env.get_iterations()%256 == 0: str_progress = str(env.get_iterations()) + " " str_progress+= str(env.get_games_count()) + " " str_progress+= str(agent.get_epsilon_training()) + " " str_progress+= str(env.get_score()) + " " str_progress+= "\n" training_progress_log.put_string(str_progress)
epsilon_testing = 0.1 epsilon_decay = 0.99999 #init DQN agent agent = libs.libs_agent.agent_dqn.DQNAgent( env, network_path + "network_config.json", gamma, replay_buffer_size, epsilon_training, epsilon_testing, epsilon_decay) training_progress_log = rysy.Log(network_path + "progress_training.log") testing_progress_log = rysy.Log(network_path + "progress_testing.log") #process training total_games_to_play = 30000 while env.get_games_count() < total_games_to_play: result = agent.main() if result != 0: print("ERROR : agent returned ", result, "\n\n\n\n") break if env.get_iterations() % 256 == 0: str_progress = str(env.get_iterations()) + " " str_progress += str(env.get_games_count()) + " " str_progress += str(agent.get_epsilon_training()) + " " str_progress += str(env.get_score()) + " " str_progress += str(env.get_kill_count()) + " " str_progress += str(env.get_death_count()) + " " str_progress += str(env.get_game_kd_ratio()) + " " str_progress += str(env.get_kd_ratio()) + " " str_progress += "\n" training_progress_log.put_string(str_progress)