mhe_algorithm.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
35 
36 
38 
39 
40 
41 //
42 // PUBLIC MEMBER FUNCTIONS:
43 //
44 
45 
48 
49  eta = 0;
50  S = 0;
51 
52 // set( HESSIAN_APPROXIMATION, GAUSS_NEWTON );
53 // set( USE_REALTIME_ITERATIONS,BT_TRUE );
54 // set( MAX_NUM_ITERATIONS,1 );
55 
56 }
57 
58 
60  :OptimizationAlgorithm( ocp_ ){
61 
62  eta = 0;
63  S = 0;
64 }
65 
66 
68  :OptimizationAlgorithm( arg ){
69 
70  if( arg.eta != 0 ) eta = new DVector(*arg.eta);
71  else eta = 0 ;
72 
73  if( arg.S != 0 ) S = new DMatrix(*arg.S) ;
74  else S = 0 ;
75 }
76 
77 
79 
80  if( eta != 0 ) delete eta;
81  if( S != 0 ) delete S ;
82 }
83 
84 
86 
87  if( this != &arg ){
88 
89  if( eta != 0 ) delete eta;
90  if( S != 0 ) delete S ;
91 
93 
94  if( arg.eta != 0 ) eta = new DVector(*arg.eta);
95  else eta = 0 ;
96 
97  if( arg.S != 0 ) S = new DMatrix(*arg.S) ;
98  else S = 0 ;
99  }
100  return *this;
101 }
102 
103 
104 returnValue MHEalgorithm::init( const DVector &eta_, const DMatrix &S_ ){
105 
106  if( eta != 0 ) delete eta;
107  if( S != 0 ) delete S ;
108 
109  eta = new DVector(eta_);
110  S = new DMatrix(S_ );
111 
112  return OptimizationAlgorithm::init( );
113 }
114 
115 
116 returnValue MHEalgorithm::step( const DVector &eta_, const DMatrix &S_ ){
117 
119 }
120 
121 
123 
125 }
126 
127 
128 returnValue MHEalgorithm::solve( const DVector &eta_, const DMatrix &S_ ){
129 
130  if ( status == BS_NOT_INITIALIZED ){
131  if( init( eta_, S_ ) != SUCCESSFUL_RETURN )
133  }
134 
135  if ( status != BS_READY )
137 
138 
139  returnValue returnvalue = nlpSolver->solve( );
140 
141 // if( ( returnvalue != SUCCESSFUL_RETURN ) &&
142 // ( returnvalue != CONVERGENCE_ACHIEVED ) &&
143 // ( returnvalue != RET_MAX_NUMBER_OF_STEPS_EXCEEDED ) ) return ACADOERROR(returnvalue);
144 
145  return returnvalue;
146 }
147 
148 
149 
151 {
152  return OptimizationAlgorithm::initializeNlpSolver( _userInit );
153 }
154 
155 
157  )
158 {
159  return SUCCESSFUL_RETURN;
160 }
161 
162 
163 
165 
166 // end of file.
virtual returnValue initializeNlpSolver(const OCPiterate &_userInit)
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
MHEalgorithm & operator=(const MHEalgorithm &arg)
virtual returnValue initializeObjective(Objective *F)
User-interface to formulate and solve optimal control problems and static NLPs.
virtual ~MHEalgorithm()
Allows to pass back messages to the calling function.
virtual returnValue solve(const DVector &x0_=emptyConstVector, const DVector &p_=emptyConstVector)
Definition: nlp_solver.cpp:82
virtual returnValue init()
#define CLOSE_NAMESPACE_ACADO
GenericMatrix< double > DMatrix
Definition: matrix.hpp:457
virtual returnValue shift()
virtual returnValue initializeNlpSolver(const OCPiterate &_userInit)
Data class for defining optimal control problems.
Definition: ocp.hpp:89
GenericVector< double > DVector
Definition: vector.hpp:329
#define BEGIN_NAMESPACE_ACADO
virtual returnValue step(const DVector &eta, const DMatrix &S)
OptimizationAlgorithm & operator=(const OptimizationAlgorithm &arg)
virtual returnValue solve()
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123
#define ACADOERROR(retval)
User-interface to formulate and solve moving horizon estimation problems.


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