|
PANOC-ALM
quadratic-penalty
Nonconvex constrained optimization
|
Go to the documentation of this file.
12 #include <pybind11/pybind11.h>
13 namespace py = pybind11;
15 template <
class T,
class A>
17 return [attr](T &
t,
const py::handle &h) {
t.*attr = h.cast<
A>(); };
19 template <
class T,
class A>
21 return [attr](
const T &
t) {
return py::cast(
t.*attr); };
31 std::function<void(T &,
const py::handle &)>
set;
32 std::function<py::object(
const T &)>
get;
43 const auto &
m = kwargs_to_struct_table<T>;
44 for (
auto &&[key, val] : kwargs) {
45 auto skey = key.template cast<std::string>();
46 auto it =
m.find(skey);
48 throw py::key_error(
"Unknown parameter " + skey);
49 it->second.set(
t, val);
55 const auto &
m = kwargs_to_struct_table<T>;
57 for (
auto &&[key, val] :
m) {
58 py::object o = val.get(
t);
59 if (py::hasattr(o,
"to_dict"))
60 o = o.attr(
"to_dict")();
61 d[key.c_str()] = std::move(o);
75 return struct_to_dict_helper<T>(
t);
82 kwargs_to_struct_table<pa::PANOCParams>{
92 {
"quadratic_upperbound_tolerance_factor",
94 {
"update_lipschitz_in_linesearch",
96 {
"alternative_linesearch_cond",
103 kwargs_to_struct_table<pa::LipschitzEstimateParams>{
114 kwargs_to_struct_table<pa::PGAParams>{
122 {
"quadratic_upperbound_tolerance_factor",
130 kwargs_to_struct_table<pa::GAAPGAParams>{
139 {
"quadratic_upperbound_tolerance_factor",
149 kwargs_to_struct_table<pa::StructuredPANOCLBFGSParams>{
156 {
"nonmonotone_linesearch",
161 {
"quadratic_upperbound_tolerance_factor",
162 &pa::StructuredPANOCLBFGSParams::
163 quadratic_upperbound_tolerance_factor},
164 {
"update_lipschitz_in_linesearch",
166 {
"alternative_linesearch_cond",
168 {
"hessian_vec_finited_differences",
170 {
"full_augmented_hessian",
179 kwargs_to_struct_table<pa::LBFGSParams>{
196 kwargs_to_struct_table<pa::ALMParams>{
unsigned limitedqr_mem
Length of the history to keep in the limited-memory QR algorithm.
real_t Σ_min
Minimum penalty factor (used during initialization).
real_t ε₀_increase
Factor to increase the initial primal tolerance if convergence fails in the first iteration.
void kwargs_to_struct_helper(T &t, const py::kwargs &kwargs)
real_t L_min
Minimum Lipschitz constant estimate.
bool hessian_vec_finited_differences
real_t θ
Error tolerance for penalty increase.
std::function< void(T &, const py::handle &)> set
unsigned int max_iter
Maximum number of outer ALM iterations.
attr_setter_fun_t(A T::*attr)
bool full_augmented_hessian
real_t L₀
Initial estimate of the Lipschitz constant of ∇ψ(x)
real_t nonmonotone_linesearch
Factor used in update for exponentially weighted nonmonotone line search.
unsigned print_interval
When to print progress.
real_t quadratic_upperbound_tolerance_factor
struct pa::LBFGSParams::@0 cbfgs
Parameters in the cautious BFGS update condition.
bool rescale_when_γ_changes
real_t τ_min
Minimum weight factor between Newton step and projected gradient step.
real_t L_max
Maximum Lipschitz constant estimate.
LBFGSStepSize lbfgs_stepsize
std::chrono::microseconds max_time
Maximum duration.
bool preconditioning
Apply preconditioning to the problem, based on the gradients in the starting point.
unsigned max_total_num_retries
Combined limit for ALMParams::max_num_initial_retries and ALMParams::max_num_retries.
real_t ε
Relative step size for initial finite difference Lipschitz estimate.
bool single_penalty_factor
Use one penalty factor for all m constraints.
real_t ρ_increase
Factor to increase the primal tolerance update factor by if convergence fails.
real_t Δ_lower
Factor to reduce ALMParams::Δ when inner convergence fails.
LipschitzEstimateParams Lipschitz
Parameters related to the Lipschitz constant estimate and step size.
real_t δ
Minimum step size for initial finite difference Lipschitz estimate.
unsigned max_num_retries
How many times can the penalty update factor ALMParams::Δ and the primal tolerance factor ALMParams::...
unsigned max_num_initial_retries
How many times can the initial penalty ALMParams::Σ₀ or ALMParams::σ₀ and the initial primal toleranc...
std::map< std::string, attr_setter_fun_t< T > > kwargs_to_struct_table_t
PANOCStopCrit stop_crit
What stopping criterion to use.
auto attr_getter(A T::*attr)
real_t Σ_max
Maximum penalty factor.
unsigned max_no_progress
Maximum number of iterations without any progress before giving up.
real_t ε₀
Initial primal tolerance.
unsigned memory
Length of the history to keep.
real_t ρ
Update factor for primal tolerance.
auto attr_setter(A T::*attr)
py::dict struct_to_dict_helper(const T &t)
real_t Lγ_factor
Factor that relates step size γ and Lipschitz constant.
T kwargs_to_struct(const py::kwargs &kwargs)
real_t M
Lagrange multiplier bound.
kwargs_to_struct_table_t< T > kwargs_to_struct_table
real_t Δ
Factor used in updating the penalty parameters.
real_t Σ₀
Initial penalty parameter.
unsigned max_iter
Maximum number of inner PANOC iterations.
real_t Σ₀_lower
Factor to reduce the initial penalty factor by if convergence fails in in the first iteration.
bool full_flush_on_γ_change
bool update_lipschitz_in_linesearch
bool alternative_linesearch_cond
std::function< py::object(const T &)> get
py::dict struct_to_dict(const T &t)
real_t σ₀
Initial penalty parameter factor.