Skip to content

Commit

Permalink
Fix not descent direction failsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
zfergus committed Feb 8, 2024
1 parent 82038dd commit 144a355
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/polysolve/nonlinear/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,18 @@ namespace polysolve::nonlinear
if (m_descent_strategy >= m_strategies.size())
{
m_status = Status::NotDescentDirection;
log_and_throw_error(m_logger, "[{}][{}] direction is not a descent direction on last strategy (‖Δx‖={:g}; ‖g‖={:g}; Δx⋅g={:g}≥0); stopping",
current_name, m_line_search->name(),
delta_x.norm(), compute_grad_norm(x, grad), m_current.xDeltaDotGrad);
log_and_throw_error(

Check warning on line 347 in src/polysolve/nonlinear/Solver.cpp

View check run for this annotation

Codecov / codecov/patch

src/polysolve/nonlinear/Solver.cpp#L346-L347

Added lines #L346 - L347 were not covered by tests
m_logger, "[{}][{}] direction is not a descent direction on last strategy (‖Δx‖={:g}; ‖g‖={:g}; Δx⋅g={:g}≥0); stopping",
current_name, m_line_search->name(), delta_x.norm(), compute_grad_norm(x, grad), m_current.xDeltaDotGrad);

Check warning on line 349 in src/polysolve/nonlinear/Solver.cpp

View check run for this annotation

Codecov / codecov/patch

src/polysolve/nonlinear/Solver.cpp#L349

Added line #L349 was not covered by tests
}
else
{
m_status = Status::Continue;
m_logger.debug(
"[{}][{}] direction is not a descent direction (‖Δx‖={:g}; ‖g‖={:g}; Δx⋅g={:g}≥0); reverting to {}",
current_name, m_line_search->name(), delta_x.norm(), compute_grad_norm(x, grad), m_current.xDeltaDotGrad,
descent_strategy_name());
}

m_logger.debug(
"[{}][{}] direction is not a descent direction (‖Δx‖={:g}; ‖g‖={:g}; Δx⋅g={:g}≥0); reverting to {}",
current_name, m_line_search->name(),
delta_x.norm(), compute_grad_norm(x, grad), m_current.xDeltaDotGrad, descent_strategy_name());
m_status = Status::NotDescentDirection;
continue;
}

Expand Down

0 comments on commit 144a355

Please sign in to comment.