alpaqa 0.0.1
Nonconvex constrained optimization
CUTEst/Rosenbrock/main.cpp

This example shows how to load and solve CUTEst problems using alpaqa.

/**
* @example CUTEst/Rosenbrock/main.cpp
*
* This example shows how to load and solve CUTEst problems using alpaqa.
*/
#include <iostream>
int main() {
using alpaqa::vec;
// Paths to the files generated by CUTEst
const char *so_fname = "CUTEst/ROSENBR/libcutest-problem-ROSENBR.so";
const char *outsdif_fname = "CUTEst/ROSENBR/OUTSDIF.d";
// Load the problem
CUTEstProblem cutest_p(so_fname, outsdif_fname);
const alpaqa::Problem &p = cutest_p.problem;
// Settings for the outer augmented Lagrangian method
almparam.ε = 1e-8; // tolerance
almparam.δ = 1e-8;
almparam.Δ = 10;
almparam.max_iter = 20;
almparam.print_interval = 1;
// Settings for the inner PANOC solver
panocparam.max_iter = 500;
panocparam.print_interval = 10;
// Settings for the L-BFGS algorithm used by PANOC
lbfgsparam.memory = 10;
// Create an ALM solver using PANOC as inner solver
almparam, // params for outer solver
{panocparam, lbfgsparam}, // inner solver
};
// Initial guess
vec x = cutest_p.x0;
vec y = cutest_p.y0;
// Solve the problem
auto stats = solver(p, y, x);
// Print the results
std::cout << "status: " << stats.status << std::endl;
std::cout << "x = " << x.transpose() << std::endl;
std::cout << "y = " << y.transpose() << std::endl;
vec g(p.m);
p.g(x, g);
std::cout << "g = " << g.transpose() << std::endl;
std::cout << "f = " << p.f(x) << std::endl;
std::cout << "inner: " << stats.inner.iterations << std::endl;
std::cout << "outer: " << stats.outer_iterations << std::endl;
}
int main()
Wrapper for CUTEst problems loaded from an external shared library.
alpaqa::vec x0
Initial value of decision variables.
alpaqa::vec y0
Initial value of Lagrange multipliers.
alpaqa::Problem problem
Problem statement (bounds, objective, constraints)
Augmented Lagrangian Method solver.
Definition: decl/alm.hpp:82
realvec vec
Default type for vectors.
Definition: vec.hpp:14
Parameters for the Augmented Lagrangian solver.
Definition: decl/alm.hpp:13
Parameters for the LBFGS and SpecializedLBFGS classes.
Definition: decl/lbfgs.hpp:12
Tuning parameters for the PANOC algorithm.
lbfgsparam
Definition: main.py:38
almparam
Definition: main.py:25
panocparam
Definition: main.py:33
Problem description for minimization problems.