qpOASES-3.0beta/examples/example4CP.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2011 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 
36 
37 
48 {
49  public:
51 
53  int _nC,
54  real_t* _A
55  )
56  {
57  nV = _nV;
58  nC = _nC;
59  A = _A;
60  };
61 
63  )
64  {
65  nV = rhs.nV;
66  nC = rhs.nC;
67  A = rhs.A;
68  };
69 
70  virtual ~MyConstraintProduct( ) {};
71 
73  )
74  {
75  if ( this != &rhs )
76  {
77  nV = rhs.nV;
78  nC = rhs.nC;
79  A = rhs.A;
80  }
81  else
82  return *this;
83  }
84 
85  virtual int operator() ( int constrIndex,
86  const real_t* const x,
87  real_t* const constrValue
88  ) const
89  {
90  constrValue[0] = 1.0 * x[(constrIndex/10)+2];
91 
92  for( int i=0; i<2; ++i )
93  constrValue[0] += A[constrIndex*nV + i] * x[i];
94 
95  return 0;
96  };
97 
98  protected:
99  int nV;
100  int nC;
102 };
103 
104 
106 
Interface for specifying user-defined evaluations of constraint products.
MyConstraintProduct(const MyConstraintProduct &rhs)
virtual int operator()(int constrIndex, const real_t *const x, real_t *const constrValue) const
Example illustrating the use of the ConstraintProduct class.
MyConstraintProduct & operator=(const MyConstraintProduct &rhs)
MyConstraintProduct(int _nV, int _nC, real_t *_A)
void rhs(const real_t *x, real_t *f)
double real_t
Definition: AD_test.c:10


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:33