ocp_qp_interface

Functions

void ocp_qp_xcond_solver_config_initialize_from_plan(ocp_qp_solver_t solver_name, ocp_qp_xcond_solver_config *solver_config)

Initializes the qp solver configuration.

TBC should this be private/static - no, used in ocp_nlp

ocp_qp_xcond_solver_config *ocp_qp_xcond_solver_config_create(ocp_qp_solver_plan plan)

Constructs a qp solver config and Initializes with default values.

Parameters
  • plan: The qp solver plan struct.

void ocp_qp_xcond_solver_config_free(ocp_qp_xcond_solver_config *config)

Destructor for config struct, frees memory.

Parameters
  • config: The config object to destroy.

ocp_qp_dims *ocp_qp_dims_create(int N)

Constructs a struct that contains the dimensions for the variables of the qp.

Parameters
  • N: The number of variables.

void ocp_qp_dims_free(void *dims)

Destructor of The dimension struct.

Parameters
  • dims: The dimension struct.

ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create(ocp_qp_xcond_solver_config *config, int N)
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create_from_ocp_qp_dims(ocp_qp_xcond_solver_config *config, ocp_qp_dims *dims)
void ocp_qp_xcond_solver_dims_free(ocp_qp_xcond_solver_dims *dims)
ocp_qp_in *ocp_qp_in_create(ocp_qp_dims *dims)

Constructs an input object for the qp.

Parameters
  • dims: The dimension struct.

void ocp_qp_in_set(ocp_qp_xcond_solver_config *config, ocp_qp_in *in, int stage, char *field, void *value)
void ocp_qp_in_free(void *in_)

Destructor of the inputs struct.

Parameters
  • in_: The inputs struct.

ocp_qp_out *ocp_qp_out_create(ocp_qp_dims *dims)

Constructs an outputs object for the qp.

Parameters
  • dims: The dimension struct.

void ocp_qp_out_free(void *out_)

Destructor of the output struct.

Parameters
  • out_: The output struct.

void ocp_qp_out_get(ocp_qp_out *out, const char *field, void *value)

Getter of output struct.

void *ocp_qp_xcond_solver_opts_create(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims)

Constructs an options object for the qp.

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

void ocp_qp_xcond_solver_opts_free(ocp_qp_xcond_solver_opts *opts)

Destructor of the options struct.

Parameters
  • opts: The options struct to destroy.

void ocp_qp_xcond_solver_opts_set(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_opts *opts, const char *field, void *value)

Setter of the options struct.

Parameters
  • opts: The options struct.

int ocp_qp_calculate_size(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_)

TBC Should be private/static?

ocp_qp_solver *ocp_qp_assign(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_, void *raw_memory)

TBC Reserves memory? TBC Should this be private?

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

  • opts_: The options struct.

  • raw_memory: Pointer to raw memory to assign to qp solver.

ocp_qp_solver *ocp_qp_create(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_)

Creates a qp solver.

Reserves memory.

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

  • opts_: The options struct.

int ocp_qp_solve(ocp_qp_solver *solver, ocp_qp_in *qp_in, ocp_qp_out *qp_out)

Solves the qp.

Parameters
  • solver: The solver.

  • qp_in: The inputs struct.

  • qp_out: The output struct.

void ocp_qp_solver_destroy(ocp_qp_solver *solver)

Destroys a qp solver.

Frees memory.

Parameters
  • solver: The qp solver

static ocp_qp_res *ocp_qp_res_create(ocp_qp_dims *dims)
static ocp_qp_res_ws *ocp_qp_res_workspace_create(ocp_qp_dims *dims)
void ocp_qp_inf_norm_residuals(ocp_qp_dims *dims, ocp_qp_in *qp_in, ocp_qp_out *qp_out, double *res)

Calculates the infinity norm of the residuals.

Parameters
  • dims: The dimension struct.

  • qp_in: The inputs struct.

  • qp_out: The output struct.

  • res: Output array for the residuals.

Enums

enum ocp_qp_solver_t

QP solver types (Enumeration).

Full list of fields: PARTIAL_CONDENSING_HPIPM PARTIAL_CONDENSING_HPMPC PARTIAL_CONDENSING_OOQP PARTIAL_CONDENSING_OSQP PARTIAL_CONDENSING_QPDUNES FULL_CONDENSING_HPIPM FULL_CONDENSING_QPOASES FULL_CONDENSING_QORE FULL_CONDENSING_OOQP INVALID_QP_SOLVER

Note: In this enumeration the partial condensing solvers have to be specified before the full condensing solvers.

Values:

PARTIAL_CONDENSING_HPIPM
FULL_CONDENSING_HPIPM
INVALID_QP_SOLVER

