14 for (
int i = 0; i < n; i++) {
15 X[i] = (
c_float) 10*rand()/RAND_MAX;
22 for (
int i = 0; i < n; i++) {
45 data->
q = random_vector(data->
n);
47 data->
bmin = constant_vector(-2, data->
m);
48 data->
bmax = constant_vector(2, data->
m);
51 A = ladel_sparse_alloc(M, N, ANZMAX, UNSYMMETRIC,
TRUE,
FALSE);
52 Q = ladel_sparse_alloc(N, N, QNZMAX, UPPER,
TRUE,
FALSE);
59 Ax[0] = 1.0; Ax[1] = 1.0; Ax[2] = 1.0; Ax[3] = 1.0;
60 Ap[0] = 0; Ap[1] = 2; Ap[2] = 4;
61 Ai[0] = 0; Ai[1] = 2; Ai[2] = 1; Ai[3] = 2;
67 Qx[0] = 1.0; Qx[1] = 1.5;
68 Qp[0] = 0; Qp[1] = 1; Qp[2] = 2;
83 printf(
"Solver status: ");
85 printf(
"Iter: %d\n", (
int) work->
info->
iter);
97 data->
Q = ladel_sparse_free(data->
Q);
98 data->
A = ladel_sparse_free(data->
A);
QPALM_EXPORT void * qpalm_calloc(size_t num, size_t size)
ladel_int c_int
type for integer numbers
ladel_double c_float
type for floating point numbers
QPALM_EXPORT void * qpalm_malloc(size_t size)
QPALM_EXPORT void qpalm_free(void *ptr)
QPALM_EXPORT void qpalm_set_default_settings(QPALMSettings *settings)
Set default settings from constants.h file.
QPALM_EXPORT void qpalm_cleanup(QPALMWorkspace *work)
Cleanup the workspace by deallocating memory.
QPALM_EXPORT void qpalm_solve(QPALMWorkspace *work)
Solve the quadratic program.
QPALM_EXPORT QPALMWorkspace * qpalm_setup(const QPALMData *data, const QPALMSettings *settings)
Initialize QPALM solver allocating memory.
size_t m
number of constraints m
c_float * bmin
dense array for lower bounds (size m)
c_float c
constant part of cost
size_t n
number of variables n
c_float * q
dense array for linear part of cost function (size n)
solver_sparse * A
sparse linear constraints matrix A (size m x n)
c_float * bmax
dense array for upper bounds (size m)
solver_sparse * Q
sparse quadratic part of the cost Q (size n x n)
c_float run_time
total time (seconds)
c_int iter_out
number of outer iterations (i.e. dual updates)
c_int iter
number of iterations taken
c_float solve_time
time taken for solve phase (seconds)
char status[32]
status string, e.g. 'solved'
c_float setup_time
time taken for setup phase (seconds)
QPALMInfo * info
solver information
ladel_sparse_matrix solver_sparse