1 /**************************************************************************************************
2 *                                                                                                 *
3 * This file is part of HPIPM.                                                                     *
4 *                                                                                                 *
5 * HPIPM -- High-Performance Interior Point Method.                                                *
6 * Copyright (C) 2019 by Gianluca Frison.                                                          *
7 * Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl.              *
8 * All rights reserved.                                                                            *
9 *                                                                                                 *
10 * The 2-Clause BSD License                                                                        *
11 *                                                                                                 *
12 * Redistribution and use in source and binary forms, with or without                              *
13 * modification, are permitted provided that the following conditions are met:                     *
14 *                                                                                                 *
15 * 1. Redistributions of source code must retain the above copyright notice, this                  *
16 *    list of conditions and the following disclaimer.                                             *
17 * 2. Redistributions in binary form must reproduce the above copyright notice,                    *
18 *    this list of conditions and the following disclaimer in the documentation                    *
19 *    and/or other materials provided with the distribution.                                       *
20 *                                                                                                 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND                 *
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED                   *
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                          *
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR                 *
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES                  *
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;                    *
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND                     *
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT                      *
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS                   *
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                    *
31 *                                                                                                 *
32 * Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de                             *
33 *                                                                                                 *
34 **************************************************************************************************/
35 
36 #include <stdlib.h>
37 #include <stdio.h>
38 #ifdef USE_C99_MATH
39 #include <math.h>
40 #endif
41 
42 #include <blasfeo_target.h>
43 #include <blasfeo_common.h>
44 #include <blasfeo_s_aux.h>
45 #include <blasfeo_s_blas.h>
46 
47 #include <hpipm_s_tree_ocp_qp.h>
48 #include <hpipm_s_tree_ocp_qp_sol.h>
49 #include <hpipm_s_tree_ocp_qp_res.h>
50 #include <hpipm_s_tree_ocp_qp_ipm.h>
51 #include <hpipm_s_tree_ocp_qp_kkt.h>
52 #include <hpipm_s_core_qp_ipm.h>
53 #include <hpipm_s_core_qp_ipm_aux.h>
54 
55 
56 
57 #define AXPY blasfeo_saxpy
58 #define BACKUP_RES_M s_backup_res_m
59 #define COMPUTE_ALPHA_QP s_compute_alpha_qp
60 #define COMPUTE_CENTERING_CORRECTION_QP s_compute_centering_correction_qp
61 #define COMPUTE_CENTERING_QP s_compute_centering_qp
62 #define COMPUTE_LIN_RES_TREE_OCP_QP s_compute_lin_res_tree_ocp_qp
63 #define COMPUTE_MU_AFF_QP s_compute_mu_aff_qp
64 #define COMPUTE_RES_TREE_OCP_QP s_compute_res_tree_ocp_qp
65 #define CORE_QP_IPM_WORKSPACE s_core_qp_ipm_workspace
66 #define CREATE_TREE_OCP_QP_RES s_create_tree_ocp_qp_res
67 #define CREATE_TREE_OCP_QP_SOL s_create_tree_ocp_qp_sol
68 #define CREATE_STRMAT blasfeo_create_smat
69 #define CREATE_STRVEC blasfeo_create_svec
70 #define CREATE_CORE_QP_IPM s_create_core_qp_ipm
71 #define FACT_LQ_SOLVE_KKT_STEP_TREE_OCP_QP s_fact_lq_solve_kkt_step_tree_ocp_qp
72 #define FACT_SOLVE_KKT_STEP_TREE_OCP_QP s_fact_solve_kkt_step_tree_ocp_qp
73 #define FACT_SOLVE_KKT_UNCONSTR_TREE_OCP_QP s_fact_solve_kkt_unconstr_tree_ocp_qp
74 #define GELQF_WORKSIZE blasfeo_sgelqf_worksize
75 #define INIT_VAR_TREE_OCP_QP s_init_var_tree_ocp_qp
76 #define MEMSIZE_CORE_QP_IPM s_memsize_core_qp_ipm
77 #define MEMSIZE_TREE_OCP_QP_RES s_memsize_tree_ocp_qp_res
78 #define MEMSIZE_TREE_OCP_QP_SOL s_memsize_tree_ocp_qp_sol
79 #define REAL float
80 #define SIZE_STRMAT blasfeo_memsize_smat
81 #define SIZE_STRVEC blasfeo_memsize_svec
82 #define SOLVE_KKT_STEP_TREE_OCP_QP s_solve_kkt_step_tree_ocp_qp
83 #define STRMAT blasfeo_smat
84 #define STRVEC blasfeo_svec
85 #define TREE_OCP_QP s_tree_ocp_qp
86 #define TREE_OCP_QP_DIM s_tree_ocp_qp_dim
87 #define TREE_OCP_QP_IPM_ARG s_tree_ocp_qp_ipm_arg
88 #define HPIPM_MODE hpipm_mode
89 #define TREE_OCP_QP_IPM_WORKSPACE s_tree_ocp_qp_ipm_workspace
90 #define TREE_OCP_QP_RES s_tree_ocp_qp_res
91 #define TREE_OCP_QP_RES_WORKSPACE s_tree_ocp_qp_res_workspace
92 #define TREE_OCP_QP_SOL s_tree_ocp_qp_sol
93 #define UPDATE_VAR_QP s_update_var_qp
94 #define VECMULDOT blasfeo_svecmuldot
95 #define VECNRM_INF blasfeo_svecnrm_inf
96 #define VECSC blasfeo_svecsc
97 
98 #define MEMSIZE_TREE_OCP_QP_IPM_ARG s_memsize_tree_ocp_qp_ipm_arg
99 #define CREATE_TREE_OCP_QP_IPM_ARG s_create_tree_ocp_qp_ipm_arg
100 #define SET_DEFAULT_TREE_OCP_QP_IPM_ARG s_set_default_tree_ocp_qp_ipm_arg
101 #define SET_TREE_OCP_QP_IPM_ARG_ITER_MAX s_set_tree_ocp_qp_ipm_arg_iter_max
102 #define SET_TREE_OCP_QP_IPM_ARG_MU0 s_set_tree_ocp_qp_ipm_arg_mu0
103 #define SET_TREE_OCP_QP_IPM_ARG_TOL_STAT s_set_tree_ocp_qp_ipm_arg_tol_stat
104 #define SET_TREE_OCP_QP_IPM_ARG_TOL_EQ s_set_tree_ocp_qp_ipm_arg_tol_eq
105 #define SET_TREE_OCP_QP_IPM_ARG_TOL_INEQ s_set_tree_ocp_qp_ipm_arg_tol_ineq
106 #define SET_TREE_OCP_QP_IPM_ARG_TOL_COMP s_set_tree_ocp_qp_ipm_arg_tol_comp
107 #define SET_TREE_OCP_QP_IPM_ARG_REG_PRIM s_set_tree_ocp_qp_ipm_arg_reg_prim
108 // ipm
109 #define MEMSIZE_TREE_OCP_QP_IPM s_memsize_tree_ocp_qp_ipm
110 #define CREATE_TREE_OCP_QP_IPM s_create_tree_ocp_qp_ipm
111 #define GET_TREE_OCP_QP_IPM_ITER s_get_tree_ocp_qp_ipm_iter
112 #define GET_TREE_OCP_QP_IPM_RES_STAT s_get_tree_ocp_qp_ipm_res_stat
113 #define GET_TREE_OCP_QP_IPM_RES_EQ s_get_tree_ocp_qp_ipm_res_eq
114 #define GET_TREE_OCP_QP_IPM_RES_INEQ s_get_tree_ocp_qp_ipm_res_ineq
115 #define GET_TREE_OCP_QP_IPM_RES_COMP s_get_tree_ocp_qp_ipm_res_comp
116 #define GET_TREE_OCP_QP_IPM_STAT s_get_tree_ocp_qp_ipm_stat
117 #define SOLVE_TREE_OCP_QP_IPM s_solve_tree_ocp_qp_ipm
118 #define SOLVE_TREE_OCP_QP_IPM2 s_solve_tree_ocp_qp_ipm2
119 
120 
121 
122 #include "x_tree_ocp_qp_ipm.c"
123 
124