Skip to content

Commit

Permalink
added is_direction_descent
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Oct 4, 2023
1 parent e9d492c commit c09de43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/polysolve/nonlinear/MMA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MMAAux> mma;

Expand Down
2 changes: 1 addition & 1 deletion src/polysolve/nonlinear/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions src/polysolve/nonlinear/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); };

Expand Down

0 comments on commit c09de43

Please sign in to comment.