File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 8
8
from ray .rllib .env import MultiAgentEnv
9
9
from utility import create_intial_agents , grid_to_observation
10
10
11
+ # Don't create the ABMSimulator as argument default: https://docs.astral.sh/ruff/rules/function-call-in-default-argument/
12
+ ABM_SIMULATOR = ABMSimulator ()
13
+
11
14
12
15
class WolfSheepRL (WolfSheep , MultiAgentEnv ):
13
16
def __init__ (
14
17
self ,
15
- simulator : ABMSimulator | None ,
16
18
width = 20 ,
17
19
height = 20 ,
18
20
initial_sheep = 100 ,
@@ -25,12 +27,8 @@ def __init__(
25
27
sheep_gain_from_food = 4 ,
26
28
seed = 42 ,
27
29
vision = 4 ,
30
+ simulator : ABMSimulator = ABM_SIMULATOR ,
28
31
):
29
- """Create a new WolfRL-Sheep model with the given parameters."""
30
- # Don't create the ABMSimulator as argument default: https://docs.astral.sh/ruff/rules/function-call-in-default-argument/
31
- if simulator is None :
32
- simulator = ABMSimulator ()
33
-
34
32
super ().__init__ (
35
33
width ,
36
34
height ,
You can’t perform that action at this time.
0 commit comments