Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce run.optimization.remove_solution() #139

Merged
merged 8 commits into from
Jan 24, 2025

Conversation

glatterf42
Copy link
Member

This PR is the first part of cleaning up #101. It introduces the run.optimization.remove_solution() in the core layer, which removes all data of all equations and variables belonging to the run.
It also includes various small clean-ups that arose from the reviews of #101.

@glatterf42 glatterf42 added the enhancement New feature or request label Nov 28, 2024
@glatterf42 glatterf42 self-assigned this Nov 28, 2024
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.9%. Comparing base (c243743) to head (b145b63).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #139   +/-   ##
=====================================
  Coverage   86.9%   86.9%           
=====================================
  Files        230     230           
  Lines       8156    8162    +6     
=====================================
+ Hits        7094    7100    +6     
  Misses      1062    1062           
Files with missing lines Coverage Δ
ixmp4/core/optimization/data.py 100.0% <100.0%> (ø)
ixmp4/core/optimization/equation.py 93.5% <ø> (ø)
ixmp4/core/optimization/parameter.py 93.3% <ø> (ø)
ixmp4/core/optimization/table.py 92.5% <ø> (ø)
ixmp4/core/optimization/variable.py 93.6% <ø> (ø)
ixmp4/data/db/optimization/equation/model.py 100.0% <100.0%> (ø)
ixmp4/data/db/optimization/equation/repository.py 98.7% <100.0%> (ø)
ixmp4/data/db/optimization/indexset/repository.py 98.1% <ø> (-0.1%) ⬇️
ixmp4/data/db/optimization/scalar/repository.py 98.2% <100.0%> (-0.1%) ⬇️
ixmp4/data/db/optimization/table/repository.py 98.4% <ø> (-0.1%) ⬇️
... and 3 more

@glatterf42 glatterf42 force-pushed the remove/pointless-tabulate-parameter branch from 50d6fae to 79b2c14 Compare November 29, 2024 13:23
@glatterf42 glatterf42 force-pushed the enh/run-remove-solution branch from aece6a0 to 6ebef60 Compare November 29, 2024 13:24
@glatterf42 glatterf42 changed the title Introduce run.optimization.remove_ solution() Introduce run.optimization.remove_solution() Nov 29, 2024
@glatterf42 glatterf42 force-pushed the remove/pointless-tabulate-parameter branch from 79b2c14 to bc61725 Compare December 19, 2024 11:12
Base automatically changed from remove/pointless-tabulate-parameter to main December 19, 2024 11:32
@glatterf42 glatterf42 force-pushed the enh/run-remove-solution branch from 6ebef60 to ba074b7 Compare December 19, 2024 11:36
@glatterf42 glatterf42 requested a review from meksor December 19, 2024 11:36
@glatterf42 glatterf42 force-pushed the enh/run-remove-solution branch from ba074b7 to b0201c6 Compare December 19, 2024 12:42
@glatterf42 glatterf42 requested review from meksor and removed request for meksor January 14, 2025 07:11
@glatterf42 glatterf42 force-pushed the enh/run-remove-solution branch from b0201c6 to 48e1d4c Compare January 24, 2025 12:36
Copy link
Contributor

@meksor meksor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions but good all in all.

data=data_to_validate,
columns=self.columns,
)
if data_to_validate != {}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if data_to_validate != {}:
if data_to_validate:

or more explicit:

Suggested change
if data_to_validate != {}:
if bool(data_to_validate):

ditto above in the same function.
Why? Because None != {} is True.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit: I don't know how data_to_validate could be None, but I added these suggestions and will merge the PR :)

ixmp4/data/db/optimization/equation/model.py Outdated Show resolved Hide resolved
@glatterf42 glatterf42 merged commit 1c62638 into main Jan 24, 2025
13 checks passed
@glatterf42 glatterf42 deleted the enh/run-remove-solution branch January 24, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants