Skip to content

L2RPN scores: read the production for the 100 points anchor - #798

Open
xl0g wants to merge 1 commit into
Grid2op:dev_1.12.7from
xl0g:fix-issue-792-best-anchor
Open

xl0g wants to merge 1 commit into
Grid2op:dev_1.12.7from
xl0g:fix-issue-792-best-anchor

Conversation

@xl0g

@xl0g xl0g commented Nov 25, 2026

Copy link
Copy Markdown
added removed
Python (grid2op package) +1 -1
Tests (grid2op/tests) +77 -0
Docs + changelog + notebooks +3 -0
total +81 -1

Fixes the first point of #792. The second point, whether the 100 points anchor should be a cost rather than MW, is a choice about the formula and is left out of this PR.

What

ScoreL2RPN2020._compute_episode_score reads "load_p" twice:

load_p_rp, ids_rp = self.stat_no_overflow_rp.get("load_p")
prod_p_rp, _ = self.stat_no_overflow_rp.get("load_p")

so ep_losses = prod - load is always 0, and so is the 100 points anchor best_score. Before c9fe76a, which moved the computation to stat_no_overflow_rp, the second line read "prod_p". This PR puts it back. ScoreICAPS2021, ScoreL2RPN2022 and ScoreL2RPN2023 reuse this method, so they are fixed too.

Scores near the top of the range change: an agent between the reference agent and the best anchor now gets fewer points than before.

Test

test_issue_792.py scores a do nothing agent on two scenarios of l2rpn_case14_sandbox and checks that the 100 points anchor passed to np.interp equals the losses of the reference agent times min_losses_ratio, computed from the statistics. It fails before the fix, with an anchor of 0, and passes after.

The other score tests pass: test_utils, test_highres_sim_counter_in_scores, test_score_idf_2023, test_score_idf_2023_nres, test_score_idf_2023_assistant, test_issue_591 and test_score_wcci_2022.

)

ScoreL2RPN2020._compute_episode_score read "load_p" twice, so the losses
of the reference agent, production minus load, were always 0 and so was
the 100 points anchor. It reads "prod_p" again, as before c9fe76a.
ScoreICAPS2021, ScoreL2RPN2022 and ScoreL2RPN2023 reuse that method.

The regression test checks the anchor against the losses computed from
the statistics of two scenarios of l2rpn_case14_sandbox.

Assisted-by: Claude Code (claude-opus-5-5)
Signed-off-by: xl0g <53918010+xl0g@users.noreply.github.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant