Skip to content
Snippets Groups Projects
Commit ba5ea65f authored by u214892's avatar u214892
Browse files

Merge branch 'master' of gitlab.aicrowd.com:flatland/baselines

parents 5802f6dc fea7ded7
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ def min_lt(seq, val): ...@@ -31,7 +31,7 @@ def min_lt(seq, val):
return min return min
def norm_obs_clip(obs, clip_min=-1, clip_max=1): def norm_obs_clip(obs, clip_min=-1, clip_max=1, fixed_radius=0):
""" """
This function returns the difference between min and max value of an observation This function returns the difference between min and max value of an observation
:param obs: Observation that should be normalized :param obs: Observation that should be normalized
...@@ -39,8 +39,12 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1): ...@@ -39,8 +39,12 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1):
:param clip_max: max value where observation will be clipped :param clip_max: max value where observation will be clipped
:return: returnes normalized and clipped observatoin :return: returnes normalized and clipped observatoin
""" """
max_obs = max(1, max_lt(obs, 1000)) if fixed_radius > 0:
min_obs = min(max_obs, min_lt(obs, 0)) max_obs = fixed_radius
else:
max_obs = max(1, max_lt(obs, 1000)) + 1
min_obs = 0 # min(max_obs, min_lt(obs, 0))
if max_obs == min_obs: if max_obs == min_obs:
return np.clip(np.array(obs) / max_obs, clip_min, clip_max) return np.clip(np.array(obs) / max_obs, clip_min, clip_max)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment