fix: add objectives support to NuconGoalEnv; fix README uncertainty example

- NuconGoalEnv now accepts objectives/objective_weights; additive on top
  of the goal reward, same interface as NuconEnv
- README: use UncertaintyPenalty/UncertaintyAbort correctly (via objectives
  and terminators, not as constructor params that don't exist)
- Step 3 prose updated to reference composable callables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 18:55:16 +01:00
co-authored by Claude Sonnet 4.6
parent f4d45d3cfd
commit 36a33e74e5
2 changed files with 14 additions and 2 deletions
+6
View File
@@ -280,6 +280,8 @@ class NuconGoalEnv(gym.Env):
seconds_per_step=5,
terminators=None,
terminate_above=0,
objectives=None,
objective_weights=None,
):
super().__init__()
@@ -349,6 +351,9 @@ class NuconGoalEnv(gym.Env):
self.action_space = spaces.Dict(action_spaces)
self._terminators = terminators or []
_objs = objectives or []
self._objectives = [Objectives[o] if isinstance(o, str) else o for o in _objs]
self._objective_weights = objective_weights or [1.0] * len(self._objectives)
self._desired_goal = np.zeros(n_goals, dtype=np.float32)
self._total_steps = 0
@@ -410,6 +415,7 @@ class NuconGoalEnv(gym.Env):
info = {'achieved_goal': obs['achieved_goal'], 'desired_goal': obs['desired_goal'],
'obs': obs['observation']}
reward = float(self.compute_reward(obs['achieved_goal'], obs['desired_goal'], info))
reward += sum(w * o(obs['observation']) for o, w in zip(self._objectives, self._objective_weights))
terminated = any(t(obs['observation']) > self.terminate_above for t in self._terminators)
truncated = False
return obs, reward, terminated, truncated, info