Skip to content

Commit

Permalink
Merge pull request #210 from Limmen/dev6
Browse files Browse the repository at this point in the history
reward_function_config.py, transistion_operator_config.py
  • Loading branch information
Limmen authored Aug 16, 2023
2 parents 66e35a3 + 081d097 commit a55e0c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict, Any, List

import numpy as np
from numpy.typing import NDArray

from csle_base.json_serializable import JSONSerializable

Expand All @@ -10,7 +11,7 @@ class RewardFunctionConfig(JSONSerializable):
DTO containing the reward tensor of a simulation
"""

def __init__(self, reward_tensor: List):
def __init__(self, reward_tensor: NDArray[Any]):
"""
Initalizes the DTO
Expand All @@ -33,8 +34,8 @@ def to_dict(self) -> Dict[str, Any]:
"""
:return: a dict representation of the object
"""
d = {}
if isinstance(self.reward_tensor, np.ndarray):
d: Dict[str, Any] = {}
if isinstance(self.reward_tensor, type(NDArray[Any])):
tensor = self.reward_tensor.tolist()
else:
tensor = self.reward_tensor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List, Dict, Any
import numpy as np
from numpy.typing import NDArray
from csle_base.json_serializable import JSONSerializable


Expand All @@ -8,7 +9,7 @@ class TransitionOperatorConfig(JSONSerializable):
DTO representing the transition operator definition of a simulation
"""

def __init__(self, transition_tensor: List):
def __init__(self, transition_tensor: NDArray[Any]):
"""
Initializes the DTO
Expand All @@ -33,8 +34,8 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
if isinstance(self.transition_tensor, np.ndarray):
d: Dict[str, Any] = {}
if isinstance(self.transition_tensor, type(NDArray[Any])):
tensor = self.transition_tensor.tolist()
else:
tensor = self.transition_tensor
Expand Down

0 comments on commit a55e0c0

Please sign in to comment.