################# actions = {} ## Set high episode to test convergence # Change back to resonable setting for other testing n_episodes = 2500 ######################### # Statistic variables # ######################### k = 50 # Used for average win rates p = 5 # Print episodic results every p episodes stats = AgentStatistics(names[0], n_episodes, k, save_file=os.getcwd() + "/saved-stats/A2C_test_2_stats") scores = [] short_term_wr = np.zeros((k, ), dtype=int) # Used to average win rates short_term_scores = [0.5] # Average win rates per k episodes ties = 0 losses = 0 score = 0 current_eps = 0 epsilonVals = [] current_loss = 0 lossVals = [] average_reward = 0 avgRewardVals = []
players[1] = random_actions(env.num_actions_per_turn, 1, map_name) names[1] = 'Random Agent' ################# actions = {} ## Set high episode to test convergence # Change back to resonable setting for other testing n_episodes = 20000 ######################### # Statistic variables # ######################### k = 100 stats = AgentStatistics(names[0], n_episodes, k, save_file='./saved-stats/smart_state_newton') short_term_wr = np.zeros((k, ), dtype=int) # Used to average win rates ties = 0 losses = 0 score = 0 current_eps = 0 current_loss = 0 q_values = 0 reward = {0: 0, 1: 0} ##################### # Training Loop #
players[1] = base_rushV1(env.num_actions_per_turn, 1) names[1] = 'Base Rush v1' ################# actions = {} ## Set high episode to test convergence # Change back to resonable setting for other testing n_episodes = 50 ######################### # Statistic variables # ######################### k = 100 stats = AgentStatistics(names[0], n_episodes, k, save_file='/saved-stats/local') short_term_wr = np.zeros((k, ), dtype=int) # Used to average win rates ties = 0 losses = 0 score = 0 current_eps = 0 current_loss = 0 q_values = 0 reward = {0: 0, 1: 0} ##################### # Training Loop #
actions = {} ## Set high episode to test convergence # Change back to resonable setting for other testing n_episodes = 2500 RENDER_CHARTS = True # Determines if final charts should be rendered timestep = 0 ######################### # Statistic variables # ######################### k = 100 #The set number of episodes to show win rates for # The Stats class (for saving statistics) stats = AgentStatistics(names[0], n_episodes, k, save_file="/saved-stats/rppo_newton_v14") # General stats score = 0 losses = 0 ties = 0 # Short wr short_term_wr = np.zeros((k, ), dtype=int) # Used to average win rates # Epsilon and losses current_eps = 0 current_loss = 0 current_actor_loss = 0 current_critic_loss = 0
from utils.Statistics import AgentStatistics from agents.Smart_State.render_smart_state import render_charts # Create and load the statistics SAVED_STATS_PATH = 'saved-stats/best_smart_state' stats = AgentStatistics() stats.load_stats(SAVED_STATS_PATH) # Render the charts render_charts(stats)
names[0] = "DQN Agent" players[1] = random_actions_delay(env.num_actions_per_turn, 1, map_name) names[1] = 'Random Agent Delay' ################# actions = {} ## Set high episode to test convergence # Change back to resonable setting for other testing n_episodes = 5000 ######################### # Statistic variables # ######################### k = 100 stats = AgentStatistics(names[0], n_episodes, k, save_file="saved-stats/dqn_new") short_term_wr = np.zeros((k,), dtype=int) # Used to average win rates ties = 0 losses = 0 score = 0 current_eps = 0 current_loss = 0 q_values = 0 reward = {0: 0, 1: 0} ######################### ##################### # Training Loop #