Skip to content

Commit

Permalink
Add exit condition check in large lambdas as well
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesYang007 committed Jul 1, 2024
1 parent 60847b4 commit dee7706
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion adelie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# - Leda Guin
# - Ginnie Guin

__version__ = "1.1.44"
__version__ = "1.1.45"

# Set environment flags before loading adelie_core
import os
Expand Down
14 changes: 6 additions & 8 deletions adelie/src/include/adelie_core/solver/solver_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,6 @@ inline void solve_core(
if (i < large_lmda_path.size()-1) {
// update progress bar
static_cast<void>(pb_it != pb.end());

// Do not check for early-stopping.
// This choice is deliberate for these reasons:
// We are in this loop only because the user has supplied their path.
// In this case, we should provide what they asked for.
// If alpha == 0, this loop is costly but this is also the only time the solutions are actually changing.
// If alpha > 0, the solution is the same at every iteration.
// Depending on alpha, we have different reasons for not early stopping.
}

auto tup = fit_f(state, large_lmda_path[i]);
Expand All @@ -372,6 +364,12 @@ inline void solve_core(
);
pb_add_suffix_f(state, pb);
++pb_it;

if (early_exit_f(state)) {
if (!(pb_it != pb.end())) return;
pb_add_suffix_f(state, pb);
return;
}
// otherwise, put the state at the last fitted lambda (lmda_max)
} else {
update_invariance_f(state, state_gaussian_pin, large_lmda_path[i]);
Expand Down

0 comments on commit dee7706

Please sign in to comment.