proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1//
2// Copyright (c) 2022 INRIA
3//
7#ifndef PROXSUITE_PROXQP_SETTINGS_HPP
8#define PROXSUITE_PROXQP_SETTINGS_HPP
9
10#include <Eigen/Core>
14
15namespace proxsuite {
16namespace proxqp {
17
18// Sparse backend specifications
19enum struct SparseBackend
20{
21 Automatic, // the solver will select the appropriate sparse backend.
22 SparseCholesky, // sparse cholesky backend.
23 MatrixFree, // iterative matrix free sparse backend.
24};
25// Sparse backend specifications
26enum struct DenseBackend
27{
28 Automatic, // the solver will select the appropriate dense backend.
29 PrimalDualLDLT, // Factorization of the full regularized KKT matrix.
30 PrimalLDLT, // Factorize only the primal Hessian corresponding to H+rho I +
31 // 1/mu AT*A.
32};
33// MERIT FUNCTION
35{
36 GPDAL, // Generalized Primal Dual Augmented Lagrangian
37 PDAL, // Primal Dual Augmented Lagrangian
38};
39// COST FUNCTION TYPE
40enum struct HessianType
41{
42 Zero, // Linear Program
43 Dense, // Quadratic Program
44 Diagonal // Quadratic Program with diagonal Hessian
45};
46// Augment the minimal eigen value of H with some regularizer
48{
49 PowerIteration, // Process a power iteration algorithm
50 ExactMethod // Use Eigen's method to estimate the minimal eigenvalue
51 // watch out, the last option is only available for dense
52 // matrices!
53};
54inline std::ostream&
55operator<<(std::ostream& os, const SparseBackend& sparse_backend)
56{
57 if (sparse_backend == SparseBackend::Automatic)
58 os << "Automatic";
59 else if (sparse_backend == SparseBackend::SparseCholesky) {
60 os << "SparseCholesky";
61 } else {
62 os << "MatrixFree";
63 }
64 return os;
65}
66inline std::ostream&
67operator<<(std::ostream& os, const DenseBackend& dense_backend)
68{
69 if (dense_backend == DenseBackend::PrimalDualLDLT) {
70 os << "PrimalDualLDLT";
71 } else if (dense_backend == DenseBackend::PrimalLDLT) {
72 os << "PrimalLDLT";
73 } else {
74 os << "Automatic";
75 }
76 return os;
77}
78
83
87template<typename T>
89{
90
94
97
100
105
108
115
116 isize max_iter;
121
127
131
139
215 T default_mu_eq = 1.E-3,
216 T default_mu_in = 1.E-1,
217 T alpha_bcl = 0.1,
218 T beta_bcl = 0.9,
220 T refactor_rho_threshold = 1e-7,
221 T mu_min_eq = 1e-9,
222 T mu_min_in = 1e-8,
223 T mu_max_eq_inv = 1e9,
224 T mu_max_in_inv = 1e8,
225 T mu_update_factor = 0.1,
227 T cold_reset_mu_eq = 1. / 1.1,
228 T cold_reset_mu_in = 1. / 1.1,
229 T cold_reset_mu_eq_inv = 1.1,
230 T cold_reset_mu_in_inv = 1.1,
231 T eps_abs = 1.e-5,
232 T eps_rel = 0,
233 isize max_iter = 10000,
234 isize max_iter_in = 1500,
235 isize safe_guard = 1.E4,
236 isize nb_iterative_refinement = 10,
237 T eps_refact = 1.e-6, // before eps_refact_=1.e-6
238 bool verbose = false,
241 // EQUALITY_CONSTRAINED_INITIAL_GUESS,
242 // as most often we run only
243 // once a problem
244 bool update_preconditioner = false,
245 bool compute_preconditioner = true,
246 bool compute_timings = false,
247 bool check_duality_gap = false,
248 T eps_duality_gap_abs = 1.e-4,
250 isize preconditioner_max_iter = 10,
251 T preconditioner_accuracy = 1.e-3,
252 T eps_primal_inf = 1.E-4,
253 T eps_dual_inf = 1.E-4,
254 bool bcl_update = true,
256 T alpha_gpdal = 0.95,
258 bool primal_infeasibility_solving = false,
303 {
304 switch (dense_backend) {
306 default_rho = 1.E-6;
307 break;
309 default_rho = 1.E-5;
310 break;
312 default_rho = 1.E-6;
313 break;
314 }
315 }
316};
317
318template<typename T>
319bool
320operator==(const Settings<T>& settings1, const Settings<T>& settings2)
321{
322 bool value =
323 settings1.default_rho == settings2.default_rho &&
324 settings1.default_mu_eq == settings2.default_mu_eq &&
325 settings1.default_mu_in == settings2.default_mu_in &&
326 settings1.alpha_bcl == settings2.alpha_bcl &&
327 settings1.alpha_bcl == settings2.alpha_bcl &&
330 settings1.refactor_rho_threshold == settings2.refactor_rho_threshold &&
331 settings1.mu_min_eq == settings2.mu_min_eq &&
332 settings1.mu_min_in == settings2.mu_min_in &&
333 settings1.mu_max_eq_inv == settings2.mu_max_eq_inv &&
334 settings1.mu_max_in_inv == settings2.mu_max_in_inv &&
335 settings1.mu_update_factor == settings2.mu_update_factor &&
336 settings1.mu_update_factor == settings2.mu_update_factor &&
337 settings1.cold_reset_mu_eq == settings2.cold_reset_mu_eq &&
338 settings1.cold_reset_mu_in == settings2.cold_reset_mu_in &&
339 settings1.cold_reset_mu_eq_inv == settings2.cold_reset_mu_eq_inv &&
340 settings1.cold_reset_mu_in_inv == settings2.cold_reset_mu_in_inv &&
341 settings1.eps_abs == settings2.eps_abs &&
342 settings1.eps_rel == settings2.eps_rel &&
343 settings1.max_iter == settings2.max_iter &&
344 settings1.max_iter_in == settings2.max_iter_in &&
345 settings1.safe_guard == settings2.safe_guard &&
346 settings1.nb_iterative_refinement == settings2.nb_iterative_refinement &&
347 settings1.eps_refact == settings2.eps_refact &&
348 settings1.verbose == settings2.verbose &&
349 settings1.initial_guess == settings2.initial_guess &&
350 settings1.update_preconditioner == settings2.update_preconditioner &&
351 settings1.compute_preconditioner == settings2.compute_preconditioner &&
352 settings1.compute_timings == settings2.compute_timings &&
353 settings1.check_duality_gap == settings2.check_duality_gap &&
354 settings1.eps_duality_gap_abs == settings2.eps_duality_gap_abs &&
355 settings1.eps_duality_gap_rel == settings2.eps_duality_gap_rel &&
356 settings1.preconditioner_max_iter == settings2.preconditioner_max_iter &&
357 settings1.preconditioner_accuracy == settings2.preconditioner_accuracy &&
358 settings1.eps_primal_inf == settings2.eps_primal_inf &&
359 settings1.eps_dual_inf == settings2.eps_dual_inf &&
360 settings1.bcl_update == settings2.bcl_update &&
361 settings1.merit_function_type == settings2.merit_function_type &&
362 settings1.alpha_gpdal == settings2.alpha_gpdal &&
363 settings1.sparse_backend == settings2.sparse_backend &&
370 return value;
371}
372
373template<typename T>
374bool
375operator!=(const Settings<T>& settings1, const Settings<T>& settings2)
376{
377 return !(settings1 == settings2);
378}
379
380} // namespace proxqp
381} // namespace proxsuite
382
383#endif /* end of include guard PROXSUITE_PROXQP_SETTINGS_HPP */
std::ostream & operator<<(std::ostream &os, const SparseBackend &sparse_backend)
Definition settings.hpp:55
bool operator!=(const Info< T > &info1, const Info< T > &info2)
Definition results.hpp:228
bool operator==(const Info< T > &info1, const Info< T > &info2)
Definition results.hpp:208
This class defines the settings of PROXQP solvers with sparse and dense backends.
Definition settings.hpp:89
MeritFunctionType merit_function_type
Definition settings.hpp:137
Settings(DenseBackend dense_backend=DenseBackend::PrimalDualLDLT, T default_mu_eq=1.E-3, T default_mu_in=1.E-1, T alpha_bcl=0.1, T beta_bcl=0.9, T refactor_dual_feasibility_threshold=1e-2, T refactor_rho_threshold=1e-7, T mu_min_eq=1e-9, T mu_min_in=1e-8, T mu_max_eq_inv=1e9, T mu_max_in_inv=1e8, T mu_update_factor=0.1, T mu_update_inv_factor=10, T cold_reset_mu_eq=1./1.1, T cold_reset_mu_in=1./1.1, T cold_reset_mu_eq_inv=1.1, T cold_reset_mu_in_inv=1.1, T eps_abs=1.e-5, T eps_rel=0, isize max_iter=10000, isize max_iter_in=1500, isize safe_guard=1.E4, isize nb_iterative_refinement=10, T eps_refact=1.e-6, bool verbose=false, InitialGuessStatus initial_guess=InitialGuessStatus::EQUALITY_CONSTRAINED_INITIAL_GUESS, bool update_preconditioner=false, bool compute_preconditioner=true, bool compute_timings=false, bool check_duality_gap=false, T eps_duality_gap_abs=1.e-4, T eps_duality_gap_rel=0, isize preconditioner_max_iter=10, T preconditioner_accuracy=1.e-3, T eps_primal_inf=1.E-4, T eps_dual_inf=1.E-4, bool bcl_update=true, MeritFunctionType merit_function_type=MeritFunctionType::GPDAL, T alpha_gpdal=0.95, SparseBackend sparse_backend=SparseBackend::Automatic, bool primal_infeasibility_solving=false, isize frequence_infeasibility_check=1, T default_H_eigenvalue_estimate=0.)
Definition settings.hpp:213
InitialGuessStatus initial_guess
Definition settings.hpp:123