qpOASES
3.2.1
An Implementation of the Online Active Set Strategy
|
00001 /* 00002 * This file is part of qpOASES. 00003 * 00004 * qpOASES -- An Implementation of the Online Active Set Strategy. 00005 * Copyright (C) 2007-2017 by Hans Joachim Ferreau, Andreas Potschka, 00006 * Christian Kirches et al. All rights reserved. 00007 * 00008 * qpOASES is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * qpOASES is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with qpOASES; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 */ 00023 00024 00035 #ifndef QPOASES_SPARSESOLVER_HPP 00036 #define QPOASES_SPARSESOLVER_HPP 00037 00038 #include <qpOASES/Utils.hpp> 00039 00040 00041 BEGIN_NAMESPACE_QPOASES 00042 00043 00052 class SparseSolver 00053 { 00054 /* 00055 * PUBLIC MEMBER FUNCTIONS 00056 */ 00057 public: 00059 SparseSolver( ); 00060 00062 SparseSolver( const SparseSolver& rhs 00063 ); 00064 00066 virtual ~SparseSolver( ); 00067 00069 virtual SparseSolver& operator=( const SparseSolver& rhs 00070 ); 00071 00075 virtual returnValue setMatrixData( int_t dim, 00076 int_t numNonzeros, 00077 const int_t* const airn, 00078 const int_t* const acjn, 00079 const real_t* const avals 00080 ) = 0; 00081 00083 virtual returnValue factorize( ) = 0; 00084 00086 virtual returnValue solve( int_t dim, 00087 const real_t* const rhs, 00088 real_t* const sol 00089 ) = 0; 00090 00092 virtual returnValue reset( ); 00093 00095 virtual int_t getNegativeEigenvalues( ); 00096 00098 virtual int_t getRank( ); 00099 00101 virtual returnValue getZeroPivots( int_t *&zeroPivots ); 00102 00103 /* 00104 * PROTECTED MEMBER FUNCTIONS 00105 */ 00106 protected: 00109 returnValue clear( ); 00110 00113 returnValue copy( const SparseSolver& rhs 00114 ); 00115 00116 /* 00117 * PROTECTED MEMBER VARIABLES 00118 */ 00119 protected: 00120 }; 00121 00122 00123 #ifdef SOLVER_MA27 00124 00132 class Ma27SparseSolver: public SparseSolver 00133 { 00134 /* 00135 * PUBLIC MEMBER FUNCTIONS 00136 */ 00137 public: 00139 Ma27SparseSolver( ); 00140 00142 Ma27SparseSolver( const Ma27SparseSolver& rhs 00143 ); 00144 00146 virtual ~Ma27SparseSolver( ); 00147 00149 virtual Ma27SparseSolver& operator=( const SparseSolver& rhs 00150 ); 00151 00155 virtual returnValue setMatrixData( int_t dim, 00156 int_t numNonzeros, 00157 const int_t* const airn, 00158 const int_t* const acjn, 00159 const real_t* const avals 00160 ); 00161 00163 virtual returnValue factorize( ); 00164 00166 virtual returnValue solve( int_t dim, 00167 const real_t* const rhs, 00168 real_t* const sol 00169 ); 00170 00172 virtual returnValue reset( ); 00173 00175 virtual int_t getNegativeEigenvalues( ); 00176 00178 virtual int getRank( ); 00179 00180 /* 00181 * PROTECTED MEMBER FUNCTIONS 00182 */ 00183 protected: 00186 returnValue clear( ); 00187 00190 returnValue copy( const Ma27SparseSolver& rhs 00191 ); 00192 00193 /* 00194 * PRIVATE MEMBER FUNCTIONS 00195 */ 00196 private: 00197 /* 00198 * PRIVATE MEMBER VARIABLES 00199 */ 00200 private: 00201 fint_t dim; 00203 fint_t numNonzeros; 00205 fint_t la_ma27; 00207 double* a_ma27; 00209 fint_t* irn_ma27; 00211 fint_t* jcn_ma27; 00213 fint_t icntl_ma27[30]; 00215 double cntl_ma27[5]; 00217 fint_t liw_ma27; 00219 fint_t* iw_ma27; 00221 fint_t* ikeep_ma27; 00223 fint_t nsteps_ma27; 00225 fint_t maxfrt_ma27; 00227 bool have_factorization; 00229 fint_t neig; 00231 fint_t rank; 00232 }; 00233 00234 #endif /* SOLVER_MA27 */ 00235 00236 00237 #ifdef SOLVER_MA57 00238 00246 class Ma57SparseSolver: public SparseSolver 00247 { 00248 /* 00249 * PUBLIC MEMBER FUNCTIONS 00250 */ 00251 public: 00253 Ma57SparseSolver( ); 00254 00256 Ma57SparseSolver( const Ma57SparseSolver& rhs 00257 ); 00258 00260 virtual ~Ma57SparseSolver( ); 00261 00263 virtual Ma57SparseSolver& operator=( const SparseSolver& rhs 00264 ); 00265 00269 virtual returnValue setMatrixData( int_t dim, 00270 int_t numNonzeros, 00271 const int_t* const airn, 00272 const int_t* const acjn, 00273 const real_t* const avals 00274 ); 00275 00277 virtual returnValue factorize( ); 00278 00280 virtual returnValue solve( int_t dim, 00281 const real_t* const rhs, 00282 real_t* const sol 00283 ); 00284 00286 virtual returnValue reset( ); 00287 00289 virtual int_t getNegativeEigenvalues( ); 00290 00292 virtual int_t getRank( ); 00293 00295 virtual returnValue getZeroPivots( int_t* &zeroPivots 00296 ); 00297 /* 00298 * PROTECTED MEMBER FUNCTIONS 00299 */ 00300 protected: 00303 returnValue clear( ); 00304 00307 returnValue copy( const Ma57SparseSolver& rhs 00308 ); 00309 00310 /* 00311 * PRIVATE MEMBER FUNCTIONS 00312 */ 00313 private: 00314 /* 00315 * PRIVATE MEMBER VARIABLES 00316 */ 00317 private: 00318 fint_t dim; 00320 fint_t numNonzeros; 00322 double* a_ma57; 00324 fint_t* irn_ma57; 00326 fint_t* jcn_ma57; 00328 fint_t icntl_ma57[30]; 00330 double cntl_ma57[5]; 00332 double* fact_ma57; 00334 fint_t lfact_ma57; 00336 fint_t* ifact_ma57; 00338 fint_t lifact_ma57; 00340 bool have_factorization; 00342 fint_t neig; 00344 fint_t rank; 00346 fint_t* pivots; 00347 }; 00348 00349 #endif /* SOLVER_MA57 */ 00350 00351 00352 #ifdef SOLVER_NONE 00353 00361 class DummySparseSolver: public SparseSolver 00362 { 00363 /* 00364 * PUBLIC MEMBER FUNCTIONS 00365 */ 00366 public: 00370 virtual returnValue setMatrixData( int_t dim, 00371 int_t numNonzeros, 00372 const int_t* const airn, 00373 const int_t* const acjn, 00374 const real_t* const avals 00375 ); 00376 00378 virtual returnValue factorize( ); 00379 00381 virtual returnValue solve( int_t dim, 00382 const real_t* const rhs, 00383 real_t* const sol 00384 ); 00385 }; 00386 00387 #endif /* SOLVER_NONE */ 00388 00389 00390 END_NAMESPACE_QPOASES 00391 00392 #endif /* QPOASES_SPARSESOLVER_HPP */ 00393 00394 /* 00395 * end of file 00396 */