PANOC-ALM main
Nonconvex constrained optimization
decl/alm.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <chrono>
8#include <string>
9
10namespace pa {
11
13struct ALMParams {
15 real_t ε = 1e-5;
17 real_t δ = 1e-5;
19 real_t Δ = 10;
39 real_t ρ = 1e-1;
44 real_t θ = 0.1;
46 real_t M = 1e9;
50 real_t Σ_min = 1e-9;
52 unsigned int max_iter = 100;
54 std::chrono::microseconds max_time = std::chrono::minutes(5);
55
62 unsigned max_num_retries = 20;
65 unsigned max_total_num_retries = 40;
66
69 unsigned print_interval = 0;
70
73 bool preconditioning = false;
76};
77
81template <class InnerSolverT = PANOCSolver<>>
82class ALMSolver {
83 public:
85 using InnerSolver = InnerSolverT;
86
87 struct Stats {
90 unsigned outer_iterations = 0;
92 std::chrono::microseconds elapsed_time;
110 unsigned penalty_reduced = 0;
124
128
132 };
133
135 : params(params),
136 inner_solver(std::forward<InnerSolver>(inner_solver)) {}
139
140 Stats operator()(const Problem &problem, rvec y, rvec x);
141
142 std::string get_name() const {
143 return "ALMSolver<" + inner_solver.get_name() + ">";
144 }
145
148 void stop() { inner_solver.stop(); }
149
150 const Params &get_params() const { return params; }
151
152 private:
154
155 public:
157};
158
159} // namespace pa
Augmented Lagrangian Method solver.
Definition: decl/alm.hpp:82
Params params
Definition: decl/alm.hpp:153
std::string get_name() const
Definition: decl/alm.hpp:142
unsigned penalty_reduced
The number of times that the penalty update factor ALMParams::Δ was reduced, that the tolerance updat...
Definition: decl/alm.hpp:110
ALMSolver(Params params, const InnerSolver &inner_solver)
Definition: decl/alm.hpp:137
real_t δ
Final dual tolerance or constraint violation that was reached:
Definition: decl/alm.hpp:121
Stats operator()(const Problem &problem, rvec y, rvec x)
Definition: alm.hpp:16
real_t norm_penalty
2-norm of the final penalty factors .
Definition: decl/alm.hpp:123
unsigned initial_penalty_reduced
The number of times that the initial penalty factor was reduced by ALMParams::Σ₀_lower and that the i...
Definition: decl/alm.hpp:100
InnerStatsAccumulator< typename InnerSolver::Stats > inner
The statistics of the inner solver invocations, accumulated over all ALM iterations.
Definition: decl/alm.hpp:131
unsigned inner_convergence_failures
The total number of times that the inner solver failed to converge.
Definition: decl/alm.hpp:112
void stop()
Abort the computation and return the result so far.
Definition: decl/alm.hpp:148
real_t ε
Final primal tolerance that was reached, depends on the stopping criterion used by the inner solver,...
Definition: decl/alm.hpp:116
const Params & get_params() const
Definition: decl/alm.hpp:150
unsigned outer_iterations
Total number of outer ALM iterations (i.e.
Definition: decl/alm.hpp:90
std::chrono::microseconds elapsed_time
Total elapsed time.
Definition: decl/alm.hpp:92
InnerSolverT InnerSolver
Definition: decl/alm.hpp:85
ALMSolver(Params params, InnerSolver &&inner_solver)
Definition: decl/alm.hpp:134
InnerSolver inner_solver
Definition: decl/alm.hpp:156
SolverStatus status
Whether the solver converged or not.
Definition: decl/alm.hpp:127
problem
Definition: main.py:16
Definition: alm.hpp:9
real_t Δ_lower
Factor to reduce ALMParams::Δ when inner convergence fails.
Definition: decl/alm.hpp:21
real_t Σ_min
Minimum penalty factor (used during initialization).
Definition: decl/alm.hpp:50
real_t ε₀_increase
Factor to increase the initial primal tolerance if convergence fails in the first iteration.
Definition: decl/alm.hpp:37
real_t θ
Error tolerance for penalty increase.
Definition: decl/alm.hpp:44
real_t ε₀
Initial primal tolerance.
Definition: decl/alm.hpp:34
unsigned max_total_num_retries
Combined limit for ALMParams::max_num_initial_retries and ALMParams::max_num_retries.
Definition: decl/alm.hpp:65
real_t Δ
Factor used in updating the penalty parameters.
Definition: decl/alm.hpp:19
real_t Σ₀_lower
Factor to reduce the initial penalty factor by if convergence fails in in the first iteration.
Definition: decl/alm.hpp:32
real_t δ
Dual tolerance.
Definition: decl/alm.hpp:17
constexpr real_t inf
Definition: vec.hpp:26
real_t σ₀
Initial penalty parameter factor.
Definition: decl/alm.hpp:29
real_t ρ
Update factor for primal tolerance.
Definition: decl/alm.hpp:39
unsigned int max_iter
Maximum number of outer ALM iterations.
Definition: decl/alm.hpp:52
SolverStatus
Exit status of a numerical solver such as ALM or PANOC.
Definition: solverstatus.hpp:7
@ Unknown
Initial value.
std::chrono::microseconds max_time
Maximum duration.
Definition: decl/alm.hpp:54
unsigned max_num_retries
How many times can the penalty update factor ALMParams::Δ and the primal tolerance factor ALMParams::...
Definition: decl/alm.hpp:62
real_t Σ₀
Initial penalty parameter.
Definition: decl/alm.hpp:26
real_t ε
Primal tolerance.
Definition: decl/alm.hpp:15
unsigned max_num_initial_retries
How many times can the initial penalty ALMParams::Σ₀ or ALMParams::σ₀ and the initial primal toleranc...
Definition: decl/alm.hpp:59
double real_t
Default floating point type.
Definition: vec.hpp:8
unsigned print_interval
When to print progress.
Definition: decl/alm.hpp:69
real_t ρ_increase
Factor to increase the primal tolerance update factor by if convergence fails.
Definition: decl/alm.hpp:42
bool preconditioning
Apply preconditioning to the problem, based on the gradients in the starting point.
Definition: decl/alm.hpp:73
bool single_penalty_factor
Use one penalty factor for all m constraints.
Definition: decl/alm.hpp:75
real_t Σ_max
Maximum penalty factor.
Definition: decl/alm.hpp:48
real_t M
Lagrange multiplier bound.
Definition: decl/alm.hpp:46
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Definition: vec.hpp:16
Parameters for the Augmented Lagrangian solver.
Definition: decl/alm.hpp:13
Problem description for minimization problems.