| 306 | |
| 307 | |
| 308 | def plot_reward_lines(uav_reward_list, uav_penalty_list,full_path): |
| 309 | uav_reward_array=np.array(uav_reward_list).transpose((1,0)) |
| 310 | uav_penalty_array = np.array(uav_penalty_list).transpose((1, 0)) |
| 311 | uav_num = uav_reward_array.shape[0] |
| 312 | for i in range(uav_num): |
| 313 | if params.trainable is True: |
| 314 | plt.xlabel("Training episode") |
| 315 | else: |
| 316 | plt.xlabel("Step") |
| 317 | plt.ylabel("Reward/Penalty") |
| 318 | plt.plot(uav_reward_array[i],label="positive gain") |
| 319 | plt.plot(uav_penalty_array[i], label="negative penalty") |
| 320 | plt.grid(True) |
| 321 | plt.grid(linestyle='--') |
| 322 | plt.legend() |
| 323 | plt.savefig(full_path + "/" + "Reward_uav_%d"%i + '.png') |
| 324 | plt.close() |
| 325 | |
| 326 | def plot_fairness_lines(jain_fairness_list,gs_fairness_list,full_path): |
| 327 | plt.plot(jain_fairness_list,label="jain_fairness") |