46 const std::string& _commonHeaderName
109 for( i = 0; i <
outputs.size(); i++ ) {
110 if(
outputs[i].getGlobalExportVariable().getDim() >= max.
getDim() ) {
111 max =
outputs[i].getGlobalExportVariable();
173 if(
NDX2 > 0 && (NDX2 < NX2 || NDX2 > (
NX1+
NX2)) ) {
180 for(
uint i = 0; i < rhs_.getDim(); i++ ) {
215 int hessianApproximation;
254 for(
uint j = 0; j <= i; j++ ) {
255 new_expr << expr(i,j);
277 bool gradientUpdate = (bool) gradientUp;
280 int hessianApproximation;
287 if( secondOrder ) symH = numX + numU +
NX*
NU;
302 if(
NX2 > 0 ||
NXA > 0 ) {
331 std::string tempString;
420 loop->addStatement( std::string(
"if( run > 0 ) {\n") );
425 loop->addStatement( loopTemp2 );
427 loop->addStatement( std::string(
"}\nelse{\n") );
431 loop->addStatement( std::string(
"}\n") );
479 for( run5 = 0; run5 <
NX2; run5++ ) {
487 for( run5 = 0; run5 <
NXA; run5++ ) {
495 loop->addStatement( loopTemp );
498 for( run5 = 0; run5 <
NX; run5++ ) {
504 loop->addStatement( std::string(
"if( run == 0 ) {\n") );
506 for( run5 = 0; run5 <
NXA; run5++ ) {
510 loop->addStatement( std::string(
"}\n") );
527 loop->addStatement(
"}\n" );
534 DMatrix zeroL = zeros<double>(1,NX+NU+symH);
552 loop2->addStatement( k_index == run*(NX+NXA)*(NX+NU) );
558 for( run5 = 0; run5 <
numStages; run5++ ) {
564 for( run5 = 0; run5 <
numStages; run5++ ) {
568 for( run6 = 0; run6 <
numStages; run6++ ) {
579 for( run5 = 0; run5 <
numStages; run5++ ) {
586 diffLoop1.
addStatement( tmp_index2 == k_index+i*(NX+NU) );
589 for( run6 = 0; run6 <
numStages; run6++ ) {
598 loop2->addStatement( diffLoop1 );
709 int hessianApproximation;
714 if( secondOrder ) symH = numX + numU +
NX*
NU;
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
ExportVariable rk_adj_diffs_tmp
ExportVariable rk_xxx_traj
ExportVariable rk_b_trans
Expression symmetricDerivative(const Expression &arg1, const Expression &arg2, const Expression &forward_seed, const Expression &backward_seed, Expression *forward_result, Expression *backward_result)
Allows to export a tailored lifted implicit Runge-Kutta integrator with forward sensitivity generatio...
virtual returnValue allSensitivitiesImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index1, const ExportIndex &tmp_index2, const ExportIndex &tmp_index3, const ExportIndex &k_index, const ExportVariable &Bh, bool update)
ExportVariable getRow(const ExportIndex &idx) const
Expression backwardDerivative(const Expression &arg1, const Expression &arg2)
const std::string getNameSolveTransposeReuseFunction()
returnValue initializeDDMatrix()
ExportVariable getGlobalExportVariable() const
virtual returnValue setDifferentialEquation(const Expression &rhs)
double getFirstTime() const
AdjointLiftedIRKExport & operator=(const AdjointLiftedIRKExport &arg)
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
GenericMatrix & appendCols(const GenericMatrix &_arg)
std::vector< Grid > outputGrids
ExportAcadoFunction diffs_rhs
virtual returnValue solveImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index, const ExportIndex &k_index, const ExportVariable &Ah, const ExportVariable &C, const ExportVariable &det, bool DERIVATIVES=false)
virtual returnValue evaluateRhsSensitivities(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index1, const ExportIndex &tmp_index2)
std::vector< ExportAcadoFunction > outputs
Allows to pass back messages to the calling function.
returnValue initializeCoefficients()
Expression forwardDerivative(const Expression &arg1, const Expression &arg2)
ExportLinearSolver * solver
returnValue addComment(const std::string &_comment)
Block< Derived > block(Index startRow, Index startCol, Index blockRows, Index blockCols)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
std::vector< ExportAcadoFunction > diffs_outputs
ExportVariable rk_diffsPrev2
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
Allows to export code of a for-loop.
string toString(T const &value)
ExportVariable rk_xxx_lin
ExportVariable rk_diffK_local
ExportVariable getElement(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportVariable rk_diffsTemp2
#define CLOSE_NAMESPACE_ACADO
virtual ~AdjointLiftedIRKExport()
ExportVariable getSubMatrix(const ExportIndex &rowIdx1, const ExportIndex &rowIdx2, const ExportIndex &colIdx1, const ExportIndex &colIdx2) const
GenericMatrix< double > DMatrix
Defines a scalar-valued index variable to be used for exporting code.
Expression returnLowerTriangular(const Expression &expr)
virtual returnValue copy(const ImplicitRungeKuttaExport &arg)
virtual returnValue setup()
Base class for all variables within the symbolic expressions family.
virtual returnValue getCode(ExportStatementBlock &code)
ExportAcadoFunction diffs_rhs3
DVector evaluateDerivedPolynomial(double time)
ExportVariable getCols(const ExportIndex &idx1, const ExportIndex &idx2) const
Expression multipleForwardDerivative(const Expression &arg1, const Expression &arg2, const Expression &seed)
ExportVariable rk_auxSolver
ExportVariable getAuxVariable() const
ExportVariable makeRowVector() const
AdjointLiftedIRKExport(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
Expression & appendRows(const Expression &arg)
Encapsulates all user interaction for setting options, logging data and plotting results.
virtual uint getDim() const
returnValue addStatement(const ExportStatement &_statement)
std::string getFullName() const
Expression transpose() const
returnValue addLinebreak(uint num=1)
virtual returnValue evaluateAllStatesImplicitSystem(ExportStatementBlock *block, const ExportIndex &k_index, const ExportVariable &Ah, const ExportVariable &C, const ExportIndex &stage, const ExportIndex &i, const ExportIndex &tmp_index)
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
ExportVariable rk_diffsNew2
uint getNumIntervals() const
returnValue prepareOutputEvaluation(ExportStatementBlock &code)
DifferentialStateDerivative dx
std::string getName() const
ExportVariable getRows(const ExportIndex &idx1, const ExportIndex &idx2) const
returnValue addDeclaration(const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
ExportAcadoFunction lin_input
double getLastTime() const
ExportVariable rk_stageValues
std::vector< ExportVariable > rk_outputs
#define BEGIN_NAMESPACE_ACADO
ExportVariable error_code
returnValue clearStaticCounters()
ExportAcadoFunction diffs_sweep
ExportAcadoFunction adjoint_sweep
virtual returnValue setup()
returnValue addFunction(const ExportFunction &_function)
virtual returnValue clear()
ExportAcadoFunction forward_sweep
virtual returnValue getCode(ExportStatementBlock &code)=0
virtual returnValue updateImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
ExportVariable rk_adj_traj
Allows to export code for a block of statements.
Expression getRows(const uint &rowIdx1, const uint &rowIdx2) const
ExportArgument getAddress(const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const
ExportVariable getCol(const ExportIndex &idx) const
returnValue init(const Function &_f, const std::string &_name="acadoFcn", const uint _numX=0, const uint _numXA=0, const uint _numU=0, const uint _numP=0, const uint _numDX=0, const uint _numOD=0)
ExportFunction & addIndex(const ExportIndex &_index)
#define ACADOERROR(retval)
virtual bool equidistantControlGrid() const
ForwardLiftedIRKExport & operator=(const ForwardLiftedIRKExport &arg)
Defines a matrix-valued variable to be used for exporting code.
Allows to export a tailored lifted implicit Runge-Kutta integrator with adjoint sensitivity generatio...
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.
std::string getName() const