19void c_strcpy(
char dest[], 
const char source[]) {
 
   21    for(i = 0; (dest[i] = source[i]) != 
'\0'; i++);
 
   31    new->eps_abs                  = settings->
eps_abs;       
 
   32    new->eps_rel                  = settings->
eps_rel;       
 
   35    new->rho                      = settings->
rho;           
 
   38    new->theta                    = settings->
theta;         
 
   39    new->delta                    = settings->
delta;
 
   46    new->scaling                  = settings->
scaling;    
 
   48    new->verbose                  = settings->
verbose;
 
   96        qpalm_eprint(
"Unrecognised status value %ld", status_val);
 
  109    qpalm_print(
"\n                  QPALM Version " QPALM_VERSION_STR 
"                   \n\n");
 
  110    qpalm_print(
"Iter |   P. res   |   D. res   |  Stepsize  |  Objective  \n");
 
  111    qpalm_print(
"==========================================================\n");
 
  115    qpalm_print(
"%4ld | %.4e | %.4e | %.4e | %.4e \n", iter,
 
  123    qpalm_print(
"\n\n=============================================================\n");
 
  124    size_t characters_box;
 
  128      snprintf(buf, 80, 
"| QPALM finished successfully.                              |\n");
 
  129      characters_box = strlen(buf);
 
  137      snprintf(buf, 80,
"| QPALM has terminated because the dual objective at the    |\n");
 
  138      characters_box = strlen(buf);
 
  141                          qpalm_print(
"| current iterate is higher than the value specified in     |\n");
 
  146      snprintf(buf, 80,
"| QPALM detected a primal infeasible problem. You can check |\n");
 
  147      characters_box = strlen(buf);
 
  150                          qpalm_print(
"| the certificate of this infeasiblity. If you think the    |\n");
 
  151                          qpalm_print(
"| problem might not be infeasible, try lowering the         |\n");
 
  152                          qpalm_print(
"| infeasiblity tolerance eps_prim_inf.                      |\n");
 
  155      snprintf(buf, 80,
"| QPALM detected a dual infeasible problem. You can check   |\n");
 
  156      characters_box = strlen(buf);
 
  159                          qpalm_print(
"| the certificate of this infeasiblity. If you think the    |\n");
 
  160                          qpalm_print(
"| problem might not be dual infeasible, try lowering the    |\n");
 
  161                          qpalm_print(
"| infeasiblity tolerance eps_dual_inf.                      |\n");
 
  164      snprintf(buf, 80,
"| QPALM hit the maximum number of iterations.               |\n");
 
  165      characters_box = strlen(buf);
 
  173      snprintf(buf, 80,
"| QPALM has exceeded the specified time limit.              |\n");
 
  174      characters_box = strlen(buf);
 
  187    size_t characters_runtime;
 
  189      snprintf(buf, 80,
"| runtime:         %4.2f seconds", work->
info->
run_time);
 
  190      characters_runtime = strlen(buf);
 
  194      snprintf(buf, 80,
"| runtime:         %4.2f milliseconds", work->
info->
run_time*1000);
 
  195      characters_runtime = strlen(buf);
 
  199    for (; characters_runtime < characters_box-2; characters_runtime++) {
 
  205    qpalm_print(
"=============================================================\n");
 
  222  QueryPerformanceFrequency(&t->freq);
 
  223  QueryPerformanceCounter(&t->tic);
 
  228  QueryPerformanceCounter(&t->toc);
 
  229  return (t->toc.QuadPart - t->tic.QuadPart) / (
c_float)t->freq.QuadPart;
 
  233# elif defined __APPLE__ 
  238  t->tic = mach_absolute_time();
 
  245  t->toc   = mach_absolute_time();
 
  246  duration = t->toc - t->tic;
 
  249  mach_timebase_info(&(t->tinfo));
 
  250  duration *= t->tinfo.numer;
 
  251  duration /= t->tinfo.denom;
 
  253  return (
c_float)duration / 1e9;
 
  257# elif defined __MACH__ 
  262  t->tic = mach_absolute_time();
 
  269  t->toc   = mach_absolute_time();
 
  270  duration = t->toc - t->tic;
 
  273  mach_timebase_info(&(t->tinfo));
 
  274  duration *= t->tinfo.numer;
 
  275  duration /= t->tinfo.denom;
 
  277  return (
c_float)duration / 1e9;
 
  281# elif defined __linux__   
  286  clock_gettime(CLOCK_MONOTONIC, &t->tic);
 
  292  struct timespec temp;
 
  294  clock_gettime(CLOCK_MONOTONIC, &t->toc);
 
  296  if ((t->toc.tv_nsec - t->tic.tv_nsec) < 0) {
 
  297    temp.tv_sec  = t->toc.tv_sec - t->tic.tv_sec - 1;
 
  298    temp.tv_nsec = 1000000000 + t->toc.tv_nsec - t->tic.tv_nsec;
 
  300    temp.tv_sec  = t->toc.tv_sec - t->tic.tv_sec;
 
  301    temp.tv_nsec = t->toc.tv_nsec - t->tic.tv_nsec;
 
#define QPALM_MAX_ITER_REACHED
status to indicate termination due to reaching the maximum number of iterations
 
#define QPALM_ERROR
status to indicate an error has occured (this error should automatically be printed)
 
#define QPALM_DUAL_INFEASIBLE
status to indicate the problem is dual infeasible
 
#define QPALM_TIME_LIMIT_REACHED
status to indicate the problem's runtime has exceeded the specified time limit
 
#define QPALM_PRIMAL_INFEASIBLE
status to indicate the problem is primal infeasible
 
#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 QPALM_UNSOLVED
status to indicate the problem is unsolved.
 
Custom memory allocation, print and utility functions, and data types for floats and ints.
 
ladel_int c_int
type for integer numbers
 
ladel_double c_float
type for floating point numbers
 
#define qpalm_eprint(...)
 
QPALM_EXPORT void * qpalm_malloc(size_t size)
 
Linear algebra with vectors.
 
Solver return information.
 
c_float run_time
total time (seconds)
 
c_float pri_res_norm
norm of primal residual
 
c_float dual_objective
dual objective function value (= NaN if enable_dual_termination is false)
 
char status[32]
status string, e.g. 'solved'
 
c_float objective
objective function value
 
c_int status_val
status as c_int, defined in constants.h
 
c_float dua_res_norm
norm of dual residual
 
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 eps_pri
primal tolerance
 
QPALMInfo * info
solver information
 
c_float eps_dua
dual tolerance
 
QPALMSettings * settings
problem settings
 
Internal data structures used in QPALM.
 
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 c_strcpy(char dest[], const char source[])
Custom string copy to avoid string.h library.
 
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.