PANOC-ALM  quadratic-penalty
Nonconvex constrained optimization
panocpy.cpp
Go to the documentation of this file.
1 
6 #include <panoc-alm/decl/alm.hpp>
12 #include <panoc-alm/inner/pga.hpp>
16 
17 #if PANOCPY_HAVE_CASADI
19 #endif
20 
21 #include <pybind11/attr.h>
22 #include <pybind11/cast.h>
23 #include <pybind11/chrono.h>
24 #include <pybind11/detail/common.h>
25 #include <pybind11/eigen.h>
26 #include <pybind11/functional.h>
27 #include <pybind11/iostream.h>
28 #include <pybind11/pybind11.h>
29 #include <pybind11/pytypes.h>
30 #include <pybind11/stl.h>
31 
32 #include <memory>
33 #include <optional>
34 #include <stdexcept>
35 #include <string>
36 #include <tuple>
37 #include <type_traits>
38 #include <utility>
39 
40 #include "kwargs-to-struct.hpp"
43 #include "problem.hpp"
44 
45 namespace py = pybind11;
46 
47 template <class DirectionProviderT>
49  return [](const pa::PANOCParams &pp, const DirectionProviderT &dir) {
51  static_assert(std::is_base_of_v<Base, DirectionProviderT>);
52  auto full_python_copy = std::make_shared<py::object>(py::cast(dir));
53  auto base_copy = full_python_copy->template cast<Base *>();
54  return std::make_shared<pa::PolymorphicPANOCSolver>(
56  pp,
57  std::shared_ptr<Base>(full_python_copy, base_copy),
58  });
59  };
60 }
61 
62 template <class DirectionProviderT, class... DirectionArgumentsT>
64  return [](const pa::PANOCParams &pp, const DirectionArgumentsT &...args) {
66  static_assert(std::is_base_of_v<Base, DirectionProviderT>);
67  static_assert(std::is_constructible_v<DirectionProviderT,
68  DirectionArgumentsT...>);
69  DirectionProviderT dir{args...};
70  return PolymorphicPANOCConstructor<DirectionProviderT>()(pp, dir);
71  };
72 }
73 
74 template <class InnerSolverT>
76  return [](const pa::ALMParams &pp, const InnerSolverT &inner) {
77  using Base = pa::PolymorphicInnerSolverBase;
78  static_assert(std::is_base_of_v<Base, InnerSolverT>);
79  auto full_python_copy = std::make_shared<py::object>(py::cast(inner));
80  auto base_copy = full_python_copy->template cast<Base *>();
82  pp,
83  std::shared_ptr<Base>(full_python_copy, base_copy),
84  };
85  };
86 }
87 
88 template <class InnerSolverT>
90  return [](const InnerSolverT &inner) {
91  return PolymorphicALMConstructor<InnerSolverT>()(pa::ALMParams(),
92  inner);
93  };
94 }
95 
96 template <class InnerSolverT, class... InnerSolverArgumentsT>
98  return [](const pa::ALMParams &pp, const InnerSolverArgumentsT &...args) {
100  static_assert(std::is_base_of_v<Base, InnerSolverT>);
101  static_assert(
102  std::is_constructible_v<InnerSolverT, InnerSolverArgumentsT...>);
103  InnerSolverT inner{args...};
104  return PolymorphicALMConstructor<InnerSolverT>()(pp, inner);
105  };
106 }
107 
108 #define STRINGIFY(x) #x
109 #define MACRO_STRINGIFY(x) STRINGIFY(x)
110 
111 PYBIND11_MODULE(PANOCPY_MODULE_NAME, m) {
112  using py::operator""_a;
113 
114  py::options options;
115  options.enable_function_signatures();
116  options.enable_user_defined_docstrings();
117 
118  m.doc() = "PANOC+ALM solvers"; // TODO
119 
120 #ifdef VERSION_INFO
121  m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
122 #else
123  m.attr("__version__") = "dev";
124 #endif
125 
126  py::class_<pa::Box>(m, "Box", "C++ documentation: :cpp:class:`pa::Box`")
127  .def(py::init([](unsigned n) {
128  return pa::Box{pa::vec::Constant(n, pa::inf),
129  pa::vec::Constant(n, -pa::inf)};
130  }),
131  "n"_a,
132  "Create an :math:`n`-dimensional box at with bounds at "
133  ":math:`\\pm\\infty` (no constraints).")
134  .def(py::init([](pa::vec ub, pa::vec lb) {
135  if (ub.size() != lb.size())
136  throw std::invalid_argument(
137  "Upper bound and lower bound dimensions do not "
138  "match");
139  return pa::Box{std::move(ub), std::move(lb)};
140  }),
141  "ub"_a, "lb"_a, "Create a box with the given bounds.")
142  .def_readwrite("upperbound", &pa::Box::upperbound)
143  .def_readwrite("lowerbound", &pa::Box::lowerbound);
144 
145  py::class_<pa::Problem>(m, "Problem",
146  "C++ documentation: :cpp:class:`pa::Problem`")
147  // .def(py::init())
148  .def(py::init<unsigned, unsigned>(), "n"_a, "m"_a,
149  ":param n: Number of unknowns\n"
150  ":param m: Number of constraints")
151  .def_readwrite("n", &pa::Problem::n,
152  "Number of unknowns, dimension of :math:`x`")
153  .def_readwrite(
154  "m", &pa::Problem::m,
155  "Number of general constraints, dimension of :math:`g(x)`")
156  .def_readwrite("C", &pa::Problem::C, "Box constraints on :math:`x`")
157  .def_readwrite("D", &pa::Problem::D, "Box constraints on :math:`g(x)`")
158  .def_property("f", prob_getter_f(), prob_setter_f(),
159  "Objective funcion, :math:`f(x)`")
160  .def_property(
161  "grad_f", prob_getter_grad_f(), prob_setter_grad_f(),
162  "Gradient of the objective function, :math:`\\nabla f(x)`")
163  .def_property("g", prob_getter_g(), prob_setter_g(),
164  "Constraint function, :math:`g(x)`")
165  .def_property("grad_g_prod", prob_getter_grad_g_prod(),
167  "Gradient of constraint function times vector, "
168  ":math:`\\nabla g(x)\\, v`")
169  .def_property("grad_gi", prob_getter_grad_gi(), prob_setter_grad_gi(),
170  "Gradient vector of the :math:`i`-th component of the "
171  "constriant function, :math:`\\nabla g_i(x)`")
172  .def_property(
173  "hess_L", prob_getter_hess_L(), prob_setter_hess_L(),
174  "Hessian of the Lagrangian function, :math:`\\nabla^2_{xx} L(x,y)`")
175  .def_property("hess_L_prod", prob_getter_hess_L_prod(),
177  "Hessian of the Lagrangian function times vector, "
178  ":math:`\\nabla^2_{xx} L(x,y)\\, v`");
179 
180  py::class_<pa::ProblemWithParam, pa::Problem>(
181  m, "ProblemWithParam",
182  "C++ documentation: :cpp:class:`pa::ProblemWithParam`\n\n"
183  "See :py:class:`panocpy._panocpy.Problem` for the full documentation.")
184  .def(py::init<unsigned, unsigned>(), "n"_a, "m"_a)
185  .def_readwrite("n", &pa::Problem::n)
186  .def_readwrite("m", &pa::Problem::m)
187  .def_readwrite("C", &pa::Problem::C)
188  .def_readwrite("D", &pa::Problem::D)
189  .def_property("f", prob_getter_f(), prob_setter_f())
190  .def_property("grad_f", prob_getter_grad_f(), prob_setter_grad_f())
191  .def_property("g", prob_getter_g(), prob_setter_g())
192  .def_property("grad_g_prod", prob_getter_grad_g_prod(),
194  .def_property("grad_gi", prob_getter_grad_gi(), prob_setter_grad_gi())
195  .def_property("hess_L", prob_getter_hess_L(), prob_setter_hess_L())
196  .def_property("hess_L_prod", prob_getter_hess_L_prod(),
198  .def_property(
199  "param", py::overload_cast<>(&pa::ProblemWithParam::get_param),
200  py::overload_cast<pa::crvec>(&pa::ProblemWithParam::set_param),
201  "Parameter vector :math:`p` of the problem");
202 
203  py::class_<pa::ProblemFull>(
204  m, "ProblemFull", "C++ documentation: :cpp:class:`pa::ProblemFull`")
205  // .def(py::init())
206  .def(py::init<unsigned, unsigned, unsigned>(), "n"_a, "m1"_a, "m2"_a,
207  ":param n: Number of unknowns\n"
208  ":param m1: Number of ALM constraints\n"
209  ":param m2: Number of quadratic penalty constraints")
210  .def_readwrite("n", &pa::ProblemFull::n,
211  "Number of unknowns, dimension of :math:`x`")
212  .def_readwrite(
213  "m1", &pa::ProblemFull::m1,
214  "Number of general constraints, dimension of :math:`g1(x)`")
215  .def_readwrite(
216  "m2", &pa::ProblemFull::m2,
217  "Number of general constraints, dimension of :math:`g2(x)`")
218  .def_readwrite("C", &pa::ProblemFull::C, "Box constraints on :math:`x`")
219  .def_readwrite("D1", &pa::ProblemFull::D1,
220  "Box constraints on :math:`g1(x)`")
221  .def_readwrite("D2", &pa::ProblemFull::D2,
222  "Box constraints on :math:`g2(x)`")
223  .def_property("f", prob_full_getter_f(), prob_full_setter_f(),
224  "Objective funcion, :math:`f(x)`")
225  .def_property(
227  "Gradient of the objective function, :math:`\\nabla f(x)`")
228  .def_property("g1", prob_full_getter_g1(), prob_full_setter_g1(),
229  "Constraint function, :math:`g1(x)`")
230  .def_property("grad_g1_prod", prob_full_getter_grad_g1_prod(),
232  "Gradient of constraint function times vector, "
233  ":math:`\\nabla g1(x)\\, v`")
234  .def_property("grad_g1i", prob_full_getter_grad_g1i(),
236  "Gradient vector of the :math:`i`-th component of the "
237  "constraint function, :math:`\\nabla g1_i(x)`")
238  .def_property("g2", prob_full_getter_g2(), prob_full_setter_g2(),
239  "Constraint function, :math:`g2(x)`")
240  .def_property("grad_g2_prod", prob_full_getter_grad_g2_prod(),
242  "Gradient of constraint function times vector, "
243  ":math:`\\nabla g2(x)\\, v`")
244  .def_property("grad_g2i", prob_full_getter_grad_g2i(),
246  "Gradient vector of the :math:`i`-th component of the "
247  "constraint function, :math:`\\nabla g2_i(x)`")
248  .def_property(
250  "Hessian of the Lagrangian function, :math:`\\nabla^2_{xx} L(x,y)`")
251  .def_property("hess_L_prod", prob_full_getter_hess_L_prod(),
253  "Hessian of the Lagrangian function times vector, "
254  ":math:`\\nabla^2_{xx} L(x,y)\\, v`");
255 
256  py::class_<pa::ProblemFullWithParam, pa::ProblemFull>(
257  m, "ProblemFullWithParam",
258  "C++ documentation: :cpp:class:`pa::ProblemFullWithParam`")
259  // .def(py::init())
260  .def(py::init<unsigned, unsigned, unsigned>(), "n"_a, "m1"_a, "m2"_a,
261  ":param n: Number of unknowns\n"
262  ":param m1: Number of ALM constraints\n"
263  ":param m2: Number of quadratic penalty constraints")
264  .def_readwrite("n", &pa::ProblemFullWithParam::n,
265  "Number of unknowns, dimension of :math:`x`")
266  .def_readwrite(
268  "Number of general constraints, dimension of :math:`g1(x)`")
269  .def_readwrite(
271  "Number of general constraints, dimension of :math:`g2(x)`")
272  .def_readwrite("C", &pa::ProblemFullWithParam::C,
273  "Box constraints on :math:`x`")
274  .def_readwrite("D1", &pa::ProblemFullWithParam::D1,
275  "Box constraints on :math:`g1(x)`")
276  .def_readwrite("D2", &pa::ProblemFullWithParam::D2,
277  "Box constraints on :math:`g2(x)`")
278  .def_property("f", prob_full_getter_f(), prob_full_setter_f(),
279  "Objective funcion, :math:`f(x)`")
280  .def_property(
282  "Gradient of the objective function, :math:`\\nabla f(x)`")
283  .def_property("g1", prob_full_getter_g1(), prob_full_setter_g1(),
284  "Constraint function, :math:`g1(x)`")
285  .def_property("grad_g1_prod", prob_full_getter_grad_g1_prod(),
287  "Gradient of constraint function times vector, "
288  ":math:`\\nabla g1(x)\\, v`")
289  .def_property("grad_g1i", prob_full_getter_grad_g1i(),
291  "Gradient vector of the :math:`i`-th component of the "
292  "constraint function, :math:`\\nabla g1_i(x)`")
293  .def_property("g2", prob_full_getter_g2(), prob_full_setter_g2(),
294  "Constraint function, :math:`g2(x)`")
295  .def_property("grad_g2_prod", prob_full_getter_grad_g2_prod(),
297  "Gradient of constraint function times vector, "
298  ":math:`\\nabla g2(x)\\, v`")
299  .def_property("grad_g2i", prob_full_getter_grad_g2i(),
301  "Gradient vector of the :math:`i`-th component of the "
302  "constraint function, :math:`\\nabla g2_i(x)`")
303  .def_property(
305  "Hessian of the Lagrangian function, :math:`\\nabla^2_{xx} L(x,y)`")
306  .def_property("hess_L_prod", prob_full_getter_hess_L_prod(),
308  "Hessian of the Lagrangian function times vector, "
309  ":math:`\\nabla^2_{xx} L(x,y)\\, v`")
310  .def_property(
311  "param", py::overload_cast<>(&pa::ProblemFullWithParam::get_param),
312  py::overload_cast<pa::crvec>(&pa::ProblemFullWithParam::set_param),
313  "Parameter vector :math:`p` of the problem");
314 
316  std::shared_ptr<pa::PolymorphicPANOCDirectionBase>,
318  m, "PANOCDirection",
319  "Class that provides fast directions for the PANOC algorithm (e.g. "
320  "L-BFGS)")
321  .def(py::init<>())
329 
331  std::shared_ptr<pa::PolymorphicLBFGSDirection>,
333  m, "LBFGSDirection",
334  "C++ documentation: :cpp:class:`pa::LBFGSDirection`")
335  .def(py::init<pa::LBFGSParams>(), "params"_a)
336  .def("initialize", &pa::PolymorphicLBFGSDirection::initialize)
339  .def("changed_γ", &pa::PolymorphicLBFGSDirection::changed_γ)
341  .def("get_name", &pa::PolymorphicLBFGSDirection::get_name)
343  .def_property_readonly("params",
345 
346  using paLBFGSParamCBFGS = decltype(pa::LBFGSParams::cbfgs);
347  py::class_<paLBFGSParamCBFGS>(
348  m, "LBFGSParamsCBFGS",
349  "C++ documentation: :cpp:member:`pa::LBFGSParams::cbfgs`")
350  .def(py::init())
351  .def(py::init(&kwargs_to_struct<paLBFGSParamCBFGS>))
352  .def("to_dict", &struct_to_dict<paLBFGSParamCBFGS>)
353  .def_readwrite("α", &paLBFGSParamCBFGS::α)
354  .def_readwrite("ϵ", &paLBFGSParamCBFGS::ϵ);
355 
356  py::class_<pa::LBFGSParams>(
357  m, "LBFGSParams", "C++ documentation: :cpp:class:`pa::LBFGSParams`")
358  .def(py::init())
359  .def(py::init(&kwargs_to_struct<pa::LBFGSParams>))
360  .def("to_dict", &struct_to_dict<pa::LBFGSParams>)
361  .def_readwrite("memory", &pa::LBFGSParams::memory)
362  .def_readwrite("cbfgs", &pa::LBFGSParams::cbfgs)
363  .def_readwrite("rescale_when_γ_changes",
365 
366  py::enum_<pa::LBFGSStepSize>(
367  m, "LBFGSStepsize", "C++ documentation: :cpp:enum:`pa::LBFGSStepSize`")
368  .value("BasedOnGradientStepSize",
369  pa::LBFGSStepSize::BasedOnGradientStepSize)
370  .value("BasedOnCurvature", pa::LBFGSStepSize::BasedOnCurvature)
371  .export_values();
372 
373  py::class_<pa::LipschitzEstimateParams>(
374  m, "LipschitzEstimateParams",
375  "C++ documentation: :cpp:class:`pa::LipschitzEstimateParams`")
376  .def(py::init())
377  .def(py::init(&kwargs_to_struct<pa::LipschitzEstimateParams>))
378  .def("to_dict", &struct_to_dict<pa::LipschitzEstimateParams>)
379  .def_readwrite("L_0", &pa::LipschitzEstimateParams::L₀)
380  .def_readwrite("ε", &pa::LipschitzEstimateParams::ε)
381  .def_readwrite("δ", &pa::LipschitzEstimateParams::δ)
382  .def_readwrite("Lγ_factor", &pa::LipschitzEstimateParams::Lγ_factor);
383 
384  py::class_<pa::PANOCParams>(
385  m, "PANOCParams", "C++ documentation: :cpp:class:`pa::PANOCParams`")
386  .def(py::init())
387  .def(py::init(&kwargs_to_struct<pa::PANOCParams>))
388  .def("to_dict", &struct_to_dict<pa::PANOCParams>)
389  .def_readwrite("Lipschitz", &pa::PANOCParams::Lipschitz)
390  .def_readwrite("max_iter", &pa::PANOCParams::max_iter)
391  .def_readwrite("max_time", &pa::PANOCParams::max_time)
392  .def_readwrite("τ_min", &pa::PANOCParams::τ_min)
393  .def_readwrite("L_min", &pa::PANOCParams::L_min)
394  .def_readwrite("L_max", &pa::PANOCParams::L_max)
395  .def_readwrite("max_no_progress", &pa::PANOCParams::max_no_progress)
396  .def_readwrite("print_interval", &pa::PANOCParams::print_interval)
397  .def_readwrite("quadratic_upperbound_tolerance_factor",
399  .def_readwrite("update_lipschitz_in_linesearch",
401  .def_readwrite("alternative_linesearch_cond",
403  .def_readwrite("lbfgs_stepsize", &pa::PANOCParams::lbfgs_stepsize);
404 
405  py::enum_<pa::SolverStatus>(
406  m, "SolverStatus", py::arithmetic(),
407  "C++ documentation: :cpp:enum:`pa::SolverStatus`")
408  .value("Unknown", pa::SolverStatus::Unknown, "Initial value")
409  .value("Converged", pa::SolverStatus::Converged,
410  "Converged and reached given tolerance")
411  .value("MaxTime", pa::SolverStatus::MaxTime,
412  "Maximum allowed execution time exceeded")
413  .value("MaxIter", pa::SolverStatus::MaxIter,
414  "Maximum number of iterations exceeded")
415  .value("NotFinite", pa::SolverStatus::NotFinite,
416  "Intermediate results were infinite or not-a-number")
417  .value("NoProgress", pa::SolverStatus::NoProgress,
418  "No progress was made in the last iteration")
419  .value("Interrupted", pa::SolverStatus::Interrupted,
420  "Solver was interrupted by the user")
421  .export_values();
422 
423  py::class_<pa::PolymorphicInnerSolverBase::Stats>(m, "InnerSolverStats")
425 
427  std::shared_ptr<pa::PolymorphicInnerSolverBase>,
428  pa::PolymorphicInnerSolverTrampoline>(m, "InnerSolver")
429  .def(py::init<>())
430  .def("__call__", &pa::PolymorphicInnerSolverBase::operator())
433  .def("get_params", &pa::PolymorphicInnerSolverBase::get_params);
434 
435  py::class_<pa::PGAParams>(m, "PGAParams",
436  "C++ documentation: :cpp:class:`pa::PGAParams`")
437  .def(py::init())
438  .def(py::init(&kwargs_to_struct<pa::PGAParams>))
439  .def("to_dict", &struct_to_dict<pa::PGAParams>)
440  .def_readwrite("Lipschitz", &pa::PGAParams::Lipschitz)
441  .def_readwrite("max_iter", &pa::PGAParams::max_iter)
442  .def_readwrite("max_time", &pa::PGAParams::max_time)
443  .def_readwrite("L_min", &pa::PGAParams::L_min)
444  .def_readwrite("L_max", &pa::PGAParams::L_max)
445  .def_readwrite("stop_crit", &pa::PGAParams::stop_crit)
446  .def_readwrite("print_interval", &pa::PGAParams::print_interval)
447  .def_readwrite("quadratic_upperbound_tolerance_factor",
449 
450  py::class_<pa::PGAProgressInfo>(
451  m, "PGAProgressInfo",
452  "C++ documentation: :cpp:class:`pa::PGAProgressInfo`")
453  .def_readonly("k", &pa::PGAProgressInfo::k)
454  .def_readonly("x", &pa::PGAProgressInfo::x)
455  .def_readonly("p", &pa::PGAProgressInfo::p)
456  .def_readonly("norm_sq_p", &pa::PGAProgressInfo::norm_sq_p)
457  .def_readonly("x_hat", &pa::PGAProgressInfo::x_hat)
458  .def_readonly("ψ", &pa::PGAProgressInfo::ψ)
459  .def_readonly("grad_ψ", &pa::PGAProgressInfo::grad_ψ)
460  .def_readonly("ψ_hat", &pa::PGAProgressInfo::ψ_hat)
461  .def_readonly("grad_ψ_hat", &pa::PGAProgressInfo::grad_ψ_hat)
462  .def_readonly("L", &pa::PGAProgressInfo::L)
463  .def_readonly("γ", &pa::PGAProgressInfo::γ)
464  .def_readonly("ε", &pa::PGAProgressInfo::ε)
465  .def_readonly("Σ", &pa::PGAProgressInfo::Σ)
466  .def_readonly("y", &pa::PGAProgressInfo::y)
467  .def_property_readonly("fpr", [](const pa::PGAProgressInfo &p) {
468  return std::sqrt(p.norm_sq_p) / p.γ;
469  });
470 
471  py::class_<pa::GAAPGAParams>(
472  m, "GAAPGAParams", "C++ documentation: :cpp:class:`pa::GAAPGAParams`")
473  .def(py::init())
474  .def(py::init(&kwargs_to_struct<pa::GAAPGAParams>))
475  .def("to_dict", &struct_to_dict<pa::GAAPGAParams>)
476  .def_readwrite("Lipschitz", &pa::GAAPGAParams::Lipschitz)
477  .def_readwrite("limitedqr_mem", &pa::GAAPGAParams::limitedqr_mem)
478  .def_readwrite("max_iter", &pa::GAAPGAParams::max_iter)
479  .def_readwrite("max_time", &pa::GAAPGAParams::max_time)
480  .def_readwrite("L_min", &pa::GAAPGAParams::L_min)
481  .def_readwrite("L_max", &pa::GAAPGAParams::L_max)
482  .def_readwrite("stop_crit", &pa::GAAPGAParams::stop_crit)
483  .def_readwrite("print_interval", &pa::GAAPGAParams::print_interval)
484  .def_readwrite("quadratic_upperbound_tolerance_factor",
486  .def_readwrite("max_no_progress", &pa::GAAPGAParams::max_no_progress)
487  .def_readwrite("full_flush_on_γ_change",
489 
490  py::class_<pa::GAAPGAProgressInfo>(
491  m, "GAAPGAProgressInfo",
492  "C++ documentation: :cpp:class:`pa::GAAPGAProgressInfo`")
493  .def_readonly("k", &pa::GAAPGAProgressInfo::k)
494  .def_readonly("x", &pa::GAAPGAProgressInfo::x)
495  .def_readonly("p", &pa::GAAPGAProgressInfo::p)
496  .def_readonly("norm_sq_p", &pa::GAAPGAProgressInfo::norm_sq_p)
497  .def_readonly("x_hat", &pa::GAAPGAProgressInfo::x_hat)
498  .def_readonly("ψ", &pa::GAAPGAProgressInfo::ψ)
499  .def_readonly("grad_ψ", &pa::GAAPGAProgressInfo::grad_ψ)
500  .def_readonly("ψ_hat", &pa::GAAPGAProgressInfo::ψ_hat)
501  .def_readonly("grad_ψ_hat", &pa::GAAPGAProgressInfo::grad_ψ_hat)
502  .def_readonly("L", &pa::GAAPGAProgressInfo::L)
503  .def_readonly("γ", &pa::GAAPGAProgressInfo::γ)
504  .def_readonly("ε", &pa::GAAPGAProgressInfo::ε)
505  .def_readonly("Σ", &pa::GAAPGAProgressInfo::Σ)
506  .def_readonly("y", &pa::GAAPGAProgressInfo::y)
507  .def_property_readonly("fpr", [](const pa::GAAPGAProgressInfo &p) {
508  return std::sqrt(p.norm_sq_p) / p.γ;
509  });
510 
511  py::class_<pa::PANOCProgressInfo>(
512  m, "PANOCProgressInfo",
513  "Data passed to the PANOC progress callback.\n\n"
514  "C++ documentation: :cpp:class:`pa::PANOCProgressInfo`")
515  .def_readonly("k", &pa::PANOCProgressInfo::k, //
516  "Iteration")
517  .def_readonly("x", &pa::PANOCProgressInfo::x, //
518  "Decision variable :math:`x`")
519  .def_readonly("p", &pa::PANOCProgressInfo::p, //
520  "Projected gradient step :math:`p`")
521  .def_readonly("norm_sq_p", &pa::PANOCProgressInfo::norm_sq_p, //
522  ":math:`\\left\\|p\\right\\|^2`")
523  .def_readonly(
524  "x_hat", &pa::PANOCProgressInfo::x_hat, //
525  "Decision variable after projected gradient step :math:`\\hat x`")
526  .def_readonly("φγ", &pa::PANOCProgressInfo::φγ, //
527  "Forward-backward envelope :math:`\\varphi_\\gamma(x)`")
528  .def_readonly("ψ", &pa::PANOCProgressInfo::ψ, //
529  "Objective value :math:`\\psi(x)`")
530  .def_readonly("grad_ψ", &pa::PANOCProgressInfo::grad_ψ, //
531  "Gradient of objective :math:`\\nabla\\psi(x)`")
532  .def_readonly("ψ_hat", &pa::PANOCProgressInfo::ψ_hat)
533  .def_readonly("grad_ψ_hat", &pa::PANOCProgressInfo::grad_ψ_hat)
534  .def_readonly("L", &pa::PANOCProgressInfo::L, //
535  "Estimate of Lipschitz constant of objective :math:`L`")
536  .def_readonly("γ", &pa::PANOCProgressInfo::γ,
537  "Step size :math:`\\gamma`")
538  .def_readonly("τ", &pa::PANOCProgressInfo::τ, //
539  "Line search parameter :math:`\\tau`")
540  .def_readonly("ε", &pa::PANOCProgressInfo::ε, //
541  "Tolerance reached :math:`\\varepsilon_k`")
542  .def_readonly("Σ", &pa::PANOCProgressInfo::Σ, //
543  "Penalty factor :math:`\\Sigma`")
544  .def_readonly("y", &pa::PANOCProgressInfo::y, //
545  "Lagrange multipliers :math:`y`")
546  .def_property_readonly(
547  "fpr",
548  [](const pa::PANOCProgressInfo &p) {
549  return std::sqrt(p.norm_sq_p) / p.γ;
550  },
551  "Fixed-point residual :math:`\\left\\|p\\right\\| / \\gamma`");
552 
553  py::class_<pa::StructuredPANOCLBFGSProgressInfo>(
554  m, "StructuredPANOCLBFGSProgressInfo",
555  "Data passed to the structured PANOC progress callback.\n\n"
556  "C++ documentation: :cpp:class:`pa::StructuredPANOCLBFGSProgressInfo`")
557  .def_readonly("k", &pa::StructuredPANOCLBFGSProgressInfo::k)
558  .def_readonly("x", &pa::StructuredPANOCLBFGSProgressInfo::x)
559  .def_readonly("p", &pa::StructuredPANOCLBFGSProgressInfo::p)
560  .def_readonly("norm_sq_p",
562  .def_readonly("x_hat", &pa::StructuredPANOCLBFGSProgressInfo::x_hat)
563  .def_readonly("φγ", &pa::StructuredPANOCLBFGSProgressInfo::φγ)
564  .def_readonly("ψ", &pa::StructuredPANOCLBFGSProgressInfo::ψ)
565  .def_readonly("grad_ψ", &pa::StructuredPANOCLBFGSProgressInfo::grad_ψ)
566  .def_readonly("ψ_hat", &pa::StructuredPANOCLBFGSProgressInfo::ψ_hat)
567  .def_readonly("grad_ψ_hat",
569  .def_readonly("L", &pa::StructuredPANOCLBFGSProgressInfo::L)
570  .def_readonly("γ", &pa::StructuredPANOCLBFGSProgressInfo::γ)
571  .def_readonly("τ", &pa::StructuredPANOCLBFGSProgressInfo::τ)
572  .def_readonly("ε", &pa::StructuredPANOCLBFGSProgressInfo::ε)
573  .def_readonly("Σ", &pa::StructuredPANOCLBFGSProgressInfo::Σ)
574  .def_readonly("y", &pa::StructuredPANOCLBFGSProgressInfo::y)
575  .def_property_readonly(
576  "fpr", [](const pa::StructuredPANOCLBFGSProgressInfo &p) {
577  return std::sqrt(p.norm_sq_p) / p.γ;
578  });
579 
580  py::class_<pa::PolymorphicPANOCSolver,
581  std::shared_ptr<pa::PolymorphicPANOCSolver>,
583  m, "PANOCSolver", "C++ documentation: :cpp:class:`pa::PANOCSolver`")
584  .def(py::init([] {
585  return std::make_shared<pa::PolymorphicPANOCSolver>(
587  pa::PANOCParams{},
588  std::static_pointer_cast<pa::PolymorphicPANOCDirectionBase>(
589  std::make_shared<pa::PolymorphicLBFGSDirection>(
590  pa::LBFGSParams{}))});
591  }))
592  .def(py::init(PolymorphicPANOCConstructor< //
594  "panoc_params"_a, "lbfgs_direction"_a)
595  .def(py::init(PolymorphicPANOCConversion< //
597  "panoc_params"_a, "lbfgs_params"_a)
598  .def(py::init(PolymorphicPANOCConstructor< //
600  "panoc_params"_a, "direction"_a)
601  .def(
602  "set_progress_callback",
604  "Attach a callback that is called on each iteration of the solver.")
605  .def("__call__",
606  pa::InnerSolverCallWrapper<pa::PolymorphicPANOCSolver>(),
607  py::call_guard<py::scoped_ostream_redirect,
608  py::scoped_estream_redirect>(),
609  "problem"_a, "Σ"_a, "ε"_a, "x"_a,
610  "y"_a, //
611  "Solve.\n\n"
612  ":param problem: Problem to solve\n"
613  ":param Σ: Penalty factor\n"
614  ":param ε: Desired tolerance\n"
615  ":param x: Initial guess\n"
616  ":param y: Initial Lagrange multipliers\n\n"
617  ":return: * Solution :math:`x`\n"
618  " * Updated Lagrange multipliers :math:`y`\n"
619  " * Slack variable error :math:`g(x) - z`\n"
620  " * Statistics\n\n")
621  .def("__str__", &pa::PolymorphicPANOCSolver::get_name)
622  .def_property_readonly("params",
624  .def_property_readonly(
625  "direction", [](const pa::PolymorphicPANOCSolver &s) {
626  return s.innersolver.direction_provider.direction;
627  });
628 
629  using PANOCFullLBFGS = pa::PANOCSolverFull<pa::LBFGS>;
630  py::class_<PANOCFullLBFGS>(
631  m, "PANOCSolverFull",
632  "C++ documentation: :cpp:class:`pa::PANOCSolverFull`")
633  .def(py::init([](pa::PANOCParams p, pa::LBFGSParams lp) {
634  return PANOCFullLBFGS(p, lp);
635  }))
636  .def(
637  "set_progress_callback", &PANOCFullLBFGS::set_progress_callback,
638  "callback"_a,
639  "Attach a callback that is called on each iteration of the solver.")
640  .def("__call__", pa::InnerSolverFullCallWrapper<PANOCFullLBFGS>(),
641  py::call_guard<py::scoped_ostream_redirect,
642  py::scoped_estream_redirect>(),
643  "problem"_a, "Σ1"_a, "Σ2"_a, "ε"_a, "x"_a,
644  "y"_a, //
645  "Solve.\n\n"
646  ":param problem: Problem to solve\n"
647  ":param Σ1: Penalty factor\n"
648  ":param Σ2: Penalty factor\n"
649  ":param ε: Desired tolerance\n"
650  ":param x: Initial guess\n"
651  ":param y: Initial Lagrange multipliers\n\n"
652  ":return: * Solution :math:`x`\n"
653  " * Updated Lagrange multipliers :math:`y`\n"
654  " * Slack variable error :math:`g1(x) - z`\n"
655  " * Slack variable error :math:`g2(x) - z`\n"
656  " * Statistics\n\n")
657  .def("__str__", &PANOCFullLBFGS::get_name)
658  .def_property_readonly("params", &PANOCFullLBFGS::get_params)
659  .def_property_readonly("direction", [](const PANOCFullLBFGS &s) {
660  return s.direction_provider;
661  });
662 
663  py::class_<pa::PolymorphicPGASolver,
664  std::shared_ptr<pa::PolymorphicPGASolver>,
666  m, "PGASolver", "C++ documentation: :cpp:class:`pa::PGASolver`")
667  .def(py::init<pa::PGAParams>())
668  .def(
669  "set_progress_callback",
671  "Attach a callback that is called on each iteration of the solver.")
672  .def("__call__", pa::InnerSolverCallWrapper<pa::PolymorphicPGASolver>(),
673  py::call_guard<py::scoped_ostream_redirect,
674  py::scoped_estream_redirect>(),
675  "problem"_a, "Σ"_a, "ε"_a, "x"_a,
676  "y"_a, //
677  "Solve.\n\n"
678  ":param problem: Problem to solve\n"
679  ":param Σ: Penalty factor\n"
680  ":param ε: Desired tolerance\n"
681  ":param x: Initial guess\n"
682  ":param y: Initial Lagrange multipliers\n\n"
683  ":return: * Solution :math:`x`\n"
684  " * Updated Lagrange multipliers :math:`y`\n"
685  " * Slack variable error :math:`g(x) - z`\n"
686  " * Statistics\n\n")
687  .def("__str__", &pa::PolymorphicPGASolver::get_name)
688  .def_property_readonly("params", &pa::PolymorphicPGASolver::get_params);
689 
690  py::class_<pa::PolymorphicGAAPGASolver,
691  std::shared_ptr<pa::PolymorphicGAAPGASolver>,
693  m, "GAAPGASolver", "C++ documentation: :cpp:class:`pa::GAAPGASolver`")
694  .def(py::init<pa::GAAPGAParams>())
695  .def(
696  "set_progress_callback",
698  "Attach a callback that is called on each iteration of the solver.")
699  .def("__call__",
700  pa::InnerSolverCallWrapper<pa::PolymorphicGAAPGASolver>(),
701  py::call_guard<py::scoped_ostream_redirect,
702  py::scoped_estream_redirect>(),
703  "problem"_a, "Σ"_a, "ε"_a, "x"_a,
704  "y"_a, //
705  "Solve.\n\n"
706  ":param problem: Problem to solve\n"
707  ":param Σ: Penalty factor\n"
708  ":param ε: Desired tolerance\n"
709  ":param x: Initial guess\n"
710  ":param y: Initial Lagrange multipliers\n\n"
711  ":return: * Solution :math:`x`\n"
712  " * Updated Lagrange multipliers :math:`y`\n"
713  " * Slack variable error :math:`g(x) - z`\n"
714  " * Statistics\n\n")
715  .def("__str__", &pa::PolymorphicGAAPGASolver::get_name)
716  .def_property_readonly("params",
718 
719  py::enum_<pa::PANOCStopCrit>(
720  m, "PANOCStopCrit", "C++ documentation: :cpp:enum:`pa::PANOCStopCrit`")
721  .value("ApproxKKT", pa::PANOCStopCrit::ApproxKKT)
722  .value("ProjGradNorm", pa::PANOCStopCrit::ProjGradNorm)
723  .value("ProjGradUnitNorm", pa::PANOCStopCrit::ProjGradUnitNorm)
724  .value("FPRNorm", pa::PANOCStopCrit::FPRNorm)
725  .export_values();
726 
727  py::class_<pa::StructuredPANOCLBFGSParams>(
728  m, "StructuredPANOCLBFGSParams",
729  "C++ documentation: :cpp:class:`pa::StructuredPANOCLBFGSParams`")
730  .def(py::init(&kwargs_to_struct<pa::StructuredPANOCLBFGSParams>))
731  .def("to_dict", &struct_to_dict<pa::StructuredPANOCLBFGSParams>)
732 
733  .def_readwrite("Lipschitz", &pa::StructuredPANOCLBFGSParams::Lipschitz)
734  .def_readwrite("max_iter", &pa::StructuredPANOCLBFGSParams::max_iter)
735  .def_readwrite("max_time", &pa::StructuredPANOCLBFGSParams::max_time)
736  .def_readwrite("τ_min", &pa::StructuredPANOCLBFGSParams::τ_min)
737  .def_readwrite("L_min", &pa::StructuredPANOCLBFGSParams::L_min)
738  .def_readwrite("L_max", &pa::StructuredPANOCLBFGSParams::L_max)
739  .def_readwrite("nonmonotone_linesearch",
741  .def_readwrite("stop_crit", &pa::StructuredPANOCLBFGSParams::stop_crit)
742  .def_readwrite("max_no_progress",
744  .def_readwrite("print_interval",
746  .def_readwrite("quadratic_upperbound_tolerance_factor",
748  quadratic_upperbound_tolerance_factor)
749  .def_readwrite(
750  "update_lipschitz_in_linesearch",
752  .def_readwrite(
753  "alternative_linesearch_cond",
755  .def_readwrite(
756  "hessian_vec_finited_differences",
758  .def_readwrite("full_augmented_hessian",
760  .def_readwrite("lbfgs_stepsize",
762 
764  std::shared_ptr<pa::PolymorphicStructuredPANOCLBFGSSolver>,
766  m, "StructuredPANOCLBFGSSolver",
767  "C++ documentation: :cpp:class:`pa::StructuredPANOCLBFGSSolver`")
768  .def(py::init([] {
769  return std::make_shared<pa::PolymorphicStructuredPANOCLBFGSSolver>(
772  pa::LBFGSParams{},
773  });
774  }))
775  .def(py::init<pa::StructuredPANOCLBFGSParams, pa::LBFGSParams>(),
776  "panoc_params"_a, "lbfgs_params"_a)
777  .def(
778  "set_progress_callback",
780  "callback"_a,
781  "Attach a callback that is called on each iteration of the solver.")
782  .def("__call__",
785  py::call_guard<py::scoped_ostream_redirect,
786  py::scoped_estream_redirect>(),
787  "problem"_a, "Σ"_a, "ε"_a, "x"_a,
788  "y"_a, //
789  "Solve.\n\n"
790  ":param problem: Problem to solve\n"
791  ":param Σ: Penalty factor\n"
792  ":param ε: Desired tolerance\n"
793  ":param x: Initial guess\n"
794  ":param y: Initial Lagrange multipliers\n\n"
795  ":return: * Solution :math:`x`\n"
796  " * Updated Lagrange multipliers :math:`y`\n"
797  " * Slack variable error :math:`g(x) - z`\n"
798  " * Statistics\n\n")
800  .def_property_readonly(
802 
803  py::class_<pa::ALMParams>(m, "ALMParams",
804  "C++ documentation: :cpp:class:`pa::ALMParams`")
805  .def(py::init())
806  .def(py::init(&kwargs_to_struct<pa::ALMParams>))
807  .def("to_dict", &struct_to_dict<pa::ALMParams>)
808  .def_readwrite("ε", &pa::ALMParams::ε)
809  .def_readwrite("δ", &pa::ALMParams::δ)
810  .def_readwrite("Δ", &pa::ALMParams::Δ)
811  .def_readwrite("Δ_lower", &pa::ALMParams::Δ_lower)
812  .def_readwrite("Σ_0", &pa::ALMParams::Σ₀)
813  .def_readwrite("σ_0", &pa::ALMParams::σ₀)
814  .def_readwrite("Σ_0_lower", &pa::ALMParams::Σ₀_lower)
815  .def_readwrite("ε_0", &pa::ALMParams::ε₀)
816  .def_readwrite("ε_0_increase", &pa::ALMParams::ε₀_increase)
817  .def_readwrite("ρ", &pa::ALMParams::ρ)
818  .def_readwrite("ρ_increase", &pa::ALMParams::ρ_increase)
819  .def_readwrite("θ", &pa::ALMParams::θ)
820  .def_readwrite("M", &pa::ALMParams::M)
821  .def_readwrite("Σ_max", &pa::ALMParams::Σ_max)
822  .def_readwrite("Σ_min", &pa::ALMParams::Σ_min)
823  .def_readwrite("max_iter", &pa::ALMParams::max_iter)
824  .def_readwrite("max_time", &pa::ALMParams::max_time)
825  .def_readwrite("max_num_initial_retries",
827  .def_readwrite("max_num_retries", &pa::ALMParams::max_num_retries)
828  .def_readwrite("max_total_num_retries",
830  .def_readwrite("print_interval", &pa::ALMParams::print_interval)
831  .def_readwrite("preconditioning", &pa::ALMParams::preconditioning)
832  .def_readwrite("single_penalty_factor",
834 
835  py::class_<pa::PolymorphicALMSolver>(
836  m, "ALMSolver",
837  "Main augmented Lagrangian solver.\n\n"
838  "C++ documentation: :cpp:class:`pa::ALMSolver`")
839  // Default constructor
840  .def(py::init([] {
842  pa::ALMParams{},
843  std::static_pointer_cast<pa::PolymorphicInnerSolverBase>(
844  std::make_shared<
847  pa::LBFGSParams{})),
848  };
849  }),
850  "Build an ALM solver using Structured PANOC as inner solver.")
851  // Params and solver
852  .def(py::init(PolymorphicALMConstructor<pa::PolymorphicPANOCSolver>()),
853  "alm_params"_a, "panoc_solver"_a,
854  "Build an ALM solver using PANOC as inner solver.")
855  .def(py::init(PolymorphicALMConstructor<pa::PolymorphicPGASolver>()),
856  "alm_params"_a, "pga_solver"_a,
857  "Build an ALM solver using the projected gradient algorithm as "
858  "inner solver.")
859  .def(py::init(PolymorphicALMConstructor<
861  "alm_params"_a, "structuredpanoc_solver"_a,
862  "Build an ALM solver using Structured PANOC as inner solver.")
863  .def(py::init(PolymorphicALMConstructor<
865  "alm_params"_a, "inner_solver"_a,
866  "Build an ALM solver using a custom inner solver.")
867  // Only solver (default params)
870  "panoc_solver"_a,
871  "Build an ALM solver using PANOC as inner solver.")
874  "pga_solver"_a,
875  "Build an ALM solver using the projected gradient algorithm as "
876  "inner solver.")
879  "structuredpanoc_solver"_a,
880  "Build an ALM solver using Structured PANOC as inner solver.")
883  "inner_solver"_a,
884  "Build an ALM solver using a custom inner solver.")
885  // Only params (default solver)
886  .def(py::init([](const pa::ALMParams &params) {
888  params,
889  std::static_pointer_cast<pa::PolymorphicInnerSolverBase>(
890  std::make_shared<
893  pa::LBFGSParams{})),
894  };
895  }),
896  "alm_params"_a,
897  "Build an ALM solver using Structured PANOC as inner solver.")
898  // Other functions and properties
899  .def_property_readonly("inner_solver",
900  [](const pa::PolymorphicALMSolver &s) {
901  return s.inner_solver.solver;
902  })
903  .def(
904  "__call__",
906  std::optional<pa::vec> x, std::optional<pa::vec> y)
907  -> std::tuple<pa::vec, pa::vec, py::dict> {
908  if (!x)
909  x = pa::vec::Zero(p.n);
910  else if (x->size() != p.n)
911  throw std::invalid_argument(
912  "Length of x does not match problem size problem.n");
913  if (!y)
914  y = pa::vec::Zero(p.m);
915  else if (y->size() != p.m)
916  throw std::invalid_argument(
917  "Length of y does not match problem size problem.m");
918 
919  auto stats = solver(p, *y, *x);
920  return std::make_tuple(std::move(*x), std::move(*y),
922  },
923  "problem"_a, "x"_a = std::nullopt, "y"_a = std::nullopt,
924  py::call_guard<py::scoped_ostream_redirect,
925  py::scoped_estream_redirect>(),
926  "Solve.\n\n"
927  ":param problem: Problem to solve.\n"
928  ":param y: Initial guess for Lagrange multipliers :math:`y`\n"
929  ":param x: Initial guess for decision variables :math:`x`\n\n"
930  ":return: * Lagrange multipliers :math:`y` at the solution\n"
931  " * Solution :math:`x`\n"
932  " * Statistics\n\n")
933  .def("__str__", &pa::PolymorphicALMSolver::get_name)
934  .def_property_readonly("params", &pa::PolymorphicALMSolver::get_params);
935 
937  py::class_<ALMFull>(m, "ALMSolverFull",
938  "Main augmented Lagrangian solver.\n\n"
939  "C++ documentation: :cpp:class:`pa::ALMSolverFull`")
940  // Default constructor
941  .def(py::init([](pa::ALMParams params, PANOCFullLBFGS &inner_solver) {
942  return ALMFull(params, inner_solver);
943  }),
944  "Build an ALM solver using Structured PANOC as inner solver.")
945  .def(
946  "__call__",
947  [](ALMFull &solver, const pa::ProblemFull &p,
948  std::optional<pa::vec> x, std::optional<pa::vec> y)
949  -> std::tuple<pa::vec, pa::vec, py::dict> {
950  if (!x)
951  x = pa::vec::Zero(p.n);
952  else if (x->size() != p.n)
953  throw std::invalid_argument(
954  "Length of x does not match problem size problem.n");
955  if (!y)
956  y = pa::vec::Zero(p.m1);
957  else if (y->size() != p.m1)
958  throw std::invalid_argument(
959  "Length of y does not match problem size problem.m");
960 
961  auto stats = solver(p, *y, *x);
962  return std::make_tuple(
963  std::move(*x), std::move(*y),
964  pa::stats_to_dict<ALMFull::InnerSolver>(stats));
965  },
966  "problem"_a, "x"_a = std::nullopt, "y"_a = std::nullopt,
967  py::call_guard<py::scoped_ostream_redirect,
968  py::scoped_estream_redirect>(),
969  "Solve.\n\n"
970  ":param problem: Problem to solve.\n"
971  ":param y: Initial guess for Lagrange multipliers :math:`y`\n"
972  ":param x: Initial guess for decision variables :math:`x`\n\n"
973  ":return: * Lagrange multipliers :math:`y` at the solution\n"
974  " * Solution :math:`x`\n"
975  " * Statistics\n\n")
976  .def("__str__", &ALMFull::get_name)
977  .def_property_readonly("params", &ALMFull::get_params);
978 
979  constexpr auto panoc = [](std::function<pa::real_t(pa::crvec)> ψ,
980  std::function<pa::vec(pa::crvec)> grad_ψ,
981  const pa::Box &C, std::optional<pa::vec> x0,
983  const pa::LBFGSParams &lbfgs_params) {
984  auto n = C.lowerbound.size();
985  if (C.upperbound.size() != n)
986  throw std::invalid_argument("Length of C.upperbound does not "
987  "match length of C.lowerbound");
988  if (!x0)
989  x0 = pa::vec::Zero(n);
990  else if (x0->size() != n)
991  throw std::invalid_argument(
992  "Length of x does not match problem size problem.n");
993  auto grad_ψ_ = [&](pa::crvec x, pa::rvec gr) {
994  auto &&t = grad_ψ(x);
995  if (t.size() != x.size())
996  throw std::runtime_error("Invalid grad_ψ dimension");
997  gr = std::move(t);
998  };
999  auto stats =
1000  pa::panoc<pa::LBFGS>(ψ, grad_ψ_, C, *x0, ε, params, {lbfgs_params});
1001  return std::make_tuple(std::move(*x0), stats_to_dict(stats));
1002  };
1003 
1004  m.def("panoc", panoc, "ψ"_a, "grad_ψ"_a, "C"_a, "x0"_a = std::nullopt,
1005  "ε"_a = 1e-8, "params"_a = pa::PANOCParams{},
1006  "lbfgs_params"_a = pa::LBFGSParams{});
1007 
1008 #if !PANOCPY_HAVE_CASADI
1009  auto load_CasADi_problem = [](const char *, unsigned, unsigned,
1010  bool) -> pa::Problem {
1011  throw std::runtime_error(
1012  "This version of panocpy was compiled without CasADi support");
1013  };
1014  auto load_CasADi_problem_with_param = [](const char *, unsigned, unsigned,
1015  bool) -> pa::ProblemWithParam {
1016  throw std::runtime_error(
1017  "This version of panocpy was compiled without CasADi support");
1018  };
1019  auto load_CasADi_problem_full = [](const char *, unsigned, unsigned, unsigned,
1020  bool) -> pa::ProblemFull {
1021  throw std::runtime_error(
1022  "This version of panocpy was compiled without CasADi support");
1023  };
1024  auto load_CasADi_problem_full_with_param = [](const char *, unsigned, unsigned, unsigned,
1025  bool) -> pa::ProblemFullWithParam {
1026  throw std::runtime_error(
1027  "This version of panocpy was compiled without CasADi support");
1028  };
1029 #else
1034 #endif
1035 
1036  m.def("load_casadi_problem", load_CasADi_problem, "so_name"_a, "n"_a, "m"_a,
1037  "second_order"_a = false,
1038  "Load a compiled CasADi problem without parameters.\n\n"
1039  "C++ documentation: :cpp:func:`pa::load_CasADi_problem`");
1040  m.def("load_casadi_problem_with_param", load_CasADi_problem_with_param,
1041  "so_name"_a, "n"_a, "m"_a, "second_order"_a = false,
1042  "Load a compiled CasADi problem with parameters.\n\n"
1043  "C++ documentation: :cpp:func:`pa::load_CasADi_problem_with_param`");
1044 
1045  m.def("load_casadi_problem_full", load_CasADi_problem_full, "so_name"_a,
1046  "n"_a, "m1"_a, "m2"_a, "second_order"_a = false,
1047  "Load a compiled CasADi problem without parameters.\n\n"
1048  "C++ documentation: :cpp:func:`pa::load_CasADi_problem`");
1049  m.def("load_casadi_problem_full_with_param",
1050  load_CasADi_problem_full_with_param, "so_name"_a, "n"_a, "m1"_a,
1051  "m2"_a, "second_order"_a = false,
1052  "Load a compiled CasADi problem with parameters.\n\n"
1053  "C++ documentation: :cpp:func:`pa::load_CasADi_problem_with_param`");
1054 }
prob_setter_grad_gi
auto prob_setter_grad_gi()
Definition: panocpy/problem.hpp:114
pa::PolymorphicInnerSolverBase
Definition: polymorphic-inner-solver.hpp:63
pa::GAAPGAParams::limitedqr_mem
unsigned limitedqr_mem
Length of the history to keep in the limited-memory QR algorithm.
Definition: guarded-aa-pga.hpp:23
pa::ALMParams::Σ_min
real_t Σ_min
Minimum penalty factor (used during initialization).
Definition: decl/alm.hpp:50
pa::PolymorphicInnerSolver::get_params
py::object get_params() const override
Definition: polymorphic-inner-solver.hpp:367
bicycle-obstacle-avoidance-mpc.t
t
Definition: bicycle-obstacle-avoidance-mpc.py:109
pa::PolymorphicInnerSolverBase::stop
virtual void stop()=0
pa::ProblemFull::D2
Box D2
Quadratic penalty constraints, .
Definition: include/panoc-alm/util/problem.hpp:219
prob_getter_g
auto prob_getter_g()
Definition: panocpy/problem.hpp:43
pa::ALMParams::ε₀_increase
real_t ε₀_increase
Factor to increase the initial primal tolerance if convergence fails in the first iteration.
Definition: decl/alm.hpp:37
pa::PGAProgressInfo::p
crvec p
Definition: pga.hpp:43
problem.hpp
pa::Problem::n
unsigned int n
Number of decision variables, dimension of x.
Definition: include/panoc-alm/util/problem.hpp:25
pa::PGAProgressInfo::k
unsigned k
Definition: pga.hpp:41
pa::PolymorphicPANOCDirectionTrampoline
Definition: polymorphic-panoc-direction.hpp:33
panocpy.test.stats
stats
Definition: test.py:76
pga.hpp
pa::PANOCParams::L_min
real_t L_min
Minimum Lipschitz constant estimate.
Definition: inner/decl/panoc.hpp:30
pa::SolverStatus::Unknown
@ Unknown
Initial value.
pa::rvec
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Definition: vec.hpp:16
pa::StructuredPANOCLBFGSParams::hessian_vec_finited_differences
bool hessian_vec_finited_differences
Definition: decl/structured-panoc-lbfgs.hpp:51
pa::PGAProgressInfo::norm_sq_p
real_t norm_sq_p
Definition: pga.hpp:44
pa::ALMParams::θ
real_t θ
Error tolerance for penalty increase.
Definition: decl/alm.hpp:44
prob_full_setter_hess_L_prod
auto prob_full_setter_hess_L_prod()
Definition: panocpy/problem.hpp:461
pa::PGAProgressInfo::grad_ψ_hat
crvec grad_ψ_hat
Definition: pga.hpp:49
pa::PolymorphicPANOCDirectionBase
Definition: polymorphic-panoc-direction.hpp:14
polymorphic-panoc-direction.hpp
lbfgs.hpp
pa::StructuredPANOCLBFGSParams
Tuning parameters for the second order PANOC algorithm.
Definition: decl/structured-panoc-lbfgs.hpp:20
panoc.hpp
pa::PolymorphicInnerSolver::get_name
std::string get_name() const override
Definition: polymorphic-inner-solver.hpp:366
panocpy.test.y
y
Definition: test.py:76
pa::Problem::D
Box D
Other constraints, .
Definition: include/panoc-alm/util/problem.hpp:28
pa::ProblemWithParam::get_param
pa::vec & get_param()
Definition: include/panoc-alm/util/problem.hpp:129
pa::PolymorphicPANOCDirectionBase::changed_γ
virtual void changed_γ(real_t γₖ, real_t old_γₖ)=0
pa::PolymorphicPANOCDirection
Definition: polymorphic-panoc-direction.hpp:92
pa::ALMParams::max_iter
unsigned int max_iter
Maximum number of outer ALM iterations.
Definition: decl/alm.hpp:52
pa::PolymorphicPANOCDirection::update
bool update(crvec xₖ, crvec xₖ₊₁, crvec pₖ, crvec pₖ₊₁, crvec grad_new, const Box &C, real_t γ_new) override
Definition: polymorphic-panoc-direction.hpp:105
panocpy.test.ε
int ε
Definition: test.py:71
pa::ProblemWithParam
Definition: include/panoc-alm/util/problem.hpp:124
prob_setter_g
auto prob_setter_g()
Definition: panocpy/problem.hpp:55
pa::ProblemFull::D1
Box D1
ALM constraints, .
Definition: include/panoc-alm/util/problem.hpp:218
pa::PGAProgressInfo::x
crvec x
Definition: pga.hpp:42
panoc.hpp
pa::ALMSolver::get_params
const Params & get_params() const
Definition: decl/alm.hpp:118
prob_full_setter_f
auto prob_full_setter_f()
Definition: panocpy/problem.hpp:209
guarded-aa-pga.hpp
alm.hpp
pa::PANOCSolverFull
Definition: inner/decl/panoc.hpp:155
pa::vec
realvec vec
Default type for vectors.
Definition: vec.hpp:14
prob_full_getter_hess_L_prod
auto prob_full_getter_hess_L_prod()
Definition: panocpy/problem.hpp:441
pa::LBFGSStepSize::BasedOnGradientStepSize
@ BasedOnGradientStepSize
PolymorphicALMConstructor
auto PolymorphicALMConstructor()
Definition: panocpy.cpp:75
pa::StructuredPANOCLBFGSParams::full_augmented_hessian
bool full_augmented_hessian
Definition: decl/structured-panoc-lbfgs.hpp:52
pa::PGAProgressInfo::ψ
real_t ψ
Definition: pga.hpp:46
CasADiLoader.hpp
pa::LipschitzEstimateParams::L₀
real_t L₀
Initial estimate of the Lipschitz constant of ∇ψ(x)
Definition: lipschitz.hpp:9
pa::PolymorphicPANOCSolver
PolymorphicInnerSolver< PANOCSolver< PolymorphicPANOCDirectionBase > > PolymorphicPANOCSolver
Definition: polymorphic-inner-solver.hpp:471
pa::PANOCProgressInfo::φγ
real_t φγ
Definition: inner/decl/panoc.hpp:70
pa::StructuredPANOCLBFGSParams::nonmonotone_linesearch
real_t nonmonotone_linesearch
Factor used in update for exponentially weighted nonmonotone line search.
Definition: decl/structured-panoc-lbfgs.hpp:35
pa::PANOCParams::print_interval
unsigned print_interval
When to print progress.
Definition: inner/decl/panoc.hpp:40
pa::PANOCParams::quadratic_upperbound_tolerance_factor
real_t quadratic_upperbound_tolerance_factor
Definition: inner/decl/panoc.hpp:42
pa::LBFGSParams::cbfgs
struct pa::LBFGSParams::@0 cbfgs
Parameters in the cautious BFGS update condition.
pa::StructuredPANOCLBFGSSolver
Second order PANOC solver for ALM.
Definition: decl/structured-panoc-lbfgs.hpp:80
pa::PolymorphicPANOCDirection::initialize
void initialize(crvec x₀, crvec x̂₀, crvec p₀, crvec grad₀) override
Definition: polymorphic-panoc-direction.hpp:102
pa::InnerSolverCallWrapper
auto InnerSolverCallWrapper()
Definition: polymorphic-inner-solver.hpp:20
pa::panoc
PANOCStats panoc(ObjFunT &ψ, ObjGradFunT &grad_ψ, const Box &C, rvec x, real_t ε, const PANOCParams &params, PANOCDirection< DirectionProviderT > direction, vec_allocator &alloc)
Definition: standalone/panoc.hpp:370
prob_full_setter_g2
auto prob_full_setter_g2()
Definition: panocpy/problem.hpp:334
pa::load_CasADi_problem_with_param
pa::ProblemWithParam load_CasADi_problem_with_param(const std::string &filename, unsigned n, unsigned m, bool second_order=false)
Load a problem generated by CasADi (with parameters).
Definition: CasADiLoader.cpp:107
pa::PGAProgressInfo::x_hat
crvec x_hat
Definition: pga.hpp:45
pa::ALMSolver::get_name
std::string get_name() const
Definition: decl/alm.hpp:110
pa::ALMSolver::inner_solver
InnerSolver inner_solver
Definition: decl/alm.hpp:124
pa::ALMSolver
Augmented Lagrangian Method solver.
Definition: decl/alm.hpp:82
pa::PGAProgressInfo::Σ
crvec Σ
Definition: pga.hpp:53
pa::Problem::m
unsigned int m
Number of constraints, dimension of g(x) and z.
Definition: include/panoc-alm/util/problem.hpp:26
structured-panoc-lbfgs.hpp
pa::LBFGSParams::rescale_when_γ_changes
bool rescale_when_γ_changes
Definition: decl/lbfgs.hpp:24
pa::ALMSolverFull
Definition: decl/alm.hpp:128
prob_full_getter_grad_g2i
auto prob_full_getter_grad_g2i()
Definition: panocpy/problem.hpp:377
pa::PANOCParams::τ_min
real_t τ_min
Minimum weight factor between Newton step and projected gradient step.
Definition: inner/decl/panoc.hpp:28
pa::PANOCParams
Tuning parameters for the PANOC algorithm.
Definition: inner/decl/panoc.hpp:20
pa::PANOCParams::L_max
real_t L_max
Maximum Lipschitz constant estimate.
Definition: inner/decl/panoc.hpp:32
panocpy.test.x
x
Definition: test.py:40
pa::PGAProgressInfo::L
real_t L
Definition: pga.hpp:50
pa::PANOCParams::lbfgs_stepsize
LBFGSStepSize lbfgs_stepsize
Definition: inner/decl/panoc.hpp:48
prob_full_setter_g1
auto prob_full_setter_g1()
Definition: panocpy/problem.hpp:249
pa::Box::lowerbound
vec lowerbound
Definition: box.hpp:9
pa::PolymorphicLBFGSDirection
PolymorphicPANOCDirection< LBFGS > PolymorphicLBFGSDirection
Definition: polymorphic-panoc-direction.hpp:128
pa::PolymorphicPANOCDirection::get_params
py::object get_params() const override
Definition: polymorphic-panoc-direction.hpp:120
pa::PolymorphicPGASolver
PolymorphicInnerSolver< PGASolver > PolymorphicPGASolver
Definition: polymorphic-inner-solver.hpp:468
pa::ProblemFull::m2
unsigned int m2
Number of quadratic penalty constraints, dimension of g2(x) and z2.
Definition: include/panoc-alm/util/problem.hpp:216
pa::PolymorphicInnerSolverBase::get_name
virtual std::string get_name() const =0
pa::ProblemWithParam::set_param
void set_param(pa::crvec p)
Definition: include/panoc-alm/util/problem.hpp:127
prob_setter_f
auto prob_setter_f()
Definition: panocpy/problem.hpp:15
panoc-stop-crit.hpp
pa::PolymorphicInnerSolverBase::get_params
virtual py::object get_params() const =0
PolymorphicPANOCConversion
auto PolymorphicPANOCConversion()
Definition: panocpy.cpp:63
pa::ALMParams
Parameters for the Augmented Lagrangian solver.
Definition: decl/alm.hpp:13
pa::Box
Definition: box.hpp:7
prob_setter_hess_L
auto prob_setter_hess_L()
Definition: panocpy/problem.hpp:144
pa::inf
constexpr real_t inf
Definition: vec.hpp:26
pa::PGAProgressInfo::γ
real_t γ
Definition: pga.hpp:51
pa::PolymorphicPANOCDirectionBase::update
virtual bool update(crvec xₖ, crvec xₖ₊₁, crvec pₖ, crvec pₖ₊₁, crvec grad_new, const Box &C, real_t γ_new)=0
PolymorphicPANOCConstructor
auto PolymorphicPANOCConstructor()
Definition: panocpy.cpp:48
prob_full_getter_grad_g1i
auto prob_full_getter_grad_g1i()
Definition: panocpy/problem.hpp:292
pa::PANOCParams::max_time
std::chrono::microseconds max_time
Maximum duration.
Definition: inner/decl/panoc.hpp:26
prob_full_getter_grad_g1_prod
auto prob_full_getter_grad_g1_prod()
Definition: panocpy/problem.hpp:261
prob_full_getter_g2
auto prob_full_getter_g2()
Definition: panocpy/problem.hpp:322
polymorphic-inner-solver.hpp
pa::ALMParams::preconditioning
bool preconditioning
Apply preconditioning to the problem, based on the gradients in the starting point.
Definition: decl/alm.hpp:73
pa::ALMParams::max_total_num_retries
unsigned max_total_num_retries
Combined limit for ALMParams::max_num_initial_retries and ALMParams::max_num_retries.
Definition: decl/alm.hpp:65
pa::PolymorphicGAAPGASolver
PolymorphicInnerSolver< GAAPGASolver > PolymorphicGAAPGASolver
Definition: polymorphic-inner-solver.hpp:469
pa::LipschitzEstimateParams::ε
real_t ε
Relative step size for initial finite difference Lipschitz estimate.
Definition: lipschitz.hpp:11
pa::ALMParams::single_penalty_factor
bool single_penalty_factor
Use one penalty factor for all m constraints.
Definition: decl/alm.hpp:75
panocpy.test.x0
x0
Definition: test.py:68
pa::PANOCProgressInfo::τ
real_t τ
Definition: inner/decl/panoc.hpp:77
pa::ALMParams::ρ_increase
real_t ρ_increase
Factor to increase the primal tolerance update factor by if convergence fails.
Definition: decl/alm.hpp:42
prob_full_getter_grad_f
auto prob_full_getter_grad_f()
Definition: panocpy/problem.hpp:213
prob_full_setter_grad_g1i
auto prob_full_setter_grad_g1i()
Definition: panocpy/problem.hpp:308
pa::PolymorphicInnerSolver::innersolver
InnerSolver innersolver
Definition: polymorphic-inner-solver.hpp:376
prob_full_getter_grad_g2_prod
auto prob_full_getter_grad_g2_prod()
Definition: panocpy/problem.hpp:346
pa::ALMParams::Δ_lower
real_t Δ_lower
Factor to reduce ALMParams::Δ when inner convergence fails.
Definition: decl/alm.hpp:21
prob_getter_grad_g_prod
auto prob_getter_grad_g_prod()
Definition: panocpy/problem.hpp:67
prob_getter_grad_f
auto prob_getter_grad_f()
Definition: panocpy/problem.hpp:19
pa::crvec
Eigen::Ref< const vec > crvec
Default type for immutable references to vectors.
Definition: vec.hpp:18
pa::PGAProgressInfo::ψ_hat
real_t ψ_hat
Definition: pga.hpp:48
pa::PolymorphicStructuredPANOCLBFGSSolver
PolymorphicInnerSolver< StructuredPANOCLBFGSSolver > PolymorphicStructuredPANOCLBFGSSolver
Definition: polymorphic-inner-solver.hpp:475
panocpy.test.params
params
Definition: test.py:217
pa::StructuredPANOCLBFGSProgressInfo
Definition: decl/structured-panoc-lbfgs.hpp:57
pa::ProblemFull::m1
unsigned int m1
Number of ALM constraints, dimension of g1(x) and z1.
Definition: include/panoc-alm/util/problem.hpp:215
pa::ProblemFull::n
unsigned int n
Number of decision variables, dimension of x.
Definition: include/panoc-alm/util/problem.hpp:214
prob_full_getter_f
auto prob_full_getter_f()
Definition: panocpy/problem.hpp:199
pa::LBFGSParams
Parameters for the LBFGS and SpecializedLBFGS classes.
Definition: decl/lbfgs.hpp:12
panoc.hpp
pa::PANOCSolver
PANOC solver for ALM.
Definition: inner/decl/panoc.hpp:88
panocpy.test.α
α
Definition: test.py:31
prob_full_setter_grad_g2_prod
auto prob_full_setter_grad_g2_prod()
Definition: panocpy/problem.hpp:363
pa::PANOCParams::Lipschitz
LipschitzEstimateParams Lipschitz
Parameters related to the Lipschitz constant estimate and step size.
Definition: inner/decl/panoc.hpp:22
pa::LipschitzEstimateParams::δ
real_t δ
Minimum step size for initial finite difference Lipschitz estimate.
Definition: lipschitz.hpp:13
prob_full_setter_hess_L
auto prob_full_setter_hess_L()
Definition: panocpy/problem.hpp:423
prob_getter_hess_L_prod
auto prob_getter_hess_L_prod()
Definition: panocpy/problem.hpp:162
pa::stats_to_dict
py::dict stats_to_dict(const PANOCStats &s)
Definition: polymorphic-inner-solver.hpp:205
pa::ALMParams::max_num_retries
unsigned max_num_retries
How many times can the penalty update factor ALMParams::Δ and the primal tolerance factor ALMParams::...
Definition: decl/alm.hpp:62
pa::PGAProgressInfo::grad_ψ
crvec grad_ψ
Definition: pga.hpp:47
pa::PolymorphicPANOCDirectionBase::reset
virtual void reset()=0
pa::ALMParams::max_num_initial_retries
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
pa::PolymorphicPANOCDirection::get_name
std::string get_name() const override
Definition: polymorphic-panoc-direction.hpp:117
pa::load_CasADi_problem_full_with_param
pa::ProblemFullWithParam load_CasADi_problem_full_with_param(const char *filename, unsigned n, unsigned m1, unsigned m2, bool second_order=false)
Load a problem generated by CasADi (with parameters).
Definition: CasADiLoader.cpp:220
panocpy.test.C
C
Definition: test.py:204
pa::PolymorphicPANOCDirectionBase::initialize
virtual void initialize(crvec x₀, crvec x̂₀, crvec p₀, crvec grad₀)=0
MACRO_STRINGIFY
#define MACRO_STRINGIFY(x)
Definition: panocpy.cpp:109
PolymorphicALMConversion
auto PolymorphicALMConversion()
Definition: panocpy.cpp:97
prob_full_getter_g1
auto prob_full_getter_g1()
Definition: panocpy/problem.hpp:237
pa::PolymorphicPANOCDirectionBase::apply_ret
vec apply_ret(crvec xₖ, crvec x̂ₖ, crvec pₖ, real_t γ)
Definition: polymorphic-panoc-direction.hpp:24
panocpy.test.solver
solver
Definition: test.py:8
pa::ProblemFull::C
Box C
Constraints of the decision variables, .
Definition: include/panoc-alm/util/problem.hpp:217
prob_full_getter_hess_L
auto prob_full_getter_hess_L()
Definition: panocpy/problem.hpp:407
panocpy.test.m
int m
Definition: test.py:39
pa::PGAParams::stop_crit
PANOCStopCrit stop_crit
What stop criterion to use.
Definition: pga.hpp:30
prob_full_setter_grad_g2i
auto prob_full_setter_grad_g2i()
Definition: panocpy/problem.hpp:393
pa::PolymorphicInnerSolverBase::Stats::from_dict
static Stats from_dict(py::dict d)
Definition: polymorphic-inner-solver.hpp:71
prob_getter_f
auto prob_getter_f()
Definition: panocpy/problem.hpp:5
pa::PolymorphicPANOCDirection::reset
void reset() override
Definition: polymorphic-panoc-direction.hpp:116
kwargs-to-struct.hpp
This file defines mappings from Python dicts (kwargs) to simple parameter structs.
pa::ProblemFullWithParam
Definition: include/panoc-alm/util/problem.hpp:358
prob_setter_grad_g_prod
auto prob_setter_grad_g_prod()
Definition: panocpy/problem.hpp:84
pa::Box::upperbound
vec upperbound
Definition: box.hpp:8
pa::ALMParams::Σ_max
real_t Σ_max
Maximum penalty factor.
Definition: decl/alm.hpp:48
pa::PGAProgressInfo
Definition: pga.hpp:40
pa::PANOCProgressInfo
Definition: inner/decl/panoc.hpp:64
pa::PANOCParams::max_no_progress
unsigned max_no_progress
Maximum number of iterations without any progress before giving up.
Definition: inner/decl/panoc.hpp:36
pa::PGAProgressInfo::y
crvec y
Definition: pga.hpp:54
pa::GAAPGAProgressInfo
Definition: guarded-aa-pga.hpp:48
pa::ALMParams::ε₀
real_t ε₀
Initial primal tolerance.
Definition: decl/alm.hpp:34
pa::LBFGSParams::memory
unsigned memory
Length of the history to keep.
Definition: decl/lbfgs.hpp:14
pa::load_CasADi_problem_full
pa::ProblemFull load_CasADi_problem_full(const char *filename, unsigned n, unsigned m1, unsigned m2, bool second_order=false)
Load a problem generated by CasADi (without parameters).
Definition: CasADiLoader.cpp:159
panocpy.test.p
p
Definition: test.py:57
prob_setter_grad_f
auto prob_setter_grad_f()
Definition: panocpy/problem.hpp:31
pa::ALMParams::ρ
real_t ρ
Update factor for primal tolerance.
Definition: decl/alm.hpp:39
pa::ProblemFull
Problem description for minimization problems.
Definition: include/panoc-alm/util/problem.hpp:213
prob_getter_grad_gi
auto prob_getter_grad_gi()
Definition: panocpy/problem.hpp:98
pa::PolymorphicPANOCDirectionBase::get_name
virtual std::string get_name() const =0
pa::PANOCStopCrit::ApproxKKT
@ ApproxKKT
Find a ε-approximate KKT point.
pa::ProblemFullWithParam::get_param
pa::vec & get_param()
Definition: include/panoc-alm/util/problem.hpp:363
PYBIND11_MODULE
PYBIND11_MODULE(PANOCPY_MODULE_NAME, m)
Definition: panocpy.cpp:111
pa::LipschitzEstimateParams::Lγ_factor
real_t Lγ_factor
Factor that relates step size γ and Lipschitz constant.
Definition: lipschitz.hpp:15
panocpy.test.n
int n
Definition: test.py:38
pa::PolymorphicInnerSolverTrampoline
Definition: polymorphic-inner-solver.hpp:174
prob_getter_hess_L
auto prob_getter_hess_L()
Definition: panocpy/problem.hpp:128
pa::real_t
double real_t
Default floating point type.
Definition: vec.hpp:8
pa::ALMParams::M
real_t M
Lagrange multiplier bound.
Definition: decl/alm.hpp:46
pa::PolymorphicPANOCDirection::changed_γ
void changed_γ(real_t γₖ, real_t old_γₖ) override
Definition: polymorphic-panoc-direction.hpp:113
pa::PolymorphicInnerSolver
Definition: polymorphic-inner-solver.hpp:307
pa::ALMParams::Δ
real_t Δ
Factor used in updating the penalty parameters.
Definition: decl/alm.hpp:19
prob_setter_hess_L_prod
auto prob_setter_hess_L_prod()
Definition: panocpy/problem.hpp:182
solverstatus.hpp
pa::ALMParams::Σ₀
real_t Σ₀
Initial penalty parameter.
Definition: decl/alm.hpp:26
pa::PANOCParams::max_iter
unsigned max_iter
Maximum number of inner PANOC iterations.
Definition: inner/decl/panoc.hpp:24
pa::ALMParams::Σ₀_lower
real_t Σ₀_lower
Factor to reduce the initial penalty factor by if convergence fails in in the first iteration.
Definition: decl/alm.hpp:32
pa::GAAPGAParams::full_flush_on_γ_change
bool full_flush_on_γ_change
Definition: guarded-aa-pga.hpp:45
pa::Problem
Problem description for minimization problems.
Definition: include/panoc-alm/util/problem.hpp:24
pa::PANOCParams::update_lipschitz_in_linesearch
bool update_lipschitz_in_linesearch
Definition: inner/decl/panoc.hpp:45
pa::load_CasADi_problem
pa::Problem load_CasADi_problem(const std::string &filename, unsigned n, unsigned m, bool second_order=false)
Load a problem generated by CasADi (without parameters).
Definition: CasADiLoader.cpp:58
pa::PANOCParams::alternative_linesearch_cond
bool alternative_linesearch_cond
Definition: inner/decl/panoc.hpp:46
pa::Problem::C
Box C
Constraints of the decision variables, .
Definition: include/panoc-alm/util/problem.hpp:27
prob_full_setter_grad_g1_prod
auto prob_full_setter_grad_g1_prod()
Definition: panocpy/problem.hpp:278
prob_full_setter_grad_f
auto prob_full_setter_grad_f()
Definition: panocpy/problem.hpp:225
PolymorphicALMConstructorDefaultParams
auto PolymorphicALMConstructorDefaultParams()
Definition: panocpy.cpp:89
pa::ProblemFullWithParam::set_param
void set_param(pa::crvec p)
Definition: include/panoc-alm/util/problem.hpp:361
pa::PolymorphicInnerSolver::set_progress_callback
void set_progress_callback(std::function< void(const typename InnerSolver::ProgressInfo &)> cb)
Definition: polymorphic-inner-solver.hpp:371
pa::ALMParams::σ₀
real_t σ₀
Initial penalty parameter factor.
Definition: decl/alm.hpp:29