Skip to content

Conversation

@PatWie
Copy link
Owner

@PatWie PatWie commented Feb 28, 2025

All function will receive the position to evaluate and return an entire state (x, f(x), grad*, hessian*). This simplifies the interface, while template parameters take care of treating functions according to differentiability.

To support constrained problems, these are wrapped as an unconstrained one via penalty method and augmented Lagrangian, so they can be solved with any existing solver in this library.

It supports now:
min f(x)
s.t. c1(x) >= 0
c2(x) = 0

Several changes are made to L-BFGS for more robust numerical handling of edge-cases.

@PatWie PatWie force-pushed the constrained branch 2 times, most recently from 9542488 to 9aab5bf Compare February 28, 2025 19:23
All function will receive the position to evaluate and return an entire
state (x, f(x), grad*, hessian*). This simplifies the interface, while
template parameters take care of treating functions according to
differentiability.

To support constrained problems, these are wrapped as an unconstrained
one via penalty method and augmented Lagrangian, so they can be solved
with any existing solver in this library.

It supports now:
  min  f(x)
  s.t. c1(x) >= 0
       c2(x)  = 0

Several changes are made to L-BFGS for more robust numerical handling of
edge-cases.
#include <string>
#include <utility>

#include "function.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Include the directory when naming header files [build/include_subdir] [4]

penalty = typename cfunction_t::scalar_t(10);
}

ConstrainedState(const state_t &rhs) { CopyState(rhs); } // nolint

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Single-parameter constructors should be marked explicit. [runtime/explicit] [4]

vector_t search_direction = current.gradient;

constexpr scalar_t absolute_eps = 0.0001;
constexpr scalar_t eps = std::numeric_limits<scalar_t>::epsilon();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cpplint] reported by reviewdog 🐶
Add #include for numeric_limits<> [build/include_what_you_use] [4]

@PatWie PatWie closed this Feb 28, 2025
@PatWie PatWie deleted the constrained branch March 4, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants