1
1
from typing import List
2
- from gymnasium .envs .registration import register
3
2
import math
4
3
import numpy as np
5
4
@@ -22,9 +21,14 @@ def threshold_probability(b1: float, threshold: float, k=-20) -> float:
22
21
return 1.0
23
22
if round (b1 , 2 ) == 0 :
24
23
return 0.0
25
- if (threshold * (1 - b1 )) > 0 and (b1 * (1 - threshold )) / (threshold * (1 - b1 )) > 0 :
24
+ if (threshold * (1 - b1 )) > 0 and (b1 * (1 - threshold )) / (
25
+ threshold * (1 - b1 )
26
+ ) > 0 :
26
27
try :
27
- return math .pow (1 + math .pow (((b1 * (1 - threshold )) / (threshold * (1 - b1 ))), k ), - 1 )
28
+ return math .pow (
29
+ 1 + math .pow (((b1 * (1 - threshold )) / (threshold * (1 - b1 ))), k ),
30
+ - 1 ,
31
+ )
28
32
except Exception :
29
33
return 0.0
30
34
else :
@@ -51,7 +55,9 @@ def inverse_sigmoid(y) -> float:
51
55
return math .log (y / (1 - y ), math .e )
52
56
53
57
@staticmethod
54
- def sample_next_state (transition_tensor : List [List [List [float ]]], s : int , a : int , states : List [int ]) -> int :
58
+ def sample_next_state (
59
+ transition_tensor : List [List [List [float ]]], s : int , a : int , states : List [int ]
60
+ ) -> int :
55
61
"""
56
62
Samples the next state of a MDP or POMDP
57
63
@@ -73,13 +79,15 @@ def register_envs() -> None:
73
79
74
80
:return: None
75
81
"""
82
+ from gymnasium .envs .registration import register
83
+
76
84
register (
77
- id = ' csle-tolerance-intrusion-recovery-pomdp-v1' ,
78
- entry_point = ' csle_tolerance.envs.intrusion_recovery_pomdp_env:IntrusionRecoveryPomdpEnv' ,
79
- kwargs = {' config' : None }
85
+ id = " csle-tolerance-intrusion-recovery-pomdp-v1" ,
86
+ entry_point = " csle_tolerance.envs.intrusion_recovery_pomdp_env:IntrusionRecoveryPomdpEnv" ,
87
+ kwargs = {" config" : None },
80
88
)
81
89
register (
82
- id = ' csle-tolerance-intrusion-response-cmdp-v1' ,
83
- entry_point = ' csle_tolerance.envs.intrusion_response_cmdp_env:IntrusionResponseCmdpEnv' ,
84
- kwargs = {' config' : None }
90
+ id = " csle-tolerance-intrusion-response-cmdp-v1" ,
91
+ entry_point = " csle_tolerance.envs.intrusion_response_cmdp_env:IntrusionResponseCmdpEnv" ,
92
+ kwargs = {" config" : None },
85
93
)
0 commit comments