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/parameter_estimation_algorithm.hpp> 00035 00036 00037 00038 BEGIN_NAMESPACE_ACADO 00039 00040 00041 00042 // 00043 // PUBLIC MEMBER FUNCTIONS: 00044 // 00045 00046 00047 ParameterEstimationAlgorithm::ParameterEstimationAlgorithm() 00048 :OptimizationAlgorithm(){ 00049 00050 set( HESSIAN_APPROXIMATION, GAUSS_NEWTON ); 00051 } 00052 00053 00054 ParameterEstimationAlgorithm::ParameterEstimationAlgorithm( const OCP& ocp_ ) 00055 :OptimizationAlgorithm( ocp_ ){ 00056 00057 set( HESSIAN_APPROXIMATION, GAUSS_NEWTON ); 00058 } 00059 00060 00061 ParameterEstimationAlgorithm::ParameterEstimationAlgorithm( const ParameterEstimationAlgorithm& arg ) 00062 :OptimizationAlgorithm( arg ){ 00063 00064 00065 } 00066 00067 00068 ParameterEstimationAlgorithm::~ParameterEstimationAlgorithm( ){ 00069 00070 } 00071 00072 00073 00074 ParameterEstimationAlgorithm& ParameterEstimationAlgorithm::operator=( const ParameterEstimationAlgorithm& arg ){ 00075 00076 if( this != &arg ){ 00077 00078 OptimizationAlgorithm::operator=(arg); 00079 } 00080 return *this; 00081 } 00082 00083 00084 returnValue ParameterEstimationAlgorithm::getParameterVarianceCovariance( DMatrix &pVar ){ 00085 00086 DMatrix tmp; 00087 returnValue returnvalue; 00088 int offset; 00089 int np; 00090 int run1,run2; 00091 00092 returnvalue = getVarianceCovariance( tmp ); 00093 if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue); 00094 00095 if( iter.p == 0 ){ 00096 pVar.init(0,0); 00097 return SUCCESSFUL_RETURN; 00098 } 00099 00100 offset = 0; 00101 00102 if( iter.x != 0 ) offset += iter.x->getNumValues(); 00103 if( iter.xa != 0 ) offset += iter.xa->getNumValues(); 00104 00105 np = iter.p->getNumValues(); 00106 pVar.init( np, np ); 00107 00108 for( run1 = 0; run1 < np; run1++ ) 00109 for( run2 = 0; run2 < np; run2++ ) 00110 pVar( run1, run2 ) = tmp( offset+run1, offset+run2 ); 00111 00112 return SUCCESSFUL_RETURN; 00113 } 00114 00115 00116 returnValue ParameterEstimationAlgorithm::getDifferentialStateVarianceCovariance( DMatrix &xVar ){ 00117 00118 return ACADOERROR(RET_NOT_IMPLEMENTED_YET); 00119 } 00120 00121 00122 returnValue ParameterEstimationAlgorithm::getAlgebraicStateVarianceCovariance( DMatrix &xaVar ){ 00123 00124 return ACADOERROR(RET_NOT_IMPLEMENTED_YET); 00125 } 00126 00127 00128 returnValue ParameterEstimationAlgorithm::getControlCovariance( DMatrix &uVar ){ 00129 00130 return ACADOERROR(RET_NOT_IMPLEMENTED_YET); 00131 } 00132 00133 00134 returnValue ParameterEstimationAlgorithm::getDistubanceVarianceCovariance( DMatrix &wVar ){ 00135 00136 return ACADOERROR(RET_NOT_IMPLEMENTED_YET); 00137 } 00138 00139 00140 returnValue ParameterEstimationAlgorithm::getVarianceCovariance( DMatrix &var ){ 00141 00142 if( nlpSolver == 0 ) return ACADOERROR( RET_MEMBER_NOT_INITIALISED ); 00143 return nlpSolver->getVarianceCovariance( var ); 00144 } 00145 00146 00147 00148 00149 // 00150 // PROTECTED MEMBER FUNCTIONS: 00151 // 00152 00153 returnValue ParameterEstimationAlgorithm::initializeNlpSolver( const OCPiterate& _userInit ) 00154 { 00155 return OptimizationAlgorithm::initializeNlpSolver( _userInit ); 00156 } 00157 00158 00159 returnValue ParameterEstimationAlgorithm::initializeObjective( Objective* F 00160 ) 00161 { 00162 return SUCCESSFUL_RETURN; 00163 } 00164 00165 00166 00167 00168 00169 00170 CLOSE_NAMESPACE_ACADO 00171 00172 // end of file.