Functions

void ocp_qp_xcond_solver_config_initialize_from_plan(ocp_qp_solver_t solver_name, ocp_qp_xcond_solver_config *solver_config)

Initializes the qp solver configuration.

TBC should this be private/static - no, used in ocp_nlp

ocp_qp_xcond_solver_config *ocp_qp_xcond_solver_config_create(ocp_qp_solver_plan plan)

Constructs a qp solver config and Initializes with default values.

Parameters
  • plan: The qp solver plan struct.

void ocp_qp_xcond_solver_config_free(ocp_qp_xcond_solver_config *config)

Destructor for config struct, frees memory.

Parameters
  • config: The config object to destroy.

ocp_qp_dims *ocp_qp_dims_create(int N)

Constructs a struct that contains the dimensions for the variables of the qp.

Parameters
  • N: The number of variables.

void ocp_qp_dims_free(void *dims)

Destructor of The dimension struct.

Parameters
  • dims: The dimension struct.

ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create(ocp_qp_xcond_solver_config *config, int N)
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create_from_ocp_qp_dims(ocp_qp_xcond_solver_config *config, ocp_qp_dims *dims)
void ocp_qp_xcond_solver_dims_free(ocp_qp_xcond_solver_dims *dims_)
void ocp_qp_xcond_solver_dims_set(void *config_, ocp_qp_xcond_solver_dims *dims, int stage, const char *field, int *value)
ocp_qp_in *ocp_qp_in_create(ocp_qp_dims *dims)

Constructs an input object for the qp.

Parameters
  • dims: The dimension struct.

void ocp_qp_in_set(ocp_qp_xcond_solver_config *config, ocp_qp_in *in, int stage, char *field, void *value)
void ocp_qp_in_free(void *in_)

Destructor of the inputs struct.

Parameters
  • in_: The inputs struct.

ocp_qp_out *ocp_qp_out_create(ocp_qp_dims *dims)

Constructs an outputs object for the qp.

Parameters
  • dims: The dimension struct.

void ocp_qp_out_free(void *out_)

Destructor of the output struct.

Parameters
  • out_: The output struct.

void ocp_qp_out_get(ocp_qp_out *out, const char *field, void *value)

Getter of output struct.

void *ocp_qp_xcond_solver_opts_create(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims)

Constructs an options object for the qp.

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

void ocp_qp_xcond_solver_opts_free(ocp_qp_xcond_solver_opts *opts)

Destructor of the options struct.

Parameters
  • opts: The options struct to destroy.

void ocp_qp_xcond_solver_opts_set(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_opts *opts, const char *field, void *value)

Setter of the options struct.

Parameters
  • opts: The options struct.

int ocp_qp_calculate_size(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_)

TBC Should be private/static?

ocp_qp_solver *ocp_qp_assign(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_, void *raw_memory)

TBC Reserves memory? TBC Should this be private?

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

  • opts_: The options struct.

  • raw_memory: Pointer to raw memory to assign to qp solver.

ocp_qp_solver *ocp_qp_create(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_)

Creates a qp solver.

Reserves memory.

Parameters
  • config: The configuration struct.

  • dims: The dimension struct.

  • opts_: The options struct.

void ocp_qp_solver_destroy(ocp_qp_solver *solver)

Destroys a qp solver.

Frees memory.

Parameters
  • solver: The qp solver

void ocp_qp_x_cond_solver_free(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_)
int ocp_qp_solve(ocp_qp_solver *solver, ocp_qp_in *qp_in, ocp_qp_out *qp_out)

Solves the qp.

Parameters
  • solver: The solver.

  • qp_in: The inputs struct.

  • qp_out: The output struct.

void ocp_qp_inf_norm_residuals(ocp_qp_dims *dims, ocp_qp_in *qp_in, ocp_qp_out *qp_out, double *res)

Calculates the infinity norm of the residuals.

Parameters
  • dims: The dimension struct.

  • qp_in: The inputs struct.

  • qp_out: The output struct.

  • res: Output array for the residuals.

struct ocp_qp_solver_plan
#include <ocp_qp_interface.h>

Struct containing qp solver.

Public Members

ocp_qp_solver_t qp_solver
struct ocp_qp_solver
#include <ocp_qp_interface.h>

Linear ocp configuration.

Public Members

ocp_qp_xcond_solver_config *config
ocp_qp_xcond_solver_dims *dims
void *opts
void *mem
void *work

Defines

QP_SOLVER_CONFIG_
QP_INFO_

Struct containing metrics of the qp solver.

Typedefs

