Skip to content

Commit

Permalink
fixed reset
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Nov 10, 2023
1 parent 5aafba1 commit 461f204
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/polysolve/nonlinear/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ namespace polysolve::nonlinear
solver->add_strategy(std::make_unique<BFGS>(
solver_params, linear_solver_params,
characteristic_length, logger));
// add twice for the resetted history
solver->add_strategy(std::make_unique<BFGS>(
solver_params, linear_solver_params,
characteristic_length, logger));
}
else if (solver_name == "DenseNewton" || solver_name == "dense_newton")
{
Expand All @@ -79,9 +75,6 @@ namespace polysolve::nonlinear
{
solver->add_strategy(std::make_unique<LBFGS>(
solver_params, characteristic_length, logger));
// add twice for the resetted history
solver->add_strategy(std::make_unique<LBFGS>(
solver_params, characteristic_length, logger));
}
else if (solver_name == "GradientDescent" || solver_name == "gradient_descent")
{
Expand Down Expand Up @@ -324,7 +317,7 @@ namespace polysolve::nonlinear
if (m_descent_strategy != previous_strategy)
current_strategy_iter = 0;
// if we did enoug lower strategy, we revert back to normal
if (current_strategy_iter >= m_iter_per_strategy[m_descent_strategy])
if (m_descent_strategy != 0 && current_strategy_iter >= m_iter_per_strategy[m_descent_strategy])
{
m_descent_strategy = 0;
for (auto &s : m_strategies)
Expand Down
1 change: 1 addition & 0 deletions tests/test_nonlinear_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ void test_solvers(const std::vector<std::string> &solvers, const int iters, cons
TEST_CASE("non-linear", "[solver]")
{
test_solvers(Solver::available_solvers(), 1000, false);
// test_solvers({"L-BFGS"}, 1000, false);
}

TEST_CASE("non-linear-easier", "[solver]")
Expand Down

0 comments on commit 461f204

Please sign in to comment.