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 #ifndef HPIPM_S_OCP_QP_RES_H_ 37 #define HPIPM_S_OCP_QP_RES_H_ 38 39 40 41 #include <blasfeo_target.h> 42 #include <blasfeo_common.h> 43 44 #include <hpipm_common.h> 45 #include <hpipm_s_ocp_qp_dim.h> 46 #include <hpipm_s_ocp_qp.h> 47 #include <hpipm_s_ocp_qp_sol.h> 48 49 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 56 57 struct s_ocp_qp_res 58 { 59 struct s_ocp_qp_dim *dim; 60 struct blasfeo_svec *res_g; // q-residuals 61 struct blasfeo_svec *res_b; // b-residuals 62 struct blasfeo_svec *res_d; // d-residuals 63 struct blasfeo_svec *res_m; // m-residuals 64 double res_mu; // mu-residual 65 float max_res_stat; 66 float max_res_eq; 67 float max_res_ineq; 68 float max_res_comp; 69 int memsize; 70 }; 71 72 73 74 struct s_ocp_qp_res_ws 75 { 76 struct blasfeo_svec *tmp_nbgM; // work space of size nbM+ngM 77 struct blasfeo_svec *tmp_nsM; // work space of size nsM 78 int memsize; 79 }; 80 81 82 83 // 84 int s_ocp_qp_res_memsize(struct s_ocp_qp_dim *ocp_dim); 85 // 86 void s_ocp_qp_res_create(struct s_ocp_qp_dim *ocp_dim, struct s_ocp_qp_res *res, void *mem); 87 // 88 int s_ocp_qp_res_ws_memsize(struct s_ocp_qp_dim *ocp_dim); 89 // 90 void s_ocp_qp_res_ws_create(struct s_ocp_qp_dim *ocp_dim, struct s_ocp_qp_res_ws *workspace, void *mem); 91 // 92 void s_ocp_qp_res_compute(struct s_ocp_qp *qp, struct s_ocp_qp_sol *qp_sol, struct s_ocp_qp_res *res, struct s_ocp_qp_res_ws *ws); 93 // 94 void s_ocp_qp_res_compute_lin(struct s_ocp_qp *qp, struct s_ocp_qp_sol *qp_sol, struct s_ocp_qp_sol *qp_step, struct s_ocp_qp_res *res, struct s_ocp_qp_res_ws *ws); 95 // 96 void s_ocp_qp_res_compute_max(struct s_ocp_qp_res *res, struct s_ocp_qp_res_ws *ws); 97 // 98 void s_ocp_qp_res_get_all(struct s_ocp_qp_res *res, float **res_r, float **res_q, float **res_ls, float **res_us, float **res_b, float **res_d_lb, float **res_d_ub, float **res_d_lg, float **res_d_ug, float **res_d_ls, float **res_d_us, float **res_m_lb, float **res_m_ub, float **res_m_lg, float **res_m_ug, float **res_m_ls, float **res_m_us); 99 // 100 void s_ocp_qp_res_get_max_res_stat(struct s_ocp_qp_res *res, float *value); 101 // 102 void s_ocp_qp_res_get_max_res_eq(struct s_ocp_qp_res *res, float *value); 103 // 104 void s_ocp_qp_res_get_max_res_ineq(struct s_ocp_qp_res *res, float *value); 105 // 106 void s_ocp_qp_res_get_max_res_comp(struct s_ocp_qp_res *res, float *value); 107 108 109 110 #ifdef __cplusplus 111 } // #extern "C" 112 #endif 113 114 115 #endif // HPIPM_S_OCP_QP_RES_H_ 116 117 118