1 /* 2 * This file is part of qpOASES. 3 * 4 * qpOASES -- An Implementation of the Online Active Set Strategy. 5 * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka, 6 * Christian Kirches et al. All rights reserved. 7 * 8 * qpOASES is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * qpOASES is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 * See the GNU Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with qpOASES; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 */ 23 24 25 /** 26 * \file include/qpOASES/extras/SolutionAnalysis.hpp 27 * \author Hans Joachim Ferreau (thanks to Boris Houska) 28 * \version 3.2 29 * \date 2008-2015 30 * 31 * Declaration of the SolutionAnalysis class designed to perform 32 * additional analysis after solving a QP with qpOASES. 33 */ 34 35 36 #ifndef QPOASES_SOLUTIONANALYSIS_HPP 37 #define QPOASES_SOLUTIONANALYSIS_HPP 38 39 40 #include <qpOASES/SQProblem.hpp> 41 #include <qpOASES/SQProblemSchur.hpp> 42 43 44 BEGIN_NAMESPACE_QPOASES 45 46 47 /** 48 * \brief Provides additional tools for analysing QP solutions. 49 * 50 * This class is intended to provide additional tools for analysing 51 * a QP solution obtained with qpOASES. 52 * 53 * \author Hans Joachim Ferreau (thanks to Boris Houska) 54 * \version 3.2 55 * \date 2008-2015 56 */ 57 class SolutionAnalysis 58 { 59 /* 60 * PUBLIC MEMBER FUNCTIONS 61 */ 62 public: 63 /** Default constructor. */ 64 SolutionAnalysis( ); 65 66 /** Copy constructor (deep copy). */ 67 SolutionAnalysis( const SolutionAnalysis& rhs /**< Rhs object. */ 68 ); 69 70 /** Destructor. */ 71 ~SolutionAnalysis( ); 72 73 /** Assignment operator (deep copy). */ 74 SolutionAnalysis& operator=( const SolutionAnalysis& rhs /**< Rhs object. */ 75 ); 76 77 78 /** Computes the maximum violation of the KKT optimality conditions 79 * of the current iterate within the QProblemB object. 80 * \return Maximum violation of the KKT conditions (or INFTY on error). */ 81 real_t getKktViolation( QProblemB* const qp, /**< QProblemB to be analysed. */ 82 real_t* const maxStat = 0, /**< Output: maximum value of stationarity condition residual. */ 83 real_t* const maxFeas = 0, /**< Output: maximum value of primal feasibility violation. */ 84 real_t* const maxCmpl = 0 /**< Output: maximum value of complementarity residual. */ 85 ) const; 86 87 /** Computes the maximum violation of the KKT optimality conditions 88 * of the current iterate within the QProblem object. 89 * \return Maximum violation of the KKT conditions (or INFTY on error). */ 90 real_t getKktViolation( QProblem* const qp, /**< QProblem to be analysed. */ 91 real_t* const maxStat = 0, /**< Output: maximum value of stationarity condition residual. */ 92 real_t* const maxFeas = 0, /**< Output: maximum value of primal feasibility violation. */ 93 real_t* const maxCmpl = 0 /**< Output: maximum value of complementarity residual. */ 94 ) const; 95 96 /** Computes the maximum violation of the KKT optimality conditions 97 * of the current iterate within the SQProblem object. 98 * \return Maximum violation of the KKT conditions (or INFTY on error). */ 99 real_t getKktViolation( SQProblem* const qp, /**< SQProblem to be analysed. */ 100 real_t* const maxStat = 0, /**< Output: maximum value of stationarity condition residual. */ 101 real_t* const maxFeas = 0, /**< Output: maximum value of primal feasibility violation. */ 102 real_t* const maxCmpl = 0 /**< Output: maximum value of complementarity residual. */ 103 ) const; 104 105 106 /** Computes the variance-covariance matrix of the QP output for uncertain 107 inputs. 108 * \return SUCCESSFUL_RETURN \n 109 RET_HOTSTART_FAILED \n 110 RET_STEPDIRECTION_FAILED_TQ \n 111 RET_STEPDIRECTION_FAILED_CHOLESKY */ 112 returnValue getVarianceCovariance( QProblemB* const qp, /**< QProblemB to be analysed. */ 113 const real_t* const g_b_bA_VAR, /**< Input: Variance-covariance of g, the bounds lb and ub, 114 * and lbA and ubA respectively. Dimension: 2nV x 2nV */ 115 real_t* const Primal_Dual_VAR /**< Output: The result for the variance-covariance of the primal 116 * and dual variables. Dimension: 2nV x 2nV */ 117 ) const; 118 119 /** Computes the variance-covariance matrix of the QP output for uncertain 120 inputs. 121 * \return SUCCESSFUL_RETURN \n 122 RET_HOTSTART_FAILED \n 123 RET_STEPDIRECTION_FAILED_TQ \n 124 RET_STEPDIRECTION_FAILED_CHOLESKY */ 125 returnValue getVarianceCovariance( QProblem* const qp, /**< QProblem to be analysed. */ 126 const real_t* const g_b_bA_VAR, /**< Input: Variance-covariance of g, the bounds lb and ub, 127 * and lbA and ubA respectively. Dimension: (2nV+nC) x (2nV+nC) */ 128 real_t* const Primal_Dual_VAR /**< Output: The result for the variance-covariance of the primal 129 * and dual variables. Dimension: (2nV+nC) x (2nV+nC) */ 130 ) const; 131 132 /** Computes the variance-covariance matrix of the QP output for uncertain 133 inputs. 134 * \return SUCCESSFUL_RETURN \n 135 RET_HOTSTART_FAILED \n 136 RET_STEPDIRECTION_FAILED_TQ \n 137 RET_STEPDIRECTION_FAILED_CHOLESKY */ 138 returnValue getVarianceCovariance( SQProblem* const qp, /**< SQProblem to be analysed. */ 139 const real_t* const g_b_bA_VAR, /**< Input: Variance-covariance of g, the bounds lb and ub, 140 * and lbA and ubA respectively. Dimension: (2nV+nC) x (2nV+nC) */ 141 real_t* const Primal_Dual_VAR /**< Output: The result for the variance-covariance of the primal 142 * and dual variables. Dimension: (2nV+nC) x (2nV+nC) */ 143 ) const; 144 145 /** Checks if a direction of negative curvature shows up if we remove all bounds that just recently became active */ 146 returnValue checkCurvatureOnStronglyActiveConstraints( SQProblemSchur* qp ); 147 returnValue checkCurvatureOnStronglyActiveConstraints( SQProblem* qp ); 148 149 /* 150 * PROTECTED MEMBER VARIABLES 151 */ 152 protected: 153 154 }; 155 156 157 END_NAMESPACE_QPOASES 158 159 #include <qpOASES/extras/SolutionAnalysis.ipp> 160 161 #endif /* QPOASES_SOLUTIONANALYSIS_HPP */ 162 163 164 /* 165 * end of file 166 */ 167