######################################################################################## radio_frame = 20 seeds = np.arange(100).tolist() seeds = [98] start_time = time.time() for seed in seeds: random.seed(seed) np.random.seed(seed) env = radio_environment(seed=seed) agent = QLearner(seed=seed) run_agent_fpa(env) # run_agent_tabular(env) # run_agent_deep(env) # run_agent_optimal(env) ######################################################################################## end_time = time.time() filename = 'figures/timing_M={}.txt'.format(env.M_ULA) file = open(filename, 'w') duration = 1000. * (end_time - start_time) print('Execution time: {:4f} ms.\n'.format(duration))
ax.set_ylabel(r'$Q$') ax_sec.set_ylabel(r'$L$') plt.legend([plot1, plot2], [r'Average $Q$', r'Average loss'], bbox_to_anchor=(0.1, 0.0, 0.80, 1), bbox_transform=fig.transFigure, loc='lower center', ncol=3, mode="expand", borderaxespad=0.) plt.tight_layout() plt.savefig('output.pdf', format='pdf') plt.show() plt.close(fig) seeds = np.arange(1).tolist() for seed in seeds: env = radio_environment(random_state=seed) agent = QLearner(random_state=seed) start_time = time.time() run_agent_q(env) end_time = time.time() print('Simulation took {:.2f} minutes.'.format( (end_time - start_time) / 60.)) ########################################################################################