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