smart_grid_env / tasks /utils.py
Puneet Gopinath
feat: add new task configurations for balanced grid, solar management, and wind uncertainty, peak demand and full grid challenge
25a5d37 unverified
Raw
History Blame Contribute Delete
322 Bytes
"""
Utility functions for tasks.
"""
def compute_score(total_reward: float, max_possible_reward: float) -> float:
"""
Normalize all rewards into score in range [0, 1].
"""
if max_possible_reward <= 0:
return 0.0
score = total_reward / max_possible_reward
return min(max(score, 0.0), 1.0)