Skip to content

tools/bilateralize: Add option for balance equality constraint in load_and_solve - #536

Open
junukitashepard wants to merge 2 commits into
mainfrom
tools/bilateralize/load_and_solve
Open

tools/bilateralize: Add option for balance equality constraint in load_and_solve#536
junukitashepard wants to merge 2 commits into
mainfrom
tools/bilateralize/load_and_solve

Conversation

@junukitashepard

Copy link
Copy Markdown
Contributor

Add function to ensure balance equality in load_and_solve functions

What this PR does:

  • Add ensure_balance_equality to remove the default import/export balance_equality sets and replace them with sets for trade technologies' "piped/shipped" levels. In short, this ensures that commodities are not getting stockpiled at the trade layer of the model. Users can choose whether to invoke.
  • Add test for load_and_solve focused on this update; this test was written using Claude

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅

Add test for load_and_solve.py updates. Co-written using Claude Code.
@junukitashepard junukitashepard self-assigned this Jul 28, 2026
@junukitashepard junukitashepard added enh New features or functionality bilateralize Issues related to the bilateralization of trade labels Jul 28, 2026
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.27586% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.2%. Comparing base (8e13506) to head (16ae1fc).

Files with missing lines Patch % Lines
...age_ix_models/tools/bilateralize/load_and_solve.py 93.7% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #536   +/-   ##
=====================================
  Coverage   74.2%   74.2%           
=====================================
  Files        320     321    +1     
  Lines      25655   25713   +58     
=====================================
+ Hits       19047   19104   +57     
- Misses      6608    6609    +1     
Files with missing lines Coverage Δ
...ls/tests/tools/bilateralize/test_load_and_solve.py 100.0% <100.0%> (ø)
...age_ix_models/tools/bilateralize/load_and_solve.py 61.2% <93.7%> (+3.3%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

bilateralize Issues related to the bilateralization of trade enh New features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant