75 # ifdef QPALM_PRINTING
84 # ifdef QPALM_PRINTING
95 # ifdef QPALM_PRINTING
129 work->
data->
A = ladel_sparse_allocate_and_copy(data->
A);
130 work->
data->
Q = ladel_sparse_allocate_and_copy(data->
Q);
131 ladel_to_upper_diag(work->
data->
Q);
215 work->
solver->
sym = ladel_symbolics_alloc(m+n);
219 work->
solver->
sym = ladel_symbolics_alloc(n);
273 size_t n = work->
data->
n;
274 size_t m = work->
data->
m;
276 if (x_warm_start != NULL)
286 if (y_warm_start != NULL)
319 #ifdef QPALM_PRINTING
326 size_t n = work->
data->
n;
327 size_t m = work->
data->
m;
328 *common1 = ladel_workspace_allocate(n+m);
330 else *common2 = *common1;
368 for (
size_t i = 0; i < work->
data->
m; i++)
457 c = ladel_workspace_free(c);
459 c2 = ladel_workspace_free(c2);
461 #ifdef QPALM_PRINTING
473 qpalm_termination(work, c, c2, iter, iter_out);
478 #if defined(QPALM_PRINTING) && defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1900
479 unsigned int print_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
484 qpalm_initialize(work, &c, &c2);
492 size_t m = work->
data->
m;
498 c_int no_change_in_active_constraints = 0;
518 qpalm_terminate_on_status(work, c, c2, iter, iter_out,
QPALM_SOLVED);
545 no_change_in_active_constraints = 0;
549 #ifdef QPALM_PRINTING
552 qpalm_print(
"%4" LADEL_PRIi
" | ---------------------------------------------------\n", iter);
571 no_change_in_active_constraints = 0;
578 else no_change_in_active_constraints++;
583 #ifdef QPALM_PRINTING
615 # ifdef QPALM_PRINTING
647 size_t m = work->
data->
m;
648 if (bmin != NULL && bmax != NULL)
650 for (j = 0; j < m; j++)
652 if (bmin[j] > bmax[j])
654 # ifdef QPALM_PRINTING
655 qpalm_eprint(
"Lower bound at index %d is greater than upper bound: %.4e > %.4e",
692 size_t n = work->
data->
n;
714 ladel_sparse_matrix *Q = work->
data->
Q, *A = work->
data->
A;
730 work->
data->
Q = ladel_sparse_free(work->
data->
Q);
732 work->
data->
A = ladel_sparse_free(work->
data->
A);
#define ORDERING
ordering in the factorization
#define EPS_REL_IN
default intermediate relative convergence tolerance
#define SCALING
default number of scaling iterations
#define NONCONVEX
default use of nonconvex adjustments
#define QPALM_MAX_ITER_REACHED
status to indicate termination due to reaching the maximum number of iterations
#define WARM_START
default warm start setting
#define GAMMA_UPD
default proximal penalty update factor
#define PRINT_ITER
default frequency of printing
#define EPS_ABS
default absolute convergence tolerance
#define QPALM_ERROR
status to indicate an error has occured (this error should automatically be printed)
#define FACTORIZE_SCHUR
factorize the Schur complement
#define RHO
default tolerance scaling factor
#define DELTA
default penalty update factor
#define VERBOSE
default write out progress setting
#define INNER_MAX_ITER
default maximum number of iterations per subproblem
#define QPALM_DUAL_INFEASIBLE
status to indicate the problem is dual infeasible
#define RESET_NEWTON_ITER
default frequency of performing a full Cholesky factorization
#define GAMMA_INIT
default initial proximal penalty parameter
#define SIGMA_INIT
default initial penalty parameter (guideline)
#define EPS_REL
default relative convergence tolerance
#define MAX_RANK_UPDATE
maximum rank for the sparse factorization update
#define PROXIMAL
default use of proximal method of multipliers
#define QPALM_TIME_LIMIT_REACHED
status to indicate the problem's runtime has exceeded the specified time limit
#define ENABLE_DUAL_TERMINATION
enable termination after dual objective > something (useful in branch and bound)
#define FACTORIZATION_METHOD
default method for solving the linear system
#define QPALM_PRIMAL_INFEASIBLE
status to indicate the problem is primal infeasible
#define MAX_RANK_UPDATE_FRACTION
maximum rank (relative to n+m) for the factorization update
#define QPALM_SOLVED
status to indicate the problem is solved to optimality given the specified tolerances
#define QPALM_DUAL_TERMINATED
status to indicate the problem has a dual objective that is higher than the specified bound
#define THETA
default penalty update criterion parameter
#define QPALM_NULL
NULL, if something goes wrong during setup, the workspace pointer is set to this.
#define SIGMA_MAX
default penalty cap
#define FACTORIZE_KKT
factorize the kkt system
#define TIME_LIMIT
time limit after which the solver aborts
#define QPALM_UNSOLVED
status to indicate the problem is unsolved.
#define GAMMA_MAX
default proximal penalty cap
#define MAX_ITER
default maximum number of iterations
#define EPS_PRIM_INF
default primal infeasibility tolerance
#define EPS_ABS_IN
default intermediate absolute convergence tolerance
#define QPALM_INFTY
infinity, used to indicate one-sided constraints
#define DUAL_OBJECTIVE_LIMIT
termination value for the dual objective (useful in branch and bound)
#define EPS_DUAL_INF
default dual infeasibility tolerance
void qpalm_free(void *ptr)
void * qpalm_malloc(size_t size)
void * qpalm_calloc(size_t num, size_t size)
Custom memory allocation, print and utility functions, and data types for floats and ints.
#define c_sqrt
square root
ladel_int c_int
type for integer numbers
#define mod(a, b)
modulo operation (positive result for all values)
ladel_double c_float
type for floating point numbers
#define qpalm_eprint(...)
void qpalm_solve(QPALMWorkspace *work)
Solve the quadratic program.
QPALMWorkspace * qpalm_setup(const QPALMData *data, const QPALMSettings *settings)
Initialize QPALM solver allocating memory.
void qpalm_update_settings(QPALMWorkspace *work, const QPALMSettings *settings)
Update the settings to the new settings.
void qpalm_set_default_settings(QPALMSettings *settings)
Set default settings from constants.h file.
void qpalm_update_bounds(QPALMWorkspace *work, const c_float *bmin, const c_float *bmax)
Update the lower and upper bounds.
void qpalm_update_Q_A(QPALMWorkspace *work, const c_float *Qx, const c_float *Ax)
Update the matrix entries of Q and A.
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.
void qpalm_cleanup(QPALMWorkspace *work)
Cleanup the workspace by deallocating memory.
void qpalm_update_q(QPALMWorkspace *work, const c_float *q)
Update the linear part of the cost.
void initialize_sigma(QPALMWorkspace *work, solver_common *c)
Initialize penalty factors from initial x.
c_float compute_dual_objective(QPALMWorkspace *work, solver_common *c)
Compute the (unscaled) dual objective value at the current iterate.
void update_dual_iterate_and_parameters(QPALMWorkspace *work, solver_common *c, c_int iter_out, c_float *eps_k_abs, c_float *eps_k_rel)
void update_gamma(QPALMWorkspace *work)
Update the proximal penalty.
void update_sigma(QPALMWorkspace *work, solver_common *c)
Update the penalty factors.
void update_primal_iterate(QPALMWorkspace *work, solver_common *c)
Update the primal iterate.
c_float compute_objective(QPALMWorkspace *work)
Compute the (unscaled) primal objective value at the current iterate.
void compute_residuals(QPALMWorkspace *work, solver_common *c)
Compute the residuals (in vector form)
QPALM main solver routines.
void vec_add_scaled(const c_float *a, const c_float *b, c_float *c, c_float sc, size_t n)
Scaled addition of one vector to another vector, .
c_float * vec_copy(const c_float *a, size_t n)
Copy vector a into output.
void vec_set_scalar(c_float *a, c_float sc, size_t n)
Fill float vector with a scalar value.
void vec_set_scalar_int(c_int *a, c_int sc, size_t n)
Fill int vector with a scalar value.
void vec_self_mult_scalar(c_float *a, c_float sc, size_t n)
Mulitply vector with a constant scale factor.
void vec_ew_prod(const c_float *a, const c_float *b, c_float *c, size_t n)
Elementwise product, .
void prea_vec_copy(const c_float *a, c_float *b, size_t n)
Copy vector a into preallocated vector b.
Linear algebra with vectors.
Routines to perform exact linesearch.
Functions to calculate the semismooth Newton direction.
void set_settings_nonconvex(QPALMWorkspace *work, solver_common *c)
Set the proximal parameters for nonconvex QPs.
Routines to deal with nonconvex QPs.
void scale_data(QPALMWorkspace *work)
Scale problem matrices.
void unscale_data(QPALMWorkspace *work)
Unscale the problem data.
Problem data scaling during setup.
void mat_vec(solver_sparse *A, solver_dense *x, solver_dense *y, solver_common *c)
Matrix-vector multiplication.
void qpalm_set_factorization_method(QPALMWorkspace *work, solver_common *c)
Choose the linear systems solver method based on the problem data sizes.
Interface and wrapper to matrix/factorization (ladel) functions.
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)
Solver return information.
c_float run_time
total time (seconds)
c_int iter_out
number of outer iterations (i.e. dual updates)
c_float pri_res_norm
norm of primal residual
c_float dual_objective
dual objective function value (= NaN if enable_dual_termination is false)
c_int iter
number of iterations taken
c_float solve_time
time taken for solve phase (seconds)
c_float objective
objective function value
c_int status_val
status as c_int, defined in constants.h
c_float setup_time
time taken for setup phase (seconds)
Problem scaling matrices stored as vectors.
c_float * Dinv
primal variable rescaling
c_float * E
dual variable scaling
c_float * Einv
dual variable rescaling
c_float cinv
objective rescaling
c_float * D
primal variable scaling
c_float gamma_upd
proximal penalty update factor
c_float sigma_max
penalty factor cap
c_float eps_abs_in
intermediate absolute convergence tolerance
c_float gamma_max
proximal penalty parameter cap
c_int proximal
boolean, use proximal method of multipliers or not
c_float delta
penalty update factor
c_int warm_start
boolean, warm start
c_float sigma_init
initial penalty parameter (guideline)
c_float eps_dual_inf
dual infeasibility tolerance
c_int reset_newton_iter
frequency of performing a complete Cholesky factorization
c_float dual_objective_limit
termination value for the dual objective (useful in branch and bound)
c_float eps_rel_in
intermediate relative convergence tolerance
c_float rho
tolerance scaling factor
c_float time_limit
time limit
c_float theta
penalty update criterion parameter
c_int max_rank_update
maximum rank for the sparse factorization update
c_int enable_dual_termination
boolean, enable termination based on dual objective (useful in branch and bound)
c_float max_rank_update_fraction
maximum rank (relative to n+m) for the factorization update
c_float gamma_init
initial proximal penalty parameter
c_float eps_prim_inf
primal infeasibility tolerance
c_int inner_max_iter
maximum number of iterations per subproblem
c_float eps_rel
relative convergence tolerance
c_int verbose
boolean, write out progress
c_int max_iter
maximum number of iterations
c_int scaling
scaling iterations, if 0 then scaling is disabled
c_int nonconvex
boolean, indicates whether the QP is nonconvex
c_float eps_abs
absolute convergence tolerance
c_int ordering
ordering method for factorization
c_int factorization_method
factorize KKT or Schur complement
c_int print_iter
frequency of printing
c_float * x
primal solution
Variables for linear system solving.
solver_dense * E_temp
temporary constraints scaling vectors
solver_dense * neg_dphi
-gradient of the Lagrangian
solver_dense * D_temp
temporary primal variable scaling vectors
solver_sparse * At_sqrt_sigma
A' * sqrt(sigma)
c_int * first_row_A
row index of the first element in each column of A'
c_int * active_constraints
index set of active constraints
solver_dense * yh
candidate dual update
c_int reset_newton
boolean, after sigma is updated perform a new factorization
solver_dense * d
primal update step
c_int * leave
index set of leaving constraints
solver_dense * rhs_kkt
[-dphi; zeros(m,1)]
solver_factor * LD
LD factor (part of LDL' factorization)
c_int factorization_method
factorize KKT or Schur complement
c_int * enter
index set of entering constraints
c_int * active_constraints_old
index set of active constraints in the previous iteration
c_int first_factorization
boolean, indicate we have not factorized previously
solver_dense * At_scale
running vector of sqrt(sigma), used to scale At_sqrt_sigma
solver_dense * Atyh
A' * yh.
solver_dense * sol_kkt
sol_kkt = kkt \ rhs_kkt
solver_factor * LD_Q
LD factor of Q (useful in computing dual objective)
c_float * first_elem_A
value of the first element in each column of A'
c_int nb_leave
number of leaving constraints
solver_symbolics * sym_Q
symbolics for Q (only used in LADEL)
solver_symbolics * sym
symbolics for kkt (only used in LADEL)
solver_sparse * kkt_full
KKT matrix if all constraints would be active.
solver_sparse * kkt
KKT matrix.
c_int nb_enter
number of entering constraints
c_float * delta_y
difference of consecutive dual iterates
c_float * x
primal iterate
c_float * yh
candidate dual update
QPALMScaling * scaling
scaling vectors
c_float * delta
linesearch parameter
c_int nb_sigma_changed
number of sigma-components that changed in an outer iteration (relevant for factorization update)
c_int initialized
flag whether the iterates were initialized or not
c_float * D_temp
temporary primal variable scaling vectors
c_float * delta2
delta .* delta
c_float eps_pri
primal tolerance
QPALMInfo * info
solver information
c_float * z
projection of Axys onto the constraint set [bmin, bmax]
c_float * pri_res_in
intermediate primal residual
c_int * index_J
index set J (L xor P)
c_float * temp_m
placeholder for vector of size m
QPALMSolution * solution
problem solution
c_int * index_P
index set P (where delta>0)
c_float * pri_res
primal residual
c_float * sqrt_sigma
elementwise sqrt(sigma)
c_float * sigma
penalty vector
array_element * s
alpha ./ delta
c_float * delta_alpha
delta .* alpha
c_float * x_prev
previous primal iterate
c_float * Adelta_x
A * delta_x.
c_float * neg_dphi
-dphi, required as the rhs in SCHUR
c_float * Axys
Ax + y./sigma.
c_float * Qdelta_x
Q * delta_x.
c_int gamma_maxed
flag to indicate whether gamma has been maximized when the primal residual was low
c_float * delta_x
difference of consecutive primal iterates
QPALMTimer * timer
timer object
c_float * dphi_prev
previous gradient of the Lagrangian
c_float eps_rel_in
intermediate relative tolerance
QPALMSettings * settings
problem settings
c_float * x0
record of the primal iterate during the last dual update
c_float * sigma_inv
1./sigma
c_float gamma
proximal penalty factor
c_float * dphi
gradient of the Lagrangian
c_float * E_temp
temporary constraints scaling vectors
c_float * df
gradient of the primal objective (+proximal term)
c_float * alpha
linesearch parameter
QPALMSolver * solver
linsys variables
c_float sqrt_delta
sqrt(penalty update factor)
c_float * Atdelta_y
A' * delta_y.
c_float * temp_2m
placeholder for vector of size 2m
c_float * Aty
A' * y (useful for saving one mat_tpose_vec)
c_float eps_abs_in
intermediate absolute tolerance
QPALMData * data
problem data to work on (possibly scaled)
c_int * index_L
index set L (where s>0)
c_float * temp_n
placeholder for vector of size n
c_float * d
primal update step
Array to sort in linesearch.
c_int is_primal_infeasible(QPALMWorkspace *work)
Check whether the problem is primal infeasible.
void calculate_residual_norms_and_tolerances(QPALMWorkspace *work)
Calls the routines that compute the norm of the residuals and the tolerances.
void store_solution(QPALMWorkspace *work)
Helper function to store the (unscaled) solution in the solution struct.
c_int is_solved(QPALMWorkspace *work)
Check whether the primal and dual residual norms are smaller than the primal and dual tolerances.
c_int is_dual_infeasible(QPALMWorkspace *work)
Check whether the problem is dual infeasible.
c_int check_subproblem_termination(QPALMWorkspace *work)
Check whether the subproblem is solved.
Routines to check the termination and infeasibility criteria.
struct QPALM_TIMER QPALMTimer
QPALM Timer for statistics.
QPALMSettings * copy_settings(const QPALMSettings *settings)
Copy settings creating a new settings structure.
void update_status(QPALMInfo *info, c_int status_val)
Update solver status (value and string).
void print_iteration(c_int iter, QPALMWorkspace *work)
Print information about the current iteration.
void print_header(void)
Print the header with QPALM version number and fields.
void print_final_message(QPALMWorkspace *work)
Print final message as a box with info.
c_float qpalm_toc(QPALMTimer *t)
Report time in seconds since last call to qpalm_tic.
void qpalm_tic(QPALMTimer *t)
Start timer.
c_int validate_data(const QPALMData *data)
Validate problem data.
c_int validate_settings(const QPALMSettings *settings)
Validate problem settings.
Validation of the user provided settings and data.