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

Merged
merged 8 commits into from
Nov 26, 2024
7 changes: 6 additions & 1 deletion src/constraints/constraint_units_available.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ function _build_constraint_units_available(m, u, s, t)
init=0,
)
<=
number_of_units(m; unit=u, stochastic_scenario=s, analysis_time=t0, t=t)
number_of_units(m; unit=u, stochastic_scenario=s, analysis_time=t0, t=t,
_default=_default_number_of_units(u))
)
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
Contributor 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.


"""
constraint_units_available_indices(m::Model, unit, t)

Expand Down
Loading