Skip to content

Commit

Permalink
Fix default stopping rule with limits (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 7, 2023
1 parent 22edecc commit e313580
Showing 1 changed file with 4 additions and 3 deletions.
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 stopping rule exists, add the default rule.
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

0 comments on commit e313580

Please sign in to comment.