qpOASES 3.2.1
An Implementation of the Online Active Set Strategy
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-2017 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:
108};
109
110
112
int int_t
Definition Types.hpp:180
BEGIN_NAMESPACE_QPOASES typedef double real_t
Definition Types.hpp:171
#define END_NAMESPACE_QPOASES
Definition Types.hpp:110
#define BEGIN_NAMESPACE_QPOASES
Definition Types.hpp:107
Interface for specifying user-defined evaluations of constraint products.
Definition ConstraintProduct.hpp:58
Example illustrating the use of the ConstraintProduct class.
Definition example4CP.cpp:48
real_t * A
Definition example4CP.cpp:107
int_t nV
Definition example4CP.cpp:105
MyConstraintProduct()
Definition example4CP.cpp:51
virtual int_t operator()(int_t constrIndex, const real_t *const x, real_t *const constrValue) const
Definition example4CP.cpp:89
MyConstraintProduct(const MyConstraintProduct &rhs)
Definition example4CP.cpp:65
virtual ~MyConstraintProduct()
Definition example4CP.cpp:74
MyConstraintProduct(int_t _nV, int_t _nC, real_t *_A)
Definition example4CP.cpp:54
int_t nC
Definition example4CP.cpp:106
MyConstraintProduct & operator=(const MyConstraintProduct &rhs)
Definition example4CP.cpp:77