QPALM main
Proximal Augmented Lagrangian method for Quadratic Programs
Loading...
Searching...
No Matches
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 <qpalm/constants.h>
19#include <qpalm/global_opts.h>
20#include <qpalm/iteration.h>
21#include <qpalm/lin_alg.h>
22#include <qpalm/linesearch.h>
23#include <qpalm/newton.h>
24#include <qpalm/nonconvex.h>
25#include <qpalm/scaling.h>
27#include <qpalm/termination.h>
28#include <qpalm/types.h>
29#include <qpalm/util.h>
30#include <qpalm/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 * Cancel the ongoing call to @ref qpalm_solve.
102 *
103 * Thread- and signal handler-safe.
104 */
106
107/**
108 * Update the settings to the new settings.
109 *
110 * @warning Decreasing settings->scaling is not allowed. Increasing it is possible.
111 *
112 * @param work Workspace
113 * @param settings New settings
114 */
116 const QPALMSettings *settings);
117
118/**
119 * Update the lower and upper bounds.
120 *
121 * Use NULL to indicate that one of the bounds does not change.
122 *
123 * @param work Workspace
124 * @param bmin New lower bounds
125 * @param bmax New upper bounds
126 */
128 const c_float *bmin,
129 const c_float *bmax);
130
131/**
132 * Update the linear part of the cost.
133 *
134 * This causes an update of the cost scaling factor as well.
135 *
136 * @param work Workspace
137 * @param q Linear part of the objective
138 */
140 const c_float *q);
141
142/**
143 * Update the matrix entries of Q and A.
144 *
145 * This function does not allow a change in the patterns of Q and A. For this, the
146 * user will need to recall qpalm_setup.
147 *
148 * @param work Workspace
149 * @param Qx Elements of Q (upper diagonal part)
150 * @param Ax Elements of A
151 */
153 const c_float *Qx,
154 const c_float *Ax);
155
156
157
158/**
159 * Cleanup the workspace by deallocating memory.
160 *
161 * This function should be the called after the user is done using QPALM.
162 * @param work Workspace
163 */
165
166/**
167 * @}
168 */
169
170# ifdef __cplusplus
171}
172# endif
173
174#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
void qpalm_solve(QPALMWorkspace *work)
Solve the quadratic program.
Definition qpalm.c:483
QPALMWorkspace * qpalm_setup(const QPALMData *data, const QPALMSettings *settings)
Initialize QPALM solver allocating memory.
Definition qpalm.c:68
void qpalm_update_settings(QPALMWorkspace *work, const QPALMSettings *settings)
Update the settings to the new settings.
Definition qpalm.c:610
void qpalm_set_default_settings(QPALMSettings *settings)
Set default settings from constants.h file.
Definition qpalm.c:33
void qpalm_update_bounds(QPALMWorkspace *work, const c_float *bmin, const c_float *bmax)
Update the lower and upper bounds.
Definition qpalm.c:643
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:711
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:260
void qpalm_cleanup(QPALMWorkspace *work)
Cleanup the workspace by deallocating memory.
Definition qpalm.c:735
void qpalm_cancel(QPALMWorkspace *work)
Cancel the ongoing call to qpalm_solve.
Definition qpalm.c:479
void qpalm_update_q(QPALMWorkspace *work, const c_float *q)
Update the linear part of the cost.
Definition qpalm.c:690
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:109
Settings struct.
Definition types.h:124
QPALM Workspace.
Definition types.h:204
Routines to check the termination and infeasibility criteria.
Internal data structures used in QPALM.
Utility functions.
Validation of the user provided settings and data.