QPALM 1.0.0
Proximal Augmented Lagrangian method for Quadratic Programs
qpalm.h
Go to the documentation of this file.
1/**
2 * @file qpalm.h
3 * @author Ben Hermans
4 * @brief QPALM main solver API.
5 * @details This file contains the main functions that can be called by the user.
6 * The user can load the default settings, setup the workspace with data and settings,
7 * warm_start the primal and dual variables, run the solver, update the settings, bounds
8 * and linear part of the cost, and finally cleanup the workspace afterwards.
9 */
10
11#ifndef QPALM_H
12#define QPALM_H
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include "constants.h"
19#include "global_opts.h"
20#include "iteration.h"
21#include "lin_alg.h"
22#include "linesearch.h"
23#include "newton.h"
24#include "nonconvex.h"
25#include "scaling.h"
26#include "solver_interface.h"
27#include "termination.h"
28#include "types.h"
29#include "util.h"
30#include "validate.h"
31
32
33/********************
34* Main Solver API *
35********************/
36
37/**
38 * @defgroup solver-grp Main solver API
39 * @brief The main C API of the QPALM solver.
40 * @{
41 */
42
43/**
44 * Set default settings from constants.h file.
45 * Assumes settings are already allocated in memory.
46 * @param settings Settings structure
47 */
49
50
51/**
52 * Initialize QPALM solver allocating memory.
53 *
54 * All the inputs must be already allocated in memory before calling.
55 *
56 * It performs:
57 * - data and settings validation
58 * - problem data scaling
59 *
60 * @param data Problem data
61 * @param settings Solver settings
62 * @return Solver environment
63 */
65 const QPALMSettings *settings);
66
67
68/**
69 * Warm start workspace variables x, x_0, x_prev, Ax, Qx, y and sigma
70 *
71 * If x_warm_start or y_warm_start is given as NULL, then the related variables
72 * will be initialized to 0. This function also initializes the penalty parameters
73 * sigma and the matrix Asqrtsigma.
74 *
75 * @param work Workspace
76 * @param x_warm_start Warm start for the primal variables
77 * @param y_warm_start Warm start for the dual variables
78 */
80 const c_float *x_warm_start,
81 const c_float *y_warm_start);
82
83/**
84 * Solve the quadratic program.
85 *
86 * The final solver information is stored in the \a work->info structure.
87 *
88 * The solution is stored in the \a work->solution structure.
89 *
90 * If the problem is primal infeasible, the certificate is stored
91 * in \a work->delta_y.
92 *
93 * If the problem is dual infeasible, the certificate is stored in \a
94 * work->delta_x.
95 *
96 * @param work Workspace
97 */
99
100
101/**
102 * Update the settings to the new settings.
103 *
104 * @warning Decreasing settings->scaling is not allowed. Increasing it is possible.
105 *
106 * @param work Workspace
107 * @param settings New settings
108 */
110 const QPALMSettings *settings);
111
112/**
113 * Update the lower and upper bounds.
114 *
115 * Use NULL to indicate that one of the bounds does not change.
116 *
117 * @param work Workspace
118 * @param bmin New lower bounds
119 * @param bmax New upper bounds
120 */
122 const c_float *bmin,
123 const c_float *bmax);
124
125/**
126 * Update the linear part of the cost.
127 *
128 * This causes an update of the cost scaling factor as well.
129 *
130 * @param work Workspace
131 * @param q Linear part of the objective
132 */
134 const c_float *q);
135
136/**
137 * Update the matrix entries of Q and A.
138 *
139 * This function does not allow a change in the patterns of Q and A. For this, the
140 * user will need to recall qpalm_setup.
141 *
142 * @param work Workspace
143 * @param Qx Elements of Q (upper diagonal part)
144 * @param Ax Elements of A
145 */
147 const c_float *Qx,
148 const c_float *Ax);
149
150
151
152/**
153 * Cleanup the workspace by deallocating memory.
154 *
155 * This function should be the called after the user is done using QPALM.
156 * @param work Workspace
157 */
159
160/**
161 * @}
162 */
163
164# ifdef __cplusplus
165}
166# endif
167
168#endif /* QPALM_H */
Constants used in QPALM.
Custom memory allocation, print and utility functions, and data types for floats and ints.
ladel_double c_float
type for floating point numbers
Definition: global_opts.h:41
#define QPALM_EXPORT
Definition: global_opts.h:33
QPALM_EXPORT void qpalm_warm_start(QPALMWorkspace *work, const c_float *x_warm_start, const c_float *y_warm_start)
Warm start workspace variables x, x_0, x_prev, Ax, Qx, y and sigma.
Definition: qpalm.c:259
QPALM_EXPORT void qpalm_update_Q_A(QPALMWorkspace *work, const c_float *Qx, const c_float *Ax)
Update the matrix entries of Q and A.
Definition: qpalm.c:699
QPALM_EXPORT void qpalm_update_bounds(QPALMWorkspace *work, const c_float *bmin, const c_float *bmax)
Update the lower and upper bounds.
Definition: qpalm.c:631
QPALM_EXPORT void qpalm_set_default_settings(QPALMSettings *settings)
Set default settings from constants.h file.
Definition: qpalm.c:33
QPALM_EXPORT void qpalm_update_settings(QPALMWorkspace *work, const QPALMSettings *settings)
Update the settings to the new settings.
Definition: qpalm.c:598
QPALM_EXPORT void qpalm_cleanup(QPALMWorkspace *work)
Cleanup the workspace by deallocating memory.
Definition: qpalm.c:723
QPALM_EXPORT void qpalm_solve(QPALMWorkspace *work)
Solve the quadratic program.
Definition: qpalm.c:476
QPALM_EXPORT QPALMWorkspace * qpalm_setup(const QPALMData *data, const QPALMSettings *settings)
Initialize QPALM solver allocating memory.
Definition: qpalm.c:68
QPALM_EXPORT void qpalm_update_q(QPALMWorkspace *work, const c_float *q)
Update the linear part of the cost.
Definition: qpalm.c:678
QPALM main solver routines.
Linear algebra with vectors.
Routines to perform exact linesearch.
Functions to calculate the semismooth Newton direction.
Routines to deal with nonconvex QPs.
Problem data scaling during setup.
Interface and wrapper to matrix/factorization (ladel) functions.
Data structure.
Definition: types.h:102
Settings struct.
Definition: types.h:117
QPALM Workspace.
Definition: types.h:197
Routines to check the termination and infeasibility criteria.
Internal data structures used in QPALM.
Utility functions.
Validation of the user provided settings and data.