mhe_algorithm.cpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00034 #include <acado/optimization_algorithm/mhe_algorithm.hpp>
00035 
00036 
00037 BEGIN_NAMESPACE_ACADO
00038 
00039 
00040 
00041 //
00042 // PUBLIC MEMBER FUNCTIONS:
00043 //
00044 
00045 
00046 MHEalgorithm::MHEalgorithm()
00047              :OptimizationAlgorithm(){
00048 
00049     eta = 0;
00050     S   = 0;
00051 
00052 //  set( HESSIAN_APPROXIMATION, GAUSS_NEWTON );
00053 //  set( USE_REALTIME_ITERATIONS,BT_TRUE );
00054 //  set( MAX_NUM_ITERATIONS,1 );
00055 
00056 }
00057 
00058 
00059 MHEalgorithm::MHEalgorithm( const OCP& ocp_ )
00060              :OptimizationAlgorithm( ocp_ ){
00061 
00062     eta = 0;
00063     S   = 0;
00064 }
00065 
00066 
00067 MHEalgorithm::MHEalgorithm( const MHEalgorithm& arg )
00068              :OptimizationAlgorithm( arg ){
00069 
00070     if( arg.eta != 0 ) eta = new DVector(*arg.eta);
00071     else               eta = 0                   ;
00072 
00073     if( arg.S  != 0 )  S   = new DMatrix(*arg.S)  ;
00074     else               S   = 0                   ;
00075 }
00076 
00077 
00078 MHEalgorithm::~MHEalgorithm( ){
00079 
00080     if( eta  != 0 ) delete eta;
00081     if( S    != 0 ) delete S  ;
00082 }
00083 
00084 
00085 MHEalgorithm& MHEalgorithm::operator=( const MHEalgorithm& arg ){
00086 
00087     if( this != &arg ){
00088 
00089         if( eta  != 0 ) delete eta;
00090         if( S    != 0 ) delete S  ;
00091 
00092         OptimizationAlgorithm::operator=(arg);
00093 
00094         if( arg.eta != 0 ) eta = new DVector(*arg.eta);
00095         else               eta = 0                   ;
00096 
00097         if( arg.S  != 0 )  S   = new DMatrix(*arg.S)  ;
00098         else               S   = 0                   ;
00099     }
00100     return *this;
00101 }
00102 
00103 
00104 returnValue MHEalgorithm::init( const DVector &eta_, const DMatrix &S_ ){
00105 
00106     if( eta  != 0 ) delete eta;
00107     if( S    != 0 ) delete S  ;
00108 
00109     eta = new DVector(eta_);
00110     S   = new DMatrix(S_  );
00111 
00112     return OptimizationAlgorithm::init( );
00113 }
00114 
00115 
00116 returnValue MHEalgorithm::step( const DVector &eta_, const DMatrix &S_ ){
00117 
00118     return ACADOERROR(RET_NOT_IMPLEMENTED_YET);
00119 }
00120 
00121 
00122 returnValue MHEalgorithm::shift( ){
00123 
00124     return ACADOERROR(RET_NOT_IMPLEMENTED_YET);
00125 }
00126 
00127 
00128 returnValue MHEalgorithm::solve( const DVector &eta_, const DMatrix &S_ ){
00129 
00130     if ( status == BS_NOT_INITIALIZED ){
00131          if( init( eta_, S_ ) != SUCCESSFUL_RETURN )
00132              return ACADOERROR( RET_OPTALG_INIT_FAILED );
00133     }
00134 
00135     if ( status != BS_READY )
00136         return ACADOERROR( RET_OPTALG_INIT_FAILED );
00137 
00138 
00139     returnValue returnvalue = nlpSolver->solve( );
00140 
00141 //     if( ( returnvalue != SUCCESSFUL_RETURN ) &&
00142 //         ( returnvalue != CONVERGENCE_ACHIEVED ) &&
00143 //         ( returnvalue != RET_MAX_NUMBER_OF_STEPS_EXCEEDED ) ) return ACADOERROR(returnvalue);
00144 
00145     return returnvalue;
00146 }
00147 
00148 
00149 
00150 returnValue MHEalgorithm::initializeNlpSolver(  const OCPiterate& _userInit )
00151 {
00152    return OptimizationAlgorithm::initializeNlpSolver( _userInit );
00153 }
00154 
00155 
00156 returnValue MHEalgorithm::initializeObjective(  Objective* F
00157                                                                                                 )
00158 {
00159         return SUCCESSFUL_RETURN;
00160 }
00161 
00162 
00163 
00164 CLOSE_NAMESPACE_ACADO
00165 
00166 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:20