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

Fix default stopping rule with limits #662

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1046,9 +1046,6 @@ function train(
# something like stopping_rules = [SDDP.IterationLimit(100)], the vector
# will be concretely typed and we can't add a TimeLimit.
stopping_rules = convert(Vector{AbstractStoppingRule}, stopping_rules)
if isempty(stopping_rules)
push!(stopping_rules, SimulationStoppingRule())
end
# Add the limits as stopping rules. An IterationLimit or TimeLimit may
# already exist in stopping_rules, but that doesn't matter.
if iteration_limit !== nothing
Expand All @@ -1057,6 +1054,10 @@ function train(
if time_limit !== nothing
push!(stopping_rules, TimeLimit(time_limit))
end
# If no stoppinng rule exists, add the default rule.
odow marked this conversation as resolved.
Show resolved Hide resolved
if isempty(stopping_rules)
push!(stopping_rules, SimulationStoppingRule())
end
# Update the nodes with the selected cut type (SINGLE_CUT or MULTI_CUT)
# and the cut deletion minimum.
if cut_deletion_minimum < 0
Expand Down
Loading