def run_dqn(config, gym_wrapper, summaries_collector_traj, summaries_collector): q_network = DeepQNetwork(config, gym_wrapper, trajectory=1) initial_time = round(time(), 3) q_network.train(summaries_collector) reward = q_network.test(summaries_collector, episodes=10, render=True) summaries_collector.read_summaries('test') total_time_traj = round(time(), 3) - initial_time print("tested avg reward: {0} in: {1}".format(reward, total_time_traj))
from config_utils import read_main_config from deep_q_network import DeepQNetwork from gym_wrapper import GymWrapper from tensorflow.python.framework.ops import disable_eager_execution disable_eager_execution() config = read_main_config() gym_wrapper = GymWrapper(config['general']['scenario']) deep_q_network = DeepQNetwork(config, gym_wrapper) deep_q_network.train() deep_q_network.test(episodes=3)