Skip to content
Snippets Groups Projects
Commit ea3e2f25 authored by Philipp Sauer's avatar Philipp Sauer
Browse files

Reworked cost and goal_met logic

parent fc71eea1
Branches
No related tags found
No related merge requests found
......@@ -387,7 +387,7 @@ class Encoder_DDPG_Adpt_Shield():
avg_goal_reaches += 1
# Check for crash
elif cost > 0:
if cost > 0:
avg_safety_violations += 1
done = True
break
......@@ -467,21 +467,21 @@ class Encoder_DDPG_Adpt_Shield():
self.update_target(self.target_actor.variables, self.actor.variables)
self.update_target(self.target_critic.variables, self.critic.variables)
total_updates += 1
# check for goal reach
if info.get('goal_met', False):
episode_goal_reaches += 1
self.safe_observations.append((prev_state, action))
# check for crash
elif cost > 0:
if cost > 0:
episode_safety_violations += 1
self.unsafe_observations.append((prev_state, action))
done = True
break
# check for goal reach
elif info.get('goal_met', False):
episode_goal_reaches += 1
self.safe_observations.append((prev_state, action))
# save the init step
if (episode_steps-1 == 0) and cost == 0:
elif episode_steps-1 == 0:
self.safe_observations.append((prev_state, action))
prev_state = next_state
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment