Skip to content

Commit

Permalink
Improve ALM loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Aug 25, 2023
1 parent 0551cb7 commit 09fa5ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/alpaqa/include/alpaqa/implementation/outer/alm.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ALMSolver<InnerSolverT>::operator()(const Problem &p, rvec x, rvec y,
p.check();

if (params.max_iter == 0)
return {.status=SolverStatus::MaxIter};
return {.status = SolverStatus::MaxIter};

auto m = p.get_m();
if (m == 0) { // No general constraints, only box constraints
Expand Down Expand Up @@ -108,10 +108,13 @@ ALMSolver<InnerSolverT>::operator()(const Problem &p, rvec x, rvec y,
// Inner solver
// ------------

auto time_elapsed = std::chrono::steady_clock::now() - start_time;
auto time_elapsed = std::chrono::steady_clock::now() - start_time;
auto time_remaining = time_elapsed < params.max_time
? params.max_time - time_elapsed
: decltype(time_elapsed){0};
InnerSolveOptions<config_t> opts{
.always_overwrite_results = overwrite_results,
.max_time = params.max_time - time_elapsed,
.max_time = time_remaining,
.tolerance = ε,
.os = os,
.outer_iter = i,
Expand Down

0 comments on commit 09fa5ad

Please sign in to comment.