diff --git a/src/polysolve/nonlinear/MMA.hpp b/src/polysolve/nonlinear/MMA.hpp index bb96a11..019b2ac 100644 --- a/src/polysolve/nonlinear/MMA.hpp +++ b/src/polysolve/nonlinear/MMA.hpp @@ -28,6 +28,8 @@ namespace polysolve::nonlinear std::string descent_strategy_name(int descent_strategy) const override; void increase_descent_strategy() override; + bool is_direction_descent() override { return false; } + protected: std::shared_ptr mma; diff --git a/src/polysolve/nonlinear/Solver.cpp b/src/polysolve/nonlinear/Solver.cpp index 74e29b3..9de9deb 100644 --- a/src/polysolve/nonlinear/Solver.cpp +++ b/src/polysolve/nonlinear/Solver.cpp @@ -208,7 +208,7 @@ namespace polysolve::nonlinear continue; } - if (name() != "MMA" && grad_norm != 0 && delta_x.dot(grad) >= 0) + if (is_direction_descent() && grad_norm != 0 && delta_x.dot(grad) >= 0) { increase_descent_strategy(); m_logger.debug( diff --git a/src/polysolve/nonlinear/Solver.hpp b/src/polysolve/nonlinear/Solver.hpp index 831a87c..a9662ff 100644 --- a/src/polysolve/nonlinear/Solver.hpp +++ b/src/polysolve/nonlinear/Solver.hpp @@ -104,6 +104,8 @@ namespace polysolve::nonlinear virtual int default_descent_strategy() = 0; virtual void increase_descent_strategy() = 0; + virtual bool is_direction_descent() { return true; } + virtual std::string descent_strategy_name(int descent_strategy) const = 0; virtual std::string descent_strategy_name() const { return descent_strategy_name(descent_strategy); };