qpOASES-3.2.0/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-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 
36 
37 
48 {
49  public:
52 
55  int_t _nC,
56  real_t* _A
57  )
58  {
59  nV = _nV;
60  nC = _nC;
61  A = _A;
62  };
63 
66  )
67  {
68  nV = rhs.nV;
69  nC = rhs.nC;
70  A = rhs.A;
71  };
72 
74  virtual ~MyConstraintProduct( ) {};
75 
78  )
79  {
80  if ( this != &rhs )
81  {
82  nV = rhs.nV;
83  nC = rhs.nC;
84  A = rhs.A;
85  }
86  return *this;
87  };
88 
89  virtual int_t operator() ( int_t constrIndex,
90  const real_t* const x,
91  real_t* const constrValue
92  ) const
93  {
94  int_t i;
95 
96  constrValue[0] = 1.0 * x[(constrIndex/10)+2];
97 
98  for( i=0; i<2; ++i )
99  constrValue[0] += A[constrIndex*nV + i] * x[i];
100 
101  return 0;
102  };
103 
104  protected:
105  int_t nV;
107  real_t* A;
108 };
109 
110 
112 
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
MyConstraintProduct(int_t _nV, int_t _nC, real_t *_A)
Example illustrating the use of the ConstraintProduct class.
MyConstraintProduct & operator=(const MyConstraintProduct &rhs)
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