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

Changed the default number of units based on is_candidate. #1036

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

Conversation

Mastomaki
Copy link

This one adds the same functionality for units as is already for storages and connections, namely overriding the default number of units.

However, it can be confusing to the user because as far as I see the overriding has not been mentioned in the documentation.

@DillonJ
Copy link
Collaborator

DillonJ commented Jul 4, 2024

Nice work @Mastomaki - this makes a lot of sense - looks like all tests are passing and it can be merged. @manuelma does this look ok to you?

Edit: once the conflicts are resolved I suppose

)
end

# Change the default number of units so that it is zero when candidate units are present
# and otherwise 1.
_default_number_of_units(u) = is_candidate(unit=u) ? 0 : 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the 1 be number_of_units(...) instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, unit tests?

Copy link
Author

Choose a reason for hiding this comment

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

I now changed the code to reflect this and updated the unit test.

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.82%. Comparing base (5fc28a5) to head (0ab72ce).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1036   +/-   ##
=======================================
  Coverage   86.82%   86.82%           
=======================================
  Files         143      143           
  Lines        4121     4121           
=======================================
  Hits         3578     3578           
  Misses        543      543           

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

+ number_of_units(m; unit=u, stochastic_scenario=s, t=t)
# Change the default number of units so that it is zero when candidate units are present
# and otherwise 1.
+ ifelse(is_candidate(unit=u), 0, number_of_units(m; unit=u, stochastic_scenario=s, t=t) )
Copy link
Collaborator

@manuelma manuelma Sep 11, 2024

Choose a reason for hiding this comment

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

Doesn't this disallow having both number_of_units and candidate_units different than zero? It looks like if the user specifies candidate_units different than zero then any non zero value for number_of_units is just ignored? Or I am missing something?

Copy link
Author

Choose a reason for hiding this comment

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

Indeed. Now I tried to correct it.

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.

3 participants