From 96fa707e52b0a0bbc11719445d9400b8c8a3a22a Mon Sep 17 00:00:00 2001 From: Limmen Date: Fri, 19 Jul 2024 21:00:39 +0200 Subject: [PATCH] fix linter --- .../run_vs_random_attacker_v_001.py | 8 ++++---- .../src/gym_csle_stopping_game/util/stopping_game_util.py | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/training/pomdp_solve/stopping_pomdp_defender/run_vs_random_attacker_v_001.py b/examples/training/pomdp_solve/stopping_pomdp_defender/run_vs_random_attacker_v_001.py index c3f2628a7..292519ca5 100644 --- a/examples/training/pomdp_solve/stopping_pomdp_defender/run_vs_random_attacker_v_001.py +++ b/examples/training/pomdp_solve/stopping_pomdp_defender/run_vs_random_attacker_v_001.py @@ -1,5 +1,4 @@ import numpy as np -from gym_csle_stopping_game.dao.stopping_game_config import StoppingGameConfig from csle_common.metastore.metastore_facade import MetastoreFacade from gym_csle_stopping_game.util.stopping_game_util import StoppingGameUtil from csle_tolerance.util.pomdp_solve_parser import PomdpSolveParser @@ -21,15 +20,16 @@ simulation_env_config.simulation_env_input_config.stopping_game_config.L = 1 simulation_env_config.simulation_env_input_config.stopping_game_config.O = list(range(10)) simulation_env_config.simulation_env_input_config.stopping_game_config.Z = \ - StoppingGameUtil.observation_tensor(n=10-1) + StoppingGameUtil.observation_tensor(n=10 - 1) gamma = 0.95 pi2 = np.array([ [0.9, 0.1], [1, 0], [1, 0] ]) - pomdp_solve_file_str = StoppingGameUtil.pomdp_solver_file(config=simulation_env_config.simulation_env_input_config.stopping_game_config, - discount_factor=gamma, pi2=pi2) + pomdp_solve_file_str = StoppingGameUtil.pomdp_solver_file( + config=simulation_env_config.simulation_env_input_config.stopping_game_config, + discount_factor=gamma, pi2=pi2) with open("/home/kim/thesis/paper_1.pomdp", 'w') as f: f.write(pomdp_solve_file_str) diff --git a/simulation-system/libs/gym-csle-stopping-game/src/gym_csle_stopping_game/util/stopping_game_util.py b/simulation-system/libs/gym-csle-stopping-game/src/gym_csle_stopping_game/util/stopping_game_util.py index 6a502eb82..ebcc587b6 100644 --- a/simulation-system/libs/gym-csle-stopping-game/src/gym_csle_stopping_game/util/stopping_game_util.py +++ b/simulation-system/libs/gym-csle-stopping-game/src/gym_csle_stopping_game/util/stopping_game_util.py @@ -384,7 +384,5 @@ def pomdp_solver_file(config: StoppingGameConfig, discount_factor: float, pi2: n for s_prime in config.S: for o in config.O: r = config.R[0][a1][0][s] - file_str = ( - file_str + f"R: {a1} : {s} : {s_prime} : {o} {r:.80f}\n" - ) + file_str = file_str + f"R: {a1} : {s} : {s_prime} : {o} {r:.80f}\n" return file_str