Skip to content

add npv regression test for circularities example#1333

Draft
Aurashk wants to merge 2 commits into
mainfrom
add-circularities-with-npv-to-regresssion
Draft

add npv regression test for circularities example#1333
Aurashk wants to merge 2 commits into
mainfrom
add-circularities-with-npv-to-regresssion

Conversation

@Aurashk

@Aurashk Aurashk commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds a new regression test for the circularities model with the agent objectives all patched with lcox -> npv

Fixes #1246

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.53%. Comparing base (466a56e) to head (604c6cc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1333      +/-   ##
==========================================
+ Coverage   89.51%   89.53%   +0.02%     
==========================================
  Files          58       58              
  Lines        8537     8555      +18     
  Branches     8537     8555      +18     
==========================================
+ Hits         7642     7660      +18     
  Misses        580      580              
  Partials      315      315              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Aurashk

Aurashk commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

@tsmbland thought you might be the best person to look at this because it looks like you did some work on circularities recently. After merging back on main the new circularities npv model fails to run all the way through. Initially it was able to run with no errors. Not sure if this is expected or not.

thread 'regression::circularity_npv' (357199) panicked at tests/common.rs:12:31:
Unexpected failure.
code=1
stderr=
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASDRV.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OAGRSV.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASPRC.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OILREF.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OILRF2.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process WNDFRM.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASCGT.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process H2YGEN.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process H2YPRO.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TPETCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TDIECR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TELCCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process THYBCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RGASBR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RELCHP.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process BIOPRO.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process BIOPLL.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RBIOBL.
[10:12:01 ERROR muse2] Agent investment failed

Caused by:
    0: Investments failed for market set (ELCTRI|GBR, H2YPRD|GBR) with cyclical dependencies. Please note that the investment algorithm is currently experimental for models with circular commodity dependencies and may not be able to find a solution in all cases.
    1: Failed to meet demand for commodity \'H2YPRD\' in region \'GBR\' with provided investment options. This may be due to overly restrictive process investment constraints.


command=`MUSE2_USE_DEFAULT_SETTINGS="1" "/home/aurash/repos/MUSE_2.0/target/debug/muse2" "example" "run" "circularity_npv" "--debug-model" "--output-dir" "/tmp/.tmpESWEjx" "--patch"`
code=1
stdout=
[10:12:00 INFO muse2::cli] Starting MUSE2 v2.1.0
[10:12:00 INFO muse2::cli] Loaded model from /tmp/.tmpaEzzDm/circularity_npv
[10:12:00 INFO muse2::cli] Output folder: /tmp/.tmpESWEjx
[10:12:00 INFO muse2::simulation] Milestone year: 2020
[10:12:00 INFO muse2::simulation] Running dispatch optimisation...
[10:12:00 INFO muse2::simulation] Milestone year: 2030
[10:12:00 INFO muse2::simulation] Running agent investment...
[10:12:00 INFO muse2::simulation] Running dispatch optimisation...
[10:12:00 INFO muse2::simulation] Max ironing out iterations (1) reached
[10:12:00 INFO muse2::simulation] Running final dispatch optimisation for year 2030...
[10:12:00 INFO muse2::simulation] Milestone year: 2040
[10:12:00 INFO muse2::simulation] Running agent investment...

stderr=
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASDRV.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OAGRSV.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASPRC.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OILREF.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process OILRF2.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process WNDFRM.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process GASCGT.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process H2YGEN.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process H2YPRO.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TPETCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TDIECR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process TELCCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process THYBCR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RGASBR.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RELCHP.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process BIOPRO.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process BIOPLL.
[10:12:00 WARN muse2::input::process] Using default end year 2040 for process RBIOBL.
[10:12:01 ERROR muse2] Agent investment failed

Caused by:
    0: Investments failed for market set (ELCTRI|GBR, H2YPRD|GBR) with cyclical dependencies. Please note that the investment algorithm is currently experimental for models with circular commodity dependencies and may not be able to find a solution in all cases.
    1: Failed to meet demand for commodity \'H2YPRD\' in region \'GBR\' with provided investment options. This may be due to overly restrictive process investment constraints.

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.

Add test for circularities example with NPV

1 participant