scp_step.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 #include <acado/curve/curve.hpp>
37 
38 
40 
41 
42 //
43 // PUBLIC MEMBER FUNCTIONS:
44 //
45 
47 {
48  setupOptions( );
49  setupLogging( );
50 
52 }
53 
54 
55 SCPstep::SCPstep( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction )
56 {
57  // setup options and loggings for stand-alone instances
58  if ( _userInteraction == 0 )
59  {
60  setupOptions( );
61  setupLogging( );
62  }
63 
64  meritFcn = new SCPmeritFunction( _userInteraction );
65 }
66 
67 
69 {
70  if( rhs.meritFcn != 0 ) meritFcn = new SCPmeritFunction( *(rhs.meritFcn) );
71  else meritFcn = 0;
72 }
73 
74 
76 {
77  if( meritFcn != 0 )
78  delete meritFcn;
79 }
80 
81 
83 {
84  if ( this != &rhs )
85  {
86  if( meritFcn != 0 )
87  delete meritFcn;
88 
90 
91  if( rhs.meritFcn != 0 ) meritFcn = new SCPmeritFunction( *(rhs.meritFcn) );
92  else meritFcn = 0;
93  }
94 
95  return *this;
96 }
97 
98 
99 
100 //
101 // PROTECTED MEMBER FUNCTIONS:
102 //
103 
105 {
106  return SUCCESSFUL_RETURN;
107 }
108 
109 
111 {
112  return SUCCESSFUL_RETURN;
113 }
114 
115 
117  BandedCP& cp,
118  double alpha
119  ) const
120 {
121  return iter.applyStep( cp.deltaX,alpha );
122 }
123 
124 
125 // returnValue SCPstep::getUpdatedFirstControl( const OCPiterate& iter,
126 // const BandedCP& cp,
127 // double alpha,
128 // DVector& _u
129 // ) const
130 // {
131 // DMatrix tmp;
132 //
133 // cp.deltaX.getSubBlock( 3*iter.getNumPoints()+0, 0, tmp, _u.getDim(), 1 );
134 //
135 // for( uint run1 = 0; run1 < _u.getDim(); run1++ )
136 // _u(run1) += alpha*tmp(run1,0);
137 //
138 // return SUCCESSFUL_RETURN;
139 // }
140 
141 
143 
144 // end of file.
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
SCPmeritFunction * meritFcn
Definition: scp_step.hpp:124
BlockMatrix deltaX
Definition: banded_cp.hpp:123
Allows to pass back messages to the calling function.
AlgorithmicBase & operator=(const AlgorithmicBase &rhs)
Base class for all algorithmic modules within the ACADO Toolkit providing some basic functionality...
Base class for different ways to perform a step of an SCPmethod for solving NLPs. ...
Definition: scp_step.hpp:62
virtual returnValue applyStep(OCPiterate &iter, BandedCP &cp, double alpha) const
Definition: scp_step.cpp:116
SCPstep & operator=(const SCPstep &rhs)
Definition: scp_step.cpp:82
#define CLOSE_NAMESPACE_ACADO
virtual ~SCPstep()
Definition: scp_step.cpp:75
Allows to evaluate a merit function within an SCPmethod for solving NLPs.
returnValue applyStep(const BlockMatrix &bm, double alpha)
Encapsulates all user interaction for setting options, logging data and plotting results.
void rhs(const real_t *x, real_t *f)
#define BEGIN_NAMESPACE_ACADO
virtual returnValue setupOptions()
Definition: scp_step.cpp:104
virtual returnValue setupLogging()
Definition: scp_step.cpp:110
SCPstep()
Definition: scp_step.cpp:46
Data class for storing conic programs arising from optimal control.
Definition: banded_cp.hpp:56


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