example4CP.cpp
Go to the documentation of this file.
00001 /*
00002  *      This file is part of qpOASES.
00003  *
00004  *      qpOASES -- An Implementation of the Online Active Set Strategy.
00005  *      Copyright (C) 2007-2011 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 BEGIN_NAMESPACE_QPOASES
00036 
00037 
00047 class MyConstraintProduct : public ConstraintProduct
00048 {
00049         public:
00050                 MyConstraintProduct( ) {};
00051 
00052                 MyConstraintProduct(    int _nV,
00053                                                                 int _nC,
00054                                                                 real_t* _A
00055                                                                 )
00056                 {
00057                         nV = _nV;
00058                         nC = _nC;
00059                         A  = _A;
00060                 };
00061 
00062                 MyConstraintProduct(    const MyConstraintProduct &rhs
00063                                                                 )
00064                 {
00065                         nV = rhs.nV;
00066                         nC = rhs.nC;
00067                         A  = rhs.A;
00068                 };
00069 
00070                 virtual ~MyConstraintProduct( ) {};
00071                 
00072                 MyConstraintProduct &operator=( const MyConstraintProduct &rhs
00073                                                                                 )
00074                 {
00075                         if ( this != &rhs )
00076                         {
00077                                 nV = rhs.nV;
00078                                 nC = rhs.nC;
00079                                 A  = rhs.A;
00080                         }
00081                         else
00082                                 return *this;
00083                 }
00084 
00085                 virtual int operator() (        int constrIndex,
00086                                                                         const real_t* const x,
00087                                                                         real_t* const constrValue
00088                                                                         ) const
00089                 {
00090                         constrValue[0] = 1.0 * x[(constrIndex/10)+2];
00091 
00092                         for( int i=0; i<2; ++i )
00093                                 constrValue[0] += A[constrIndex*nV + i] * x[i];
00094 
00095                         return 0;
00096                 };
00097 
00098         protected:
00099                 int nV;
00100                 int nC;
00101                 real_t* A;
00102 };
00103 
00104 
00105 END_NAMESPACE_QPOASES
00106 


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:37:01