typedef struct d_ocp_qp_dim ocp_qp_dims
typedef struct d_ocp_qp ocp_qp_in
typedef struct d_ocp_qp_sol ocp_qp_out
typedef struct d_ocp_qp_res ocp_qp_res
typedef struct d_ocp_qp_res_ws ocp_qp_res_ws

Functions

int ocp_qp_solver_config_calculate_size()
qp_solver_config *ocp_qp_solver_config_assign(void *raw_memory)
int ocp_qp_condensing_config_calculate_size()
ocp_qp_xcond_config *ocp_qp_condensing_config_assign(void *raw_memory)
int ocp_qp_dims_calculate_size(int N)
ocp_qp_dims *ocp_qp_dims_assign(int N, void *raw_memory)
void ocp_qp_dims_set(void *config_, void *dims, int stage, const char *field, int *value)
void ocp_qp_dims_get(void *config_, void *dims, int stage, const char *field, int *value)
int ocp_qp_in_calculate_size(ocp_qp_dims *dims)
ocp_qp_in *ocp_qp_in_assign(ocp_qp_dims *dims, void *raw_memory)
int ocp_qp_out_calculate_size(ocp_qp_dims *dims)
ocp_qp_out *ocp_qp_out_assign(ocp_qp_dims *dims, void *raw_memory)
int ocp_qp_res_calculate_size(ocp_qp_dims *dims)
ocp_qp_res *ocp_qp_res_assign(ocp_qp_dims *dims, void *raw_memory)
int ocp_qp_res_workspace_calculate_size(ocp_qp_dims *dims)
ocp_qp_res_ws *ocp_qp_res_workspace_assign(ocp_qp_dims *dims, void *raw_memory)
void ocp_qp_res_compute(ocp_qp_in *qp_in, ocp_qp_out *qp_out, ocp_qp_res *qp_res, ocp_qp_res_ws *res_ws)
void ocp_qp_res_compute_nrm_inf(ocp_qp_res *qp_res, double res[4])
void ocp_qp_stack_slacks_dims(ocp_qp_dims *in, ocp_qp_dims *out)
void ocp_qp_stack_slacks(ocp_qp_in *in, ocp_qp_in *out)
void ocp_qp_compute_t(ocp_qp_in *qp_in, ocp_qp_out *qp_out)
struct qp_solver_config
#include <ocp_qp_common.h>

Public Members

void (*dims_set)(void *config_, void *dims_, const char *field, const int *value)
int (*opts_calculate_size)(void *config, void *dims)
void *(*opts_assign)(void *config, void *dims, void *raw_memory)
void (*opts_initialize_default)(void *config, void *dims, void *args)
void (*opts_update)(void *config, void *dims, void *args)
void (*opts_set)(void *config_, void *opts_, const char *field, void *value)
int (*memory_calculate_size)(void *config, void *dims, void *args)
void *(*memory_assign)(void *config, void *dims, void *args, void *raw_memory)
void (*memory_get)(void *config_, void *mem_, const char *field, void *value)
int (*workspace_calculate_size)(void *config, void *dims, void *args)
int (*evaluate)(void *config, void *qp_in, void *qp_out, void *args, void *mem, void *work)
void (*eval_sens)(void *config, void *qp_in, void *qp_out, void *opts, void *mem, void *work)
struct ocp_qp_xcond_config
#include <ocp_qp_common.h>

Public Members

int (*dims_calculate_size)(void *config, int N)
void *(*dims_assign)(void *config, int N, void *raw_memory)
void (*dims_set)(void *config, void *dims_, int stage, const char *field, int *value)
void (*dims_get)(void *config, void *dims, const char *field, void *value)
int (*opts_calculate_size)(void *dims)
void *(*opts_assign)(void *dims, void *raw_memory)
void (*opts_initialize_default)(void *dims, void *opts)
void (*opts_update)(void *dims, void *opts)
void (*opts_set)(void *opts_, const char *field, void *value)
int (*memory_calculate_size)(void *dims, void *opts)
void *(*memory_assign)(void *dims, void *opts, void *raw_memory)
void (*memory_get)(void *config, void *mem, const char *field, void *value)
int (*workspace_calculate_size)(void *dims, void *opts)
int (*condensing)(void *qp_in, void *qp_out, void *opts, void *mem, void *work)
int (*condensing_rhs)(void *qp_in, void *qp_out, void *opts, void *mem, void *work)
int (*expansion)(void *qp_in, void *qp_out, void *opts, void *mem, void *work)
struct qp_info
#include <ocp_qp_common.h>

Public Members

double solve_QP_time
double condensing_time
double interface_time
double total_time
int num_iter
int t_computed