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

default number_of_units for non-investable and investable units #1184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nnhjy
Copy link
Member

@nnhjy nnhjy commented Mar 7, 2025

Fixes #1163

Checklist before merging

  • Documentation is up-to-date
  • Unit tests have been added/updated accordingly
  • Code has been formatted according to SpineOpt's style
  • Unit tests pass

@nnhjy nnhjy requested a review from nhniina March 7, 2025 11:03
@nnhjy nnhjy self-assigned this Mar 7, 2025
@nhniina
Copy link
Contributor

nhniina commented Mar 7, 2025

Looks in general ok to me. I'm just wondering why to use

        + (
            is_candidate(unit=u) ? 
            number_of_units(m; unit=u, stochastic_scenario=s, t=t, _default=0) : 
            number_of_units(m; unit=u, stochastic_scenario=s, t=t)
        )

instead of creating _default_nb_of_units(u) = is_candidate(unit=u) ? 0 : 1 and then using that in number_of_units(m; unit=u, stochastic_scenario=s, t=t, _default=_default_nb_of_units(u))? Wouldn't it be cleaner? I didn't quite understand how that is related to whether or not units have units_on (#1163 (comment)).

… DB (2) use consistent functions to adjust the default `number_of_xx` when the `xx` (unit, node, connection) is investable.
@nnhjy
Copy link
Member Author

nnhjy commented Mar 7, 2025

Looks in general ok to me. I'm just wondering why to use

        + (
            is_candidate(unit=u) ? 
            number_of_units(m; unit=u, stochastic_scenario=s, t=t, _default=0) : 
            number_of_units(m; unit=u, stochastic_scenario=s, t=t)
        )

instead of creating _default_nb_of_units(u) = is_candidate(unit=u) ? 0 : 1 and then using that in number_of_units(m; unit=u, stochastic_scenario=s, t=t, _default=_default_nb_of_units(u))? Wouldn't it be cleaner? I didn't quite understand how that is related to whether or not units have units_on (#1163 (comment)).

Good suggestion! Thx. They are implemented in the new commit.
I've also updated #1163 (comment) based on the latest progress.

Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.38%. Comparing base (c143931) to head (9448056).

Files with missing lines Patch % Lines
src/constraints/constraint_common.jl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1184      +/-   ##
==========================================
- Coverage   87.38%   87.38%   -0.01%     
==========================================
  Files         144      144              
  Lines        4423     4430       +7     
==========================================
+ Hits         3865     3871       +6     
- Misses        558      559       +1     

☔ View full report in Codecov by Sentry.
📢 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.

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.

Inconsistency in the default number_of_units when using candidate_units
2 participants