proxsuite-nlp  0.11.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
 
Loading...
Searching...
No Matches
linesearch-base.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <fmt/format.h>
7#include <ostream>
8
9namespace proxsuite {
10namespace nlp {
11enum class LinesearchStrategy { ARMIJO, WOLFE };
12enum class LSInterpolation { BISECTION, QUADRATIC, CUBIC };
13
16template <typename T> class Linesearch {
17public:
18 struct Options {
19 Options()
20 : armijo_c1(1e-4), wolfe_c2(0.9), dphi_thresh(1e-13), alpha_min(1e-6),
21 max_num_steps(20), interp_type(LSInterpolation::CUBIC),
22 contraction_min(0.5), contraction_max(0.8) {}
23 T armijo_c1;
24 T wolfe_c2;
25 T dphi_thresh;
26 T alpha_min;
27 std::size_t max_num_steps;
28 LSInterpolation interp_type;
29 T contraction_min;
30 T contraction_max;
31 friend std::ostream &operator<<(std::ostream &oss, const Options &self) {
32 oss << "{";
33 oss << fmt::format("armijo_c1 = {:.3e}", self.armijo_c1);
34 oss << ", "
35 << fmt::format("contraction_min = {:.3e}", self.contraction_min);
36 oss << ", "
37 << fmt::format("contraction_max = {:.3e}", self.contraction_max);
38 oss << "}";
39 return oss;
40 }
41 };
42 explicit Linesearch(const Linesearch::Options &options);
43 ~Linesearch();
44
45 struct FunctionSample {
46 T alpha;
47 T phi;
48 T dphi;
49 bool valid;
50 FunctionSample() : alpha(0.), phi(0.), dphi(0.), valid(false) {}
51 FunctionSample(T a, T v) : alpha(a), phi(v), dphi(0.), valid(true) {}
52 FunctionSample(T a, T v, T g) : alpha(a), phi(v), dphi(g), valid(true) {}
53 };
54
55 void setOptions(const Linesearch::Options &options) { options_ = options; }
56
57 void reset() {}
58
59 Linesearch::Options options_;
60};
61
62template <typename T>
63Linesearch<T>::Linesearch(const Linesearch::Options &options)
64 : options_(options) {}
65
66template <typename T> Linesearch<T>::~Linesearch() = default;
67
68} // namespace nlp
69} // namespace proxsuite
70
71#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
72#include "proxsuite-nlp/linesearch.txx"
73#endif
Main package namespace.
Definition bcl-params.hpp:5