Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion logic/pve/official_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import argparse
import importlib
import json
import math
import os
import sys
from pathlib import Path
Expand All @@ -46,6 +47,11 @@
from RLInterfaces import BaseAgent


def _smooth_score(score: float, scale: float = 1000.0) -> float:
"""Bounded score smoothing using tanh followed by sigmoid."""
z = math.tanh(score / scale)
return 1.0 / (1.0 + math.exp(-z))

def load_agent(submission_dir: str, model_path: Optional[str], env: GameEnvironment) -> BaseAgent:
"""
Dynamically load contestant's Agent class from submission_dir/agent.py.
Expand Down Expand Up @@ -123,7 +129,8 @@ def evaluate(
action = agent.get_action(obs)
obs, _reward, terminated, truncated, info = env.step(action)
ep_len += 1
ep_score = info.get("score", 0.0)
raw_score = info.get("score", 0.0)
ep_score = _smooth_score(raw_score)
Comment thread
jxd136 marked this conversation as resolved.
done = terminated or truncated

scores.append(ep_score)
Expand Down
Loading