parent
86beb9a81a
commit
42d93e94df
847 changed files with 0 additions and 196915 deletions
@ -1,28 +0,0 @@ |
|||||||
From a1b2938bcf0b2bbb9156ed9ee922bc5b5a38cea7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: heyyeh12 <heyyeh12@users.noreply.github.com>
|
|
||||||
Date: Sat, 27 Apr 2019 09:08:48 -0400
|
|
||||||
Subject: [PATCH] fixes issue #261 binding to temporary object
|
|
||||||
|
|
||||||
---
|
|
||||||
acado/code_generation/export_function_declaration.cpp | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/acado/code_generation/export_function_declaration.cpp b/acado/code_generation/export_function_declaration.cpp
|
|
||||||
index d6450b50..46a3269f 100644
|
|
||||||
--- a/acado/code_generation/export_function_declaration.cpp
|
|
||||||
+++ b/acado/code_generation/export_function_declaration.cpp
|
|
||||||
@@ -36,12 +36,12 @@
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO
|
|
||||||
|
|
||||||
-
|
|
||||||
+const ExportFunction& _ff = ExportFunction();
|
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
-ExportFunctionDeclaration::ExportFunctionDeclaration( ) : ExportStatement( ), f( ExportFunction() )
|
|
||||||
+ExportFunctionDeclaration::ExportFunctionDeclaration( ) : ExportStatement( ), f( _ff )
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
@ -1,29 +0,0 @@ |
|||||||
#!/usr/bin/env sh |
|
||||||
set -e |
|
||||||
|
|
||||||
rm -rf acado |
|
||||||
git clone https://github.com/acado/acado.git |
|
||||||
cd acado |
|
||||||
git reset --hard 5adb8cbcff5a5464706a48eaf073218ac87c9044 |
|
||||||
|
|
||||||
# Clang 8 fixes |
|
||||||
git apply ../01.patch |
|
||||||
sed -i '100d' cmake/CompilerOptions.cmake |
|
||||||
sed -i '100d' cmake/CompilerOptions.cmake |
|
||||||
|
|
||||||
mkdir build |
|
||||||
cd build |
|
||||||
cmake -DACADO_WITH_EXAMPLES=OFF -DACADO_BUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="$HOME/openpilot/phonelibs/acado" .. |
|
||||||
make -j$(nproc) |
|
||||||
make install |
|
||||||
|
|
||||||
cd .. |
|
||||||
cd .. |
|
||||||
|
|
||||||
rm -r x86_64 |
|
||||||
mkdir x86_64 |
|
||||||
mv lib x86_64/lib |
|
||||||
cp acado/build/lib/* x86_64/lib/ |
|
||||||
|
|
||||||
rm -rf acado |
|
||||||
rm -r share |
|
@ -1,33 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_code_generation.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2009 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#include <acado/code_generation/code_generation.hpp> |
|
@ -1,62 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_controller.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/user_interaction/user_interaction.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
#include <acado/variables_grid/variables_grid.hpp> |
|
||||||
#include <acado/index_list/index_list.hpp> |
|
||||||
#include <acado/symbolic_expression/symbolic_expression.hpp> |
|
||||||
#include <acado/function/function.hpp> |
|
||||||
#include <acado/integrator/integrator.hpp> |
|
||||||
#include <acado/sparse_solver/sparse_solver.hpp> |
|
||||||
|
|
||||||
#include <acado/dynamic_system/dynamic_system.hpp> |
|
||||||
#include <acado/dynamic_discretization/dynamic_discretization.hpp> |
|
||||||
#include <acado/dynamic_discretization/integration_algorithm.hpp> |
|
||||||
#include <acado/nlp_solver/nlp_solver.hpp> |
|
||||||
#include <acado/nlp_solver/scp_method.hpp> |
|
||||||
#include <acado/ocp/ocp.hpp> |
|
||||||
#include <acado/optimization_algorithm/optimization_algorithm.hpp> |
|
||||||
#include <acado/optimization_algorithm/parameter_estimation_algorithm.hpp> |
|
||||||
#include <acado/optimization_algorithm/multi_objective_algorithm.hpp> |
|
||||||
|
|
||||||
#include <acado/curve/curve.hpp> |
|
||||||
#include <acado/controller/controller.hpp> |
|
||||||
#include <acado/estimator/estimator.hpp> |
|
||||||
#include <acado/control_law/control_law.hpp> |
|
||||||
#include <acado/control_law/pid_controller.hpp> |
|
||||||
#include <acado/control_law/dynamic_feedback_law.hpp> |
|
||||||
#include <acado/control_law/linear_state_feedback.hpp> |
|
||||||
#include <acado/control_law/feedforward_law.hpp> |
|
||||||
#include <acado/reference_trajectory/reference_trajectory.hpp> |
|
@ -1,33 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_gnuplot.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#include <acado/bindings/acado_gnuplot/gnuplot_window.hpp> |
|
@ -1,44 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_integrators.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 10.06.2009 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/clock/clock.hpp> |
|
||||||
#include <acado/curve/curve.hpp> |
|
||||||
#include <acado/user_interaction/user_interaction.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
#include <acado/variables_grid/variables_grid.hpp> |
|
||||||
#include <acado/symbolic_expression/symbolic_expression.hpp> |
|
||||||
#include <acado/function/function.hpp> |
|
||||||
#include <acado/integrator/integrator.hpp> |
|
||||||
#include <acado/sparse_solver/sparse_solver.hpp> |
|
@ -1,47 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_optimal_control.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 10.06.2009 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <acado_integrators.hpp> |
|
||||||
|
|
||||||
#include <acado/dynamic_system/dynamic_system.hpp> |
|
||||||
#include <acado/dynamic_discretization/dynamic_discretization.hpp> |
|
||||||
#include <acado/dynamic_discretization/integration_algorithm.hpp> |
|
||||||
#include <acado/nlp_solver/nlp_solver.hpp> |
|
||||||
#include <acado/nlp_solver/scp_method.hpp> |
|
||||||
#include <acado/ocp/ocp.hpp> |
|
||||||
#include <acado/ocp/nlp.hpp> |
|
||||||
#include <acado/optimization_algorithm/optimization_algorithm.hpp> |
|
||||||
#include <acado/optimization_algorithm/real_time_algorithm.hpp> |
|
||||||
#include <acado/optimization_algorithm/parameter_estimation_algorithm.hpp> |
|
||||||
#include <acado/optimization_algorithm/multi_objective_algorithm.hpp> |
|
@ -1,51 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado_toolkit.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 10.06.2009 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <acado_optimal_control.hpp> |
|
||||||
|
|
||||||
#include <acado/curve/curve.hpp> |
|
||||||
#include <acado/controller/controller.hpp> |
|
||||||
#include <acado/estimator/estimator.hpp> |
|
||||||
#include <acado/control_law/control_law.hpp> |
|
||||||
#include <acado/control_law/pid_controller.hpp> |
|
||||||
#include <acado/control_law/linear_state_feedback.hpp> |
|
||||||
#include <acado/control_law/feedforward_law.hpp> |
|
||||||
#include <acado/reference_trajectory/reference_trajectory.hpp> |
|
||||||
#include <acado/simulation_environment/simulation_environment.hpp> |
|
||||||
#include <acado/process/process.hpp> |
|
||||||
#include <acado/noise/noise.hpp> |
|
||||||
#include <acado/transfer_device/actuator.hpp> |
|
||||||
#include <acado/transfer_device/sensor.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/code_generation.hpp> |
|
@ -1,210 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file external_packages/include/acado_csparse.hpp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
* \date 2009 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ACADO_CSPARSE_HPP |
|
||||||
#define ACADO_TOOLKIT_ACADO_CSPARSE_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/sparse_solver/sparse_solver.hpp> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FORWARD DECLARATIONS:
|
|
||||||
// ---------------------
|
|
||||||
struct cs_numeric ; |
|
||||||
struct cs_symbolic; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief (not yet documented) |
|
||||||
* |
|
||||||
* \ingroup ExternalFunctionality |
|
||||||
* |
|
||||||
* The class ... |
|
||||||
* |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ACADOcsparse : public SparseSolver{ |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor. */ |
|
||||||
ACADOcsparse( ); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy). */ |
|
||||||
ACADOcsparse( const ACADOcsparse &arg ); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ACADOcsparse( ); |
|
||||||
|
|
||||||
/** Clone operator (deep copy). */ |
|
||||||
virtual ACADOcsparse* clone() const; |
|
||||||
|
|
||||||
|
|
||||||
/** Defines the dimension n of A \in R^{n \times n} \n
|
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue setDimension( const int &n ); |
|
||||||
|
|
||||||
|
|
||||||
/** Defines the number of non-zero elements in the \n
|
|
||||||
* matrix A \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue setNumberOfEntries( const int &nDense_ ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Sets an index list containing the positions of the \n
|
|
||||||
* non-zero elements in the matrix A. |
|
||||||
*/ |
|
||||||
virtual returnValue setIndices( const int *rowIdx_, |
|
||||||
const int *colIdx_ ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Sets the non-zero elements of the matrix A. The double* A \n
|
|
||||||
* is assumed to contain nDense entries corresponding to \n |
|
||||||
* non-zero elements of A. \n |
|
||||||
*/ |
|
||||||
virtual returnValue setMatrix( double *A_ ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Solves the system A*x = b for the specified data. \n
|
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_LINEAR_SYSTEM_NUMERICALLY_SINGULAR \n |
|
||||||
*/ |
|
||||||
virtual returnValue solve( double *b ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Solves the system A^T*x = b for the specified data. \n
|
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_LINEAR_SYSTEM_NUMERICALLY_SINGULAR \n |
|
||||||
*/ |
|
||||||
virtual returnValue solveTranspose( double *b ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Returns the solution of the equation A*x = b if solved. \n
|
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue getX( double *x_ ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Sets the required tolerance (accuracy) for the solution of \n
|
|
||||||
* the linear equation. For large tolerances an iterative \n |
|
||||||
* algorithm might converge earlier. \n |
|
||||||
* \n |
|
||||||
* Requires || A*x - b || <= TOL \n |
|
||||||
* \n |
|
||||||
* The norm || . || is possibly scaled by a preconditioner. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue setTolerance( double TOL_ ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets the print level. \n
|
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue setPrintLevel( PrintLevel printLevel_ ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// DATA MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
// DIMENSIONS:
|
|
||||||
// --------------------
|
|
||||||
int dim; // dimension of the matrix A
|
|
||||||
int nDense; // number of non-zero entries in A
|
|
||||||
int *index1, *index2; // and the associated indices
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DATA:
|
|
||||||
// --------------------
|
|
||||||
double *x; // The result vector x
|
|
||||||
|
|
||||||
|
|
||||||
// AUXILIARY VARIABLES:
|
|
||||||
// --------------------
|
|
||||||
cs_symbolic *S; // pointer to a struct, which contains symbolic information about the matrix
|
|
||||||
cs_numeric *N; // pointer to a struct, which contains numeric information about the matrix
|
|
||||||
|
|
||||||
|
|
||||||
double TOL; // The required tolerance. (default 10^(-10))
|
|
||||||
PrintLevel printLevel; // The PrintLevel.
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif |
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
||||||
|
|
@ -1,226 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file external_packages/acado_gnuplot/gnuplot_window.hpp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau, Milan Vukov |
|
||||||
* \date 2009-2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP |
|
||||||
#define ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/user_interaction/plot_window.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Provides an interface to Gnuplot for plotting algorithmic outputs. |
|
||||||
* |
|
||||||
* \ingroup ExternalFunctionality |
|
||||||
* |
|
||||||
* The acado2gnuplot interface provides the functionality to easiliy |
|
||||||
* plot data which is available in the ACADO Toolkit format. The methods |
|
||||||
* that are implemented in this interface convert ACADO sturctures into |
|
||||||
* a format that can be read by the program Gnuplot. |
|
||||||
* |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
class GnuplotWindow : public PlotWindow |
|
||||||
{ |
|
||||||
|
|
||||||
// PUBLIC FUNCTIONS:
|
|
||||||
// -----------------
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor. */ |
|
||||||
GnuplotWindow( ); |
|
||||||
|
|
||||||
/** Constructor which takes the plot frequency.
|
|
||||||
* |
|
||||||
* @param[in] _frequency Frequency determining at which time instants the window is to be plotted. |
|
||||||
*/ |
|
||||||
GnuplotWindow( PlotFrequency _frequency |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GnuplotWindow( const GnuplotWindow& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~GnuplotWindow( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GnuplotWindow& operator=( const GnuplotWindow& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Clone operator returning a base class pointer to a deep copy
|
|
||||||
* of respective class instance. |
|
||||||
* |
|
||||||
* \return Base class pointer to a deep copy of respective class instance |
|
||||||
*/ |
|
||||||
virtual PlotWindow* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes the Gnuplot-thread.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_PLOT_WINDOW_CAN_NOT_BE_OPEN |
|
||||||
*/ |
|
||||||
virtual returnValue init( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Actually sets-up and plots the data in a Gnuplot window.
|
|
||||||
* |
|
||||||
* @param[in] _frequency Frequency determining at which time instants the window is to be plotted. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_PLOTTING_FAILED, \n |
|
||||||
* RET_INVALID_ARGUMENTS, \n |
|
||||||
* RET_PLOT_WINDOW_CAN_NOT_BE_OPEN |
|
||||||
*/ |
|
||||||
virtual returnValue replot( PlotFrequency _frequency = PLOT_IN_ANY_CASE |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Runs the Gnuplot window in waiting mode until a mouse event
|
|
||||||
* occurs. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue waitForMouseEvents( ); |
|
||||||
|
|
||||||
/** Returns whether a mouse event has occured.
|
|
||||||
* |
|
||||||
* @param[out] mouseX X coordinate of mouse click. |
|
||||||
* @param[out] mouseX Y coordinate of mouse click. |
|
||||||
* |
|
||||||
* \return BT_TRUE iff mouse event occured, \n |
|
||||||
* BT_FALSE otherwise |
|
||||||
*/ |
|
||||||
BooleanType getMouseEvent( double& mouseX, |
|
||||||
double& mouseY |
|
||||||
); |
|
||||||
|
|
||||||
/** Waits until a mouse event occurs.
|
|
||||||
* |
|
||||||
* @param[out] mouseX X coordinate of mouse click. |
|
||||||
* @param[out] mouseX Y coordinate of mouse click. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_NOT_YET_IMPLEMENTED |
|
||||||
*/ |
|
||||||
returnValue waitForMouseEvent( double& mouseX, |
|
||||||
double& mouseY |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROTECTED FUNCTIONS:
|
|
||||||
// --------------------
|
|
||||||
|
|
||||||
protected: |
|
||||||
/** Sets-up and plots the data in a Gnuplot window.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_PLOTTING_FAILED, \n |
|
||||||
* RET_INVALID_ARGUMENTS, \n |
|
||||||
* RET_PLOT_WINDOW_CAN_NOT_BE_OPEN |
|
||||||
*/ |
|
||||||
returnValue sendDataToGnuplot( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Generates string in Gnuplot syntax for plotting in given plot mode.
|
|
||||||
* |
|
||||||
* @param[in] plotMode Plot mode whose string needs to be generated, see the PlotMode documentation for details. |
|
||||||
* @param[out] plotModeString String in Gnuplot syntax for plotting in given plot mode. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue getPlotModeString( PlotMode plotMode, |
|
||||||
std::string& plotModeString |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Generates string in Gnuplot syntax for plotting in given plot style.
|
|
||||||
* |
|
||||||
* @param[in] _type Type of variable to be plotted. |
|
||||||
* @param[out] plotStyleString String in Gnuplot syntax for plotting in given plot style. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue getPlotStyleString( VariableType _type, |
|
||||||
std::string& plotStyleString |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Generates string in Gnuplot syntax for plotting given data grid.
|
|
||||||
* |
|
||||||
* @param[in] _dataGrid Date grid to be plotted. |
|
||||||
* @param[out] _plotDataString String in Gnuplot syntax for plotting given data grid. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue obtainPlotDataString( VariablesGrid& _dataGrid, |
|
||||||
std::string& _plotDataString |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PROTECTED DATA MEMBERS:
|
|
||||||
// -----------------------
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
FILE* gnuPipe; /**< Pipe to Gnuplot. */ |
|
||||||
|
|
||||||
BooleanType mouseEvent; /**< Flag indicating whether window should wait for mouse events. */ |
|
||||||
|
|
||||||
static int counter; /**< Static counter for counting the number of GnuplotWindows. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
||||||
|
|
@ -1,57 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file external_packages/acado_gnuplot/gnuplot_window.ipp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
* \date 2009 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PUBLIC MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PROTECTED MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/* |
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,218 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file external_packages/include/acado_qpoases/qp_solver_qpoases.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 19.08.2008 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_QP_SOLVER_QPOASES_HPP |
|
||||||
#define ACADO_TOOLKIT_QP_SOLVER_QPOASES_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/conic_solver/dense_qp_solver.hpp> |
|
||||||
|
|
||||||
namespace qpOASES |
|
||||||
{ |
|
||||||
class SQProblem; |
|
||||||
} |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief (not yet documented) |
|
||||||
* |
|
||||||
* \ingroup ExternalFunctionality |
|
||||||
* |
|
||||||
* The class QPsolver_qpOASES interfaces the qpOASES software package |
|
||||||
* for solving convex quadratic programming (QP) problems. |
|
||||||
* |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
*/ |
|
||||||
class QPsolver_qpOASES : public DenseQPsolver |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
/** Default constructor. */ |
|
||||||
QPsolver_qpOASES( ); |
|
||||||
|
|
||||||
QPsolver_qpOASES( UserInteraction* _userInteraction |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy). */ |
|
||||||
QPsolver_qpOASES( const QPsolver_qpOASES& rhs ); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~QPsolver_qpOASES( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy). */ |
|
||||||
QPsolver_qpOASES& operator=( const QPsolver_qpOASES& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
virtual DenseCPsolver* clone( ) const; |
|
||||||
|
|
||||||
virtual DenseQPsolver* cloneDenseQPsolver( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Solves the QP. */ |
|
||||||
virtual returnValue solve( DenseCP *cp_ ); |
|
||||||
|
|
||||||
|
|
||||||
/** Solves QP using at most <maxIter> iterations.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_SOLUTION_REACHED_LIMIT \n |
|
||||||
* RET_QP_SOLUTION_FAILED \n |
|
||||||
* RET_INITIALIZE_FIRST */ |
|
||||||
virtual returnValue solve( double* H, /**< Hessian matrix of neighbouring QP to be solved. */ |
|
||||||
double* A, /**< Constraint matrix of neighbouring QP to be solved. */ |
|
||||||
double* g, /**< Gradient of neighbouring QP to be solved. */ |
|
||||||
double* lb, /**< Lower bounds of neighbouring QP to be solved. */ |
|
||||||
double* ub, /**< Upper bounds of neighbouring QP to be solved. */ |
|
||||||
double* lbA, /**< Lower constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
double* ubA, /**< Upper constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
uint maxIter /**< Maximum number of iterations. */ |
|
||||||
); |
|
||||||
|
|
||||||
/** Solves QP using at most <maxIter> iterations. */ |
|
||||||
virtual returnValue solve( DMatrix *H, /**< Hessian matrix of neighbouring QP to be solved. */ |
|
||||||
DMatrix *A, /**< Constraint matrix of neighbouring QP to be solved. */ |
|
||||||
DVector *g, /**< Gradient of neighbouring QP to be solved. */ |
|
||||||
DVector *lb, /**< Lower bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *ub, /**< Upper bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *lbA, /**< Lower constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *ubA, /**< Upper constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
uint maxIter /**< Maximum number of iterations. */
|
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Performs exactly one QP iteration.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_SOLUTION_REACHED_LIMIT \n |
|
||||||
* RET_QP_SOLUTION_FAILED \n |
|
||||||
* RET_INITIALIZE_FIRST */ |
|
||||||
virtual returnValue step( double* H, /**< Hessian matrix of neighbouring QP to be solved. */ |
|
||||||
double* A, /**< Constraint matrix of neighbouring QP to be solved. */ |
|
||||||
double* g, /**< Gradient of neighbouring QP to be solved. */ |
|
||||||
double* lb, /**< Lower bounds of neighbouring QP to be solved. */ |
|
||||||
double* ub, /**< Upper bounds of neighbouring QP to be solved. */ |
|
||||||
double* lbA, /**< Lower constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
double* ubA /**< Upper constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
); |
|
||||||
|
|
||||||
/** Performs exactly one QP iteration.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_SOLUTION_REACHED_LIMIT \n |
|
||||||
* RET_QP_SOLUTION_FAILED \n |
|
||||||
* RET_INITIALIZE_FIRST */ |
|
||||||
virtual returnValue step( DMatrix *H, /**< Hessian matrix of neighbouring QP to be solved. */ |
|
||||||
DMatrix *A, /**< Constraint matrix of neighbouring QP to be solved. */ |
|
||||||
DVector *g, /**< Gradient of neighbouring QP to be solved. */ |
|
||||||
DVector *lb, /**< Lower bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *ub, /**< Upper bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *lbA, /**< Lower constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
DVector *ubA /**< Upper constraints' bounds of neighbouring QP to be solved. */ |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns primal solution vector if QP has been solved.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_NOT_SOLVED */ |
|
||||||
virtual returnValue getPrimalSolution( DVector& xOpt /**< OUTPUT: primal solution vector. */ |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns dual solution vector if QP has been solved.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_NOT_SOLVED */ |
|
||||||
virtual returnValue getDualSolution( DVector& yOpt /**< OUTPUT: dual solution vector. */ |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns optimal objective function value.
|
|
||||||
* \return finite value: Optimal objective function value (QP has been solved) \n |
|
||||||
+INFTY: QP has not been solved or is infeasible \n |
|
||||||
-INFTY: QP is unbounded */ |
|
||||||
virtual double getObjVal( ) const; |
|
||||||
|
|
||||||
|
|
||||||
virtual uint getNumberOfVariables( ) const; |
|
||||||
virtual uint getNumberOfConstraints( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns a variance-covariance estimate if possible or an error message otherwise.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
* RET_MEMBER_NOT_INITIALISED |
|
||||||
*/ |
|
||||||
virtual returnValue getVarianceCovariance( DMatrix &var ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns a variance-covariance estimate if possible or an error message otherwise.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
* RET_MEMBER_NOT_INITIALISED |
|
||||||
*/ |
|
||||||
virtual returnValue getVarianceCovariance( DMatrix &H, DMatrix &var ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
/** Setups QP object.
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
* RET_QP_INIT_FAILED */ |
|
||||||
virtual returnValue setupQPobject( uint nV, /**< Number of QP variables. */ |
|
||||||
uint nC /**< Number of QP constraints (without bounds). */ |
|
||||||
); |
|
||||||
|
|
||||||
returnValue updateQPstatus( int ret |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// DATA MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
qpOASES::SQProblem* qp; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/bindings/acado_qpoases/qp_solver_qpoases.ipp> |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_QP_SOLVER_QPOASES_HPP
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,48 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/** |
|
||||||
* \file external_packages/include/acado_qpoases/qp_solver_qpoases.ipp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 19.08.2008 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PUBLIC MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* |
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,184 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/clock/clock.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_CLOCK_HPP |
|
||||||
#define ACADO_TOOLKIT_CLOCK_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Base class for all kind of time measurements. |
|
||||||
* |
|
||||||
* \ingroup BasicDataStructures |
|
||||||
* |
|
||||||
* The class Clock serves as base class for all kind of time measurements,
|
|
||||||
* both real and simulated ones. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class Clock |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
Clock( ); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
Clock( const Clock &rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~Clock(); |
|
||||||
|
|
||||||
/** Assignment Operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
Clock& operator=( const Clock &rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to deep copy of base class type |
|
||||||
*/ |
|
||||||
virtual Clock* clone( ) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes the clock with given initial time.
|
|
||||||
* |
|
||||||
* @param[in] _initialTime Initial time. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue init( double _initialTime |
|
||||||
); |
|
||||||
|
|
||||||
/** Initializes the clock with initial time zero.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue reset( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Starts time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue start( ) = 0; |
|
||||||
|
|
||||||
/** Shifts measured time by a given offset.
|
|
||||||
* |
|
||||||
* @param[in] _timeShift Time offset. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue step( double _timeShift |
|
||||||
) = 0; |
|
||||||
|
|
||||||
/** Stops time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue stop ( ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns elapsed time.
|
|
||||||
* |
|
||||||
* @param[in] _elapsedTime Elapsed time. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_BLOCK_NOT_READY |
|
||||||
*/ |
|
||||||
virtual returnValue getTime( double& _elapsedTime |
|
||||||
); |
|
||||||
|
|
||||||
/** Returns elapsed time.
|
|
||||||
* |
|
||||||
* \return >= 0: elapsed time, \n |
|
||||||
* -INFTY: internal error |
|
||||||
*/ |
|
||||||
virtual double getTime( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns current status of clock, see documentation of ClockStatus for details.
|
|
||||||
* |
|
||||||
* \return Current status of clock |
|
||||||
*/ |
|
||||||
inline ClockStatus getStatus( ) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
double elapsedTime; /**< Elapsed time since last reset. */ |
|
||||||
ClockStatus status; /**< Status of clock. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/clock/clock.ipp> |
|
||||||
|
|
||||||
|
|
||||||
// collect all remaining headers of clock directory
|
|
||||||
#include <acado/clock/real_clock.hpp> |
|
||||||
#include <acado/clock/simulation_clock.hpp> |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_CLOCK_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,54 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file include/acado/clock/clock.ipp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
* \date 13.06.2008 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PUBLIC MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
inline ClockStatus Clock::getStatus( ) const |
|
||||||
{ |
|
||||||
return status; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/* |
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,138 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/clock/real_clock.hpp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_REAL_CLOCK_HPP |
|
||||||
#define ACADO_TOOLKIT_REAL_CLOCK_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/clock/clock.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows real time measurements based on the system's clock. |
|
||||||
* |
|
||||||
* \ingroup BasicDataStructures |
|
||||||
* |
|
||||||
* The class RealClock allows real time measurements based on the |
|
||||||
* system's clock. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class RealClock : public Clock |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
RealClock(); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
RealClock( const RealClock &rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~RealClock( ); |
|
||||||
|
|
||||||
/** Assignment Operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
RealClock& operator=( const RealClock &rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to deep copy of base class type |
|
||||||
*/ |
|
||||||
virtual Clock* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Starts time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue start( ); |
|
||||||
|
|
||||||
/** Shifts measured time by a given offset.
|
|
||||||
* |
|
||||||
* @param[in] _timeShift Time offset. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue step( double _timeShift |
|
||||||
); |
|
||||||
|
|
||||||
/** Stops time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY, \n |
|
||||||
* RET_NO_SYSTEM_TIME |
|
||||||
*/ |
|
||||||
virtual returnValue stop( ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
double lastTimeInstant; /**< Last time instant at which start() has been called. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
//#include <acado/clock/real_clock.ipp>
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_REAL_CLOCK_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,49 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file include/acado/clock/real_clock.ipp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
* \date 13.06.2008 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PUBLIC MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* |
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,132 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/clock/simulation_clock.hpp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_SIMULATION_CLOCK_HPP |
|
||||||
#define ACADO_TOOLKIT_SIMULATION_CLOCK_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/clock/clock.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Simulates real time measurements for simulations. |
|
||||||
* |
|
||||||
* \ingroup BasicDataStructures |
|
||||||
* |
|
||||||
* The class SimulationClock simulates real time measurements for
|
|
||||||
* simulations within the SimulationEnvironment. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class SimulationClock : public Clock |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
SimulationClock(); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
SimulationClock( const SimulationClock& rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~SimulationClock( ); |
|
||||||
|
|
||||||
/** Assignment Operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side object. |
|
||||||
*/ |
|
||||||
SimulationClock& operator=( const SimulationClock& rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to deep copy of base class type |
|
||||||
*/ |
|
||||||
virtual Clock* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Starts time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY |
|
||||||
*/ |
|
||||||
virtual returnValue start( ); |
|
||||||
|
|
||||||
/** Shifts measured time by a given offset.
|
|
||||||
* |
|
||||||
* @param[in] _timeShift Time offset. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY |
|
||||||
*/ |
|
||||||
virtual returnValue step( double _timeShift |
|
||||||
); |
|
||||||
|
|
||||||
/** Stops time measurement.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_CLOCK_NOT_READY |
|
||||||
*/ |
|
||||||
virtual returnValue stop( ); |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
//#include <acado/clock/simulation_clock.ipp>
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_SIMULATION_CLOCK_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,48 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file include/acado/clock/simulation_clock.ipp |
|
||||||
* \author Boris Houska, Hans Joachim Ferreau |
|
||||||
* \date 13.06.2008 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// PUBLIC MEMBER FUNCTIONS: |
|
||||||
// |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/* |
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,42 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/code_generation/code_generation.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov, Rien Quirynen |
|
||||||
* \date 2010 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_CODE_GENERATION_HPP |
|
||||||
#define ACADO_TOOLKIT_CODE_GENERATION_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/integrator_export_types.hpp> |
|
||||||
#include <acado/code_generation/sim_export.hpp> |
|
||||||
#include <acado/code_generation/ocp_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/register_exported_integrators.hpp> |
|
||||||
#include <acado/code_generation/register_nlp_solvers.hpp> |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_CODE_GENERATION_HPP
|
|
@ -1,205 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_ode_function.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ODE_FUNCTION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ODE_FUNCTION_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_function.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class Function; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code of an ACADO function. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportAcadoFunction allows to export code of an ACADO function. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportAcadoFunction : public ExportFunction |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor. */ |
|
||||||
ExportAcadoFunction( ); |
|
||||||
|
|
||||||
/** Constructor which takes the differential equation to be exported
|
|
||||||
* as well as the name of the exported ODE. |
|
||||||
* |
|
||||||
* @param[in] _f Differential equation to be exported. |
|
||||||
* @param[in] _name Name of exported ODE function. |
|
||||||
*/ |
|
||||||
ExportAcadoFunction( const Function& _f, |
|
||||||
const std::string& _name = "acadoFcn" |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which takes name of a function only.
|
|
||||||
* |
|
||||||
* This way, we can define an "external symbolic function" with the |
|
||||||
* following prototype: |
|
||||||
* \verbatim |
|
||||||
* void (const real_t* in, real_t* out); |
|
||||||
* \endverbatim |
|
||||||
* |
|
||||||
* @param[in] _name Name of exported ODE function. |
|
||||||
*/ |
|
||||||
ExportAcadoFunction( const std::string& _name |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportAcadoFunction( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
/** Initializes ODE function export by taking the differential equation
|
|
||||||
* to be exported as well as the name of the exported ODE. |
|
||||||
* |
|
||||||
* @param[in] _f Differential equation to be exported. |
|
||||||
* @param[in] _name Name of exported ODE function. |
|
||||||
* @param[in] _numX The number of states that are needed to evaluate the system of differential equations |
|
||||||
* (needed when the number of equations is not equal to the number of given states). |
|
||||||
* @param[in] _numXA The number of algebraic states in the input for the evaluation of the system of equations. |
|
||||||
* @param[in] _numU The number of control inputs given for the evaluation of the system of equations. |
|
||||||
* @param[in] _numP The number of parameters given for the evaluation of the system of equations. |
|
||||||
* @param[in] _numDX The number of differential state derivatives given for the evaluation of the system of equations. |
|
||||||
*/ |
|
||||||
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 |
|
||||||
); |
|
||||||
|
|
||||||
/** Exports data declaration of the ODE function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports forward declaration of the ODE function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportForwardDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the ODE function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] string Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether function has been defined.
|
|
||||||
* |
|
||||||
* \return true iff function has been defined, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isDefined( ) const; |
|
||||||
|
|
||||||
/** Get output dimension of the ACADO function. */ |
|
||||||
unsigned getFunctionDim( void ); |
|
||||||
|
|
||||||
/** Get global export variable - a variable that holds intermediate values. */ |
|
||||||
returnValue setGlobalExportVariable(const ExportVariable& var); |
|
||||||
|
|
||||||
/** Set global export variable - a variable that holds intermediate values. */ |
|
||||||
ExportVariable getGlobalExportVariable( ) const; |
|
||||||
|
|
||||||
/** A helper function to check whether a function is external. */ |
|
||||||
bool isExternal() const; |
|
||||||
|
|
||||||
protected: |
|
||||||
/** The number of states that are needed to evaluate the system of differential equations.
|
|
||||||
* If this number isn't specified, then it will be set to the number of equations (minus |
|
||||||
* the number of algebraic states). */ |
|
||||||
unsigned numX; |
|
||||||
/** The number of algebraic states in the input for the evaluation of the system of
|
|
||||||
* equations (similar to numX). */ |
|
||||||
unsigned numXA; |
|
||||||
/** The number of control inputs given for the evaluation of the system of equations
|
|
||||||
* (similar to numX). */ |
|
||||||
unsigned numU; |
|
||||||
/** The number of parameters given for the evaluation of the system of equations. */ |
|
||||||
unsigned numP; |
|
||||||
/** The number of differential state derivatives given for the evaluation of the
|
|
||||||
* system of equations. */ |
|
||||||
unsigned numDX; |
|
||||||
/** The number of "online data" objects. */ |
|
||||||
unsigned numOD; |
|
||||||
/** ACADO function to be exported. */ |
|
||||||
std::shared_ptr< Function > f; |
|
||||||
/** A variable that holds intermediate values. */ |
|
||||||
ExportVariable globalVar; |
|
||||||
/** Flag indicating whether the symbolic function is external or not. */ |
|
||||||
bool external; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FUNCTION_HPP
|
|
@ -1,226 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/export_algorithm.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ALGORITHM_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ALGORITHM_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/user_interaction/algorithmic_base.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/export_variable.hpp> |
|
||||||
#include <acado/code_generation/export_function.hpp> |
|
||||||
#include <acado/code_generation/export_acado_function.hpp> |
|
||||||
#include <acado/code_generation/export_arithmetic_statement.hpp> |
|
||||||
#include <acado/code_generation/export_function_call.hpp> |
|
||||||
#include <acado/code_generation/export_for_loop.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export automatically generated algorithms for fast model predictive control |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportAlgorithm allows to export automatically generated
|
|
||||||
* algorithms for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Milan Vukov, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportAlgorithm : public AlgorithmicBase |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportAlgorithm( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportAlgorithm( ); |
|
||||||
|
|
||||||
/** Initializes code export into given file.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated algorithm to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated algorithm to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated algorithm into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Sets the variables dimensions (ODE).
|
|
||||||
* |
|
||||||
* @param[in] _NX New number of differential states. |
|
||||||
* @param[in] _NU New number of control inputs. |
|
||||||
* @param[in] _NP New number of parameters. |
|
||||||
* @param[in] _NI New number of control intervals. (using _N resulted in a strange error when compiling with cygwin!) |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setDimensions( uint _NX = 0, |
|
||||||
uint _NU = 0, |
|
||||||
uint _NP = 0, |
|
||||||
uint _NI = 0, |
|
||||||
uint _NOD = 0 |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets the variables dimensions (DAE).
|
|
||||||
* |
|
||||||
* @param[in] _NX New number of differential states. |
|
||||||
* @param[in] _NDX New number of differential states derivatives. |
|
||||||
* @param[in] _NXA New number of algebraic states. |
|
||||||
* @param[in] _NU New number of control inputs. |
|
||||||
* @param[in] _NP New number of parameters. |
|
||||||
* @param[in] _NI New number of control intervals. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setDimensions( uint _NX, |
|
||||||
uint _NDX, |
|
||||||
uint _NXA, |
|
||||||
uint _NU, |
|
||||||
uint _NP, |
|
||||||
uint _NI, |
|
||||||
uint _NOD |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of differential states.
|
|
||||||
* |
|
||||||
* \return Number of differential states |
|
||||||
*/ |
|
||||||
uint getNX( ) const; |
|
||||||
|
|
||||||
/** Returns number of algebraic states.
|
|
||||||
* |
|
||||||
* \return Number of algebraic states |
|
||||||
*/ |
|
||||||
uint getNXA( ) const; |
|
||||||
|
|
||||||
/** Returns the number of differential states derivatives.
|
|
||||||
*
|
|
||||||
* \return The requested number of differential state derivatives |
|
||||||
*/ |
|
||||||
uint getNDX( ) const; |
|
||||||
|
|
||||||
/** Returns number of control inputs.
|
|
||||||
* |
|
||||||
* \return Number of control inputs |
|
||||||
*/ |
|
||||||
uint getNU( ) const; |
|
||||||
|
|
||||||
/** Returns number of parameters.
|
|
||||||
* |
|
||||||
* \return Number of parameters |
|
||||||
*/ |
|
||||||
uint getNP( ) const; |
|
||||||
|
|
||||||
/** Returns number of parameters.
|
|
||||||
* |
|
||||||
* \return Number of parameters |
|
||||||
*/ |
|
||||||
uint getNOD( ) const; |
|
||||||
|
|
||||||
/** Returns number of control intervals.
|
|
||||||
* |
|
||||||
* \return Number of control intervals |
|
||||||
*/ |
|
||||||
uint getN( ) const; |
|
||||||
|
|
||||||
void setNY( uint NY_ ); |
|
||||||
uint getNY( ) const; |
|
||||||
|
|
||||||
void setNYN( uint NYN_ ); |
|
||||||
uint getNYN( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
uint NX; /**< Number of differential states. */ |
|
||||||
uint NDX; /**< Number of differential states derivatives. */ |
|
||||||
uint NXA; /**< Number of algebraic states. */ |
|
||||||
uint NU; /**< Number of control inputs. */ |
|
||||||
uint NP; /**< Number of parameters. */ |
|
||||||
uint NOD; /**< Number of "online data" values. */ |
|
||||||
uint N; /**< Number of control intervals. */ |
|
||||||
|
|
||||||
uint NY; /**< Number of references/measurements, nodes 0,..., N - 1. */ |
|
||||||
uint NYN; /**< Number of references/measurements, node N. */ |
|
||||||
|
|
||||||
std::string commonHeaderName; /**< Name of common header file. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ALGORITHM_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,127 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/** \file include/code_generation/export_algorithm_factory.hpp
|
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 |
|
||||||
* */ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ALGORITHM_FACTORY_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ALGORITHM_FACTORY_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_algorithm.hpp> |
|
||||||
#include <acado/utils/acado_types.hpp> |
|
||||||
#include <acado/utils/acado_message_handling.hpp> |
|
||||||
|
|
||||||
#include <map> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/** \brief Factory for creation of exported algorithms.
|
|
||||||
* |
|
||||||
* Note that the class is implemented as a singleton |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 - 2013 |
|
||||||
* */ |
|
||||||
template |
|
||||||
< |
|
||||||
/** Base class, derived from ExportAlgorithm class. */ |
|
||||||
class AlgorithmBase, |
|
||||||
/** Type identifier. */ |
|
||||||
typename AlgorithmType |
|
||||||
> |
|
||||||
class ExportAlgorithmFactory |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Helper type. */ |
|
||||||
typedef AlgorithmBase* (*exportAlgorithmCreator)(UserInteraction* _userInteraction, const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
/** Static creator function. */ |
|
||||||
static ExportAlgorithmFactory& instance() |
|
||||||
{ |
|
||||||
static ExportAlgorithmFactory instance; |
|
||||||
return instance; |
|
||||||
} |
|
||||||
|
|
||||||
/** Function for algorithm registration. */ |
|
||||||
bool registerAlgorithm( const AlgorithmType& id, |
|
||||||
exportAlgorithmCreator creator) |
|
||||||
{ |
|
||||||
bool status = associations_.insert( |
|
||||||
typename idToProductMap::value_type(id, creator)).second; |
|
||||||
|
|
||||||
if ( status == true ) |
|
||||||
return true; |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
/** Function to unregister an algorithm. */ |
|
||||||
bool unregisterAlgorithm( const AlgorithmType& id) |
|
||||||
{ |
|
||||||
bool status = associations_.erase( id ) == 1; |
|
||||||
|
|
||||||
if ( status == true ) |
|
||||||
return true; |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
/** Function to create an instance of an algorithm. */ |
|
||||||
AlgorithmBase* createAlgorithm( UserInteraction* _userInteraction, |
|
||||||
const std::string& _commonHeaderName, |
|
||||||
const AlgorithmType& id) |
|
||||||
{ |
|
||||||
typename idToProductMap::const_iterator it = associations_.find( id ); |
|
||||||
if (it != associations_.end()) |
|
||||||
{ |
|
||||||
return (it->second)(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
|
|
||||||
LOG( LVL_DEBUG ) << "Algorithm is not registered!" << std::endl; |
|
||||||
|
|
||||||
return NULL; |
|
||||||
} |
|
||||||
|
|
||||||
private: |
|
||||||
typedef std::map<AlgorithmType, exportAlgorithmCreator> idToProductMap; |
|
||||||
|
|
||||||
idToProductMap associations_; |
|
||||||
|
|
||||||
ExportAlgorithmFactory() |
|
||||||
{} |
|
||||||
|
|
||||||
ExportAlgorithmFactory(const ExportAlgorithmFactory&); |
|
||||||
|
|
||||||
ExportAlgorithmFactory& operator=(const ExportAlgorithmFactory&); |
|
||||||
|
|
||||||
~ExportAlgorithmFactory() |
|
||||||
{} |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ALGORITHM_FACTORY_HPP
|
|
@ -1,211 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_argument.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ARGUMENT_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ARGUMENT_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
#include <acado/code_generation/export_data.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
class ExportArgumentInternal; |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Defines a matrix-valued variable that can be passed as argument to exported functions. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportArgument defines a matrix-valued variable that
|
|
||||||
* can be passed as argument to exported functions. By default, all entries |
|
||||||
* of an arguments are undefined, but each of its component can be set to
|
|
||||||
* a fixed value if known beforehand. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportArgument : public ExportData |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportArgument( ); |
|
||||||
|
|
||||||
/** Constructor which takes the name, type
|
|
||||||
* and dimensions of the argument. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _nRows Number of rows of the argument. |
|
||||||
* @param[in] _nCols Number of columns of the argument. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
* @param[in] _addressIdx If an address index is specified, not the argument itself but
|
|
||||||
* a pointer to this address within the memory of the argument is passed. |
|
||||||
*/ |
|
||||||
ExportArgument( const std::string& _name, |
|
||||||
uint _nRows = 1, |
|
||||||
uint _nCols = 1, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callByValue = false, |
|
||||||
const ExportIndex& _addressIdx = emptyConstExportIndex, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type of the argument.
|
|
||||||
* Moreover, it initializes the argument with the dimensions and the
|
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
* @param[in] _addressIdx If an address index is specified, not the argument itself but
|
|
||||||
* a pointer to this address within the memory of the argument is passed. |
|
||||||
*/ |
|
||||||
ExportArgument( const std::string& _name, |
|
||||||
const DMatrixPtr& _data, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callByValue = false, |
|
||||||
const ExportIndex& _addressIdx = emptyConstExportIndex, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
ExportArgument( const DMatrix& _data |
|
||||||
); |
|
||||||
|
|
||||||
ExportArgumentInternal* operator->(); |
|
||||||
|
|
||||||
const ExportArgumentInternal* operator->() const; |
|
||||||
|
|
||||||
/** Returns a copy of the argument with address index set to given location.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Row index of the adress. |
|
||||||
* @param[in] colIdx Column index of the adress. |
|
||||||
* |
|
||||||
* \return Copy of the argument with address index set to given location |
|
||||||
*/ |
|
||||||
ExportArgument getAddress( const ExportIndex& _rowIdx, |
|
||||||
const ExportIndex& _colIdx = emptyConstExportIndex |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a string containing the address of the argument to be called.
|
|
||||||
* If an address index has been set, the string contains a pointer to the
|
|
||||||
* desired location. The string also depends on whether the argument is
|
|
||||||
* to be called by value or not. |
|
||||||
* |
|
||||||
* \return String containing the address of the argument |
|
||||||
*/ |
|
||||||
const std::string getAddressString( bool withDataStruct = true |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of rows of the argument.
|
|
||||||
* |
|
||||||
* \return Number of rows of the argument |
|
||||||
*/ |
|
||||||
virtual uint getNumRows( ) const; |
|
||||||
|
|
||||||
/** Returns number of columns of the argument.
|
|
||||||
* |
|
||||||
* \return Number of columns of the argument |
|
||||||
*/ |
|
||||||
virtual uint getNumCols( ) const; |
|
||||||
|
|
||||||
/** Returns total dimension of the argument.
|
|
||||||
* |
|
||||||
* \return Total dimension of the argument |
|
||||||
*/ |
|
||||||
virtual uint getDim( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether all components of the argument are given.
|
|
||||||
* |
|
||||||
* \return true iff all components of the argument have given values, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isGiven( ) const; |
|
||||||
|
|
||||||
/** Returns whether argument is to be called by value.
|
|
||||||
* |
|
||||||
* \return true iff argument is to be called by value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isCalledByValue( ) const; |
|
||||||
|
|
||||||
/** Specifies to call argument by value.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue callByValue( ); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports declaration of the argument into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export declaration. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
static const ExportArgument emptyConstExportArgument; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ARGUMENT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,220 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_argument.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ARGUMENT_INTERNAL_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ARGUMENT_INTERNAL_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
#include <acado/code_generation/export_data_internal.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
class ExportArithmeticStatement; |
|
||||||
class ExportIndex; |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Defines a matrix-valued variable that can be passed as argument to exported functions. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportArgumentInternal defines a matrix-valued variable that |
|
||||||
* can be passed as argument to exported functions. By default, all entries |
|
||||||
* of an arguments are undefined, but each of its component can be set to |
|
||||||
* a fixed value if known beforehand. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportArgumentInternal : public ExportDataInternal |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportArgumentInternal( ); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type of the argument.
|
|
||||||
* Moreover, it initializes the argument with the dimensions and the |
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
* @param[in] _addressIdx If an address index is specified, not the argument itself but |
|
||||||
* a pointer to this address within the memory of the argument is passed. |
|
||||||
*/ |
|
||||||
ExportArgumentInternal( const std::string& _name, |
|
||||||
const DMatrixPtr& _data, |
|
||||||
ExportType _type, |
|
||||||
ExportStruct _dataStruct, |
|
||||||
bool _callByValue, |
|
||||||
const ExportIndex& _addressIdx, |
|
||||||
const std::string& _prefix |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportArgumentInternal( ); |
|
||||||
|
|
||||||
virtual ExportArgumentInternal* clone() const; |
|
||||||
|
|
||||||
/** Deep copy data members. */ |
|
||||||
virtual void deepCopyMembers( std::map<CasADi::SharedObjectNode*, CasADi::SharedObject>& already_copied |
|
||||||
); |
|
||||||
|
|
||||||
/** Returns a copy of the argument with address index set to given location.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Row index of the adress. |
|
||||||
* @param[in] colIdx Column index of the adress. |
|
||||||
* |
|
||||||
* \return Copy of the argument with address index set to given location |
|
||||||
*/ |
|
||||||
ExportArgument getAddress( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx = emptyConstExportIndex |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a string containing the address of the argument to be called.
|
|
||||||
* If an address index has been set, the string contains a pointer to the |
|
||||||
* desired location. The string also depends on whether the argument is |
|
||||||
* to be called by value or not. |
|
||||||
* |
|
||||||
* \return std::string containing the address of the argument |
|
||||||
*/ |
|
||||||
const std::string getAddressString( bool withDataStruct = true |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of rows of the argument.
|
|
||||||
* |
|
||||||
* \return Number of rows of the argument |
|
||||||
*/ |
|
||||||
virtual uint getNumRows( ) const; |
|
||||||
|
|
||||||
/** Returns number of columns of the argument.
|
|
||||||
* |
|
||||||
* \return Number of columns of the argument |
|
||||||
*/ |
|
||||||
virtual uint getNumCols( ) const; |
|
||||||
|
|
||||||
/** Returns total dimension of the argument.
|
|
||||||
* |
|
||||||
* \return Total dimension of the argument |
|
||||||
*/ |
|
||||||
virtual uint getDim( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether all components of the argument are given.
|
|
||||||
* |
|
||||||
* \return true iff all components of the argument have given values, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isGiven( ) const; |
|
||||||
|
|
||||||
/** Returns whether argument is to be called by value.
|
|
||||||
* |
|
||||||
* \return true iff argument is to be called by value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isCalledByValue( ) const; |
|
||||||
|
|
||||||
/** Specifies to call argument by value.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue callByValue( ); |
|
||||||
|
|
||||||
/** Exports declaration of the argument into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export declaration. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Returns column dimension of the argument.
|
|
||||||
* |
|
||||||
* \return Column dimension of the argument |
|
||||||
*/ |
|
||||||
virtual uint getColDim( ) const; |
|
||||||
|
|
||||||
/** Returns total index of given component within memory.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Row index of the component. |
|
||||||
* @param[in] colIdx Column index of the component. |
|
||||||
* |
|
||||||
* \return Total index of given component |
|
||||||
*/ |
|
||||||
virtual ExportIndex getTotalIdx( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
DMatrixPtr data; /**< DMatrix containing the values of each component of the argument
|
|
||||||
* (by default, all entries are undefined). */ |
|
||||||
ExportIndex addressIdx; /**< Address index in case not the argument itself but a pointer to
|
|
||||||
* this address within the memory of the argument is to be passed. */ |
|
||||||
bool callItByValue; /**< Flag indicating whether argument it to be called by value. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ARGUMENT_INTERNAL_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,220 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_argument_list.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ARGUMENT_LIST_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ARGUMENT_LIST_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_argument.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to store a list of calling arguments of an ExportFunction. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportArgumentList allows to store a list of calling
|
|
||||||
* arguments of an ExportFunction. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportArgumentList |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/**< Default Constructor.
|
|
||||||
*/ |
|
||||||
ExportArgumentList( ); |
|
||||||
|
|
||||||
/** Constructor which takes up to nine calling arguments.
|
|
||||||
* |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
*/ |
|
||||||
ExportArgumentList( const ExportArgument& _argument1, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportArgumentList( const ExportArgumentList& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportArgumentList( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportArgumentList& operator=( const ExportArgumentList& rhs |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds up to nine calling arguments to the list.
|
|
||||||
* |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addArgument( const ExportArgument& _argument1, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Return number of calling arguments in list.
|
|
||||||
* |
|
||||||
* \return Number of calling arguments |
|
||||||
*/ |
|
||||||
uint getNumArguments( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports a code snippet containing all calling arguments of the list.
|
|
||||||
* Its appearance can can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Removes all calling arguments to yield an empty argument list.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue clear( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Specifies to include variable types into calling arguments.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue doIncludeType( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Specifies not to include variable types into calling arguments.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue doNotIncludeType( ); |
|
||||||
|
|
||||||
/** Get the list of arguments.
|
|
||||||
* |
|
||||||
* \return Argument list |
|
||||||
*/ |
|
||||||
const std::vector< ExportArgument >& get( ) const; |
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Adds a single calling arguments to the list.
|
|
||||||
* |
|
||||||
* @param[in] _argument Calling argument. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addSingleArgument( const ExportArgument& _argument |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// DATA MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Array containing all calling arguments. */ |
|
||||||
std::vector< ExportArgument > arguments; |
|
||||||
|
|
||||||
/** Flag indicating whether variable types are to be included in calling arguments. */ |
|
||||||
bool includeType; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ARGUMENT_LIST_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,218 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_arithmetic_statement.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
#include <acado/code_generation/export_variable.hpp> |
|
||||||
#include <acado/code_generation/memory_allocator.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code of different arithmetic statements. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportArithmeticStatement allows to export code of different arithmetic
|
|
||||||
* statements of the form: |
|
||||||
* |
|
||||||
* lhs <op0> rhs1 <op1> rhs2 <op2> rhs3, |
|
||||||
* |
|
||||||
* where <op0> can be "=", "+=" or "-=", |
|
||||||
* <op1> can be "+", "-" or "*" and |
|
||||||
* <op2> can be "+" or "-". |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportArithmeticStatement : public ExportStatement |
|
||||||
{ |
|
||||||
friend class ExportVariable; |
|
||||||
|
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportArithmeticStatement( ); |
|
||||||
|
|
||||||
/** Constructor which takes all expressions and operators of the arithmetic statement.
|
|
||||||
* |
|
||||||
* @param[in] _lhs Left-hand side expressions |
|
||||||
* @param[in] _op0 Operator between left- and right-hand side expression. |
|
||||||
* @param[in] _rhs1 First right-hand side expression. |
|
||||||
* @param[in] _op1 Operator between first and second right-hand side expression. |
|
||||||
* @param[in] _rhs2 Second right-hand side expression of arithmetic statement. |
|
||||||
* @param[in] _op2 Operator between second and third right-hand side expression. |
|
||||||
* @param[in] _rhs3 Third right-hand side expression. |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement( const ExportVariable& _lhs, |
|
||||||
ExportStatementOperator _op0, |
|
||||||
const ExportVariable& _rhs1, |
|
||||||
ExportStatementOperator _op1, |
|
||||||
const ExportVariable& _rhs2, |
|
||||||
ExportStatementOperator _op2 = ESO_UNDEFINED, |
|
||||||
const ExportVariable& _rhs3 = 0 |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportArithmeticStatement( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
/** Exports data declaration of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
ExportArithmeticStatement& allocate( MemoryAllocatorPtr allocator ); |
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Exports source code for an addition or subtraction to given file.
|
|
||||||
* Its appearance can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _sign std::string of the operation ("+" or "-"). |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue exportCodeAddSubtract( std::ostream& stream, |
|
||||||
const std::string& _sign = "+", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int" |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code for a multiplication to given file.
|
|
||||||
* Its appearance can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] transposeRhs1 Flag indicating whether rhs1 shall be transposed. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue exportCodeMultiply( std::ostream& stream, |
|
||||||
bool transposeRhs1 = false, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int" |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code for an assignment to given file.
|
|
||||||
* Its appearance can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _op std::string of the assignment operation ("=", "+=" or "-="). |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue exportCodeAssign( std::ostream& stream, |
|
||||||
const std::string& _op = "=", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int" |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
// Refactor this guys as shared pointers
|
|
||||||
ExportVariable lhs; /**< Left-hand side expression of arithmetic statement. */ |
|
||||||
ExportVariable rhs1; /**< First right-hand side expression of arithmetic statement. */ |
|
||||||
ExportVariable rhs2; /**< Second right-hand side expression of arithmetic statement. */ |
|
||||||
ExportVariable rhs3; /**< Third right-hand side expression of arithmetic statement. */ |
|
||||||
|
|
||||||
ExportStatementOperator op0; /**< Operator between left- and right-hand side expression of arithmetic statement. */ |
|
||||||
ExportStatementOperator op1; /**< Operator between first and second right-hand side expression of arithmetic statement. */ |
|
||||||
ExportStatementOperator op2; /**< Operator between second and third right-hand side expression of arithmetic statement. */ |
|
||||||
|
|
||||||
MemoryAllocatorPtr memAllocator; |
|
||||||
|
|
||||||
private: |
|
||||||
std::string getAssignString( ) const; |
|
||||||
|
|
||||||
uint getNumRows( ) const; |
|
||||||
uint getNumCols( ) const; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,96 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_auxiliary_functions.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_AUXILIARY_FUNCTIONS_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_AUXILIARY_FUNCTIONS_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating some helper functions. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportAuxiliaryFunctions |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _moduleName Module name for customization. |
|
||||||
** @param[in] _moduleName Module prefix for customization. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportAuxiliaryFunctions( const std::string& _headerFileName, |
|
||||||
const std::string& _sourceFileName, |
|
||||||
const std::string& _moduleName = "acado", |
|
||||||
const std::string& _modulePrefix = "ACADO", |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "double", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportAuxiliaryFunctions() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( ); |
|
||||||
|
|
||||||
/** Export the interface. */ |
|
||||||
returnValue exportCode(); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
ExportTemplatedFile source; |
|
||||||
ExportTemplatedFile header; |
|
||||||
std::string moduleName; |
|
||||||
std::string modulePrefix; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_AUXILIARY_FUNCTIONS_HPP
|
|
@ -1,122 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_cholesky_decomposition.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_CHOLESKY_DECOMPOSITION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_CHOLESKY_DECOMPOSITION_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_algorithm.hpp> |
|
||||||
#include <acado/code_generation/export_function.hpp> |
|
||||||
#include <acado/code_generation/export_variable.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for exporting a function for calculation of the |
|
||||||
* Cholesky decomposition. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportCholeskyDecomposition: public ExportAlgorithm |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportCholeskyDecomposition( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportCholeskyDecomposition() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes the different parameters of the linear solver that will be exported.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue init( const std::string& _name, |
|
||||||
unsigned _dim, |
|
||||||
bool _unrolling = false |
|
||||||
); |
|
||||||
|
|
||||||
/** Initializes code export into given file.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup(); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated algorithm to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated algorithm to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the auto-generated algorithm into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
/** Get name of the function that perform the decomposition. */ |
|
||||||
const std::string getName(); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
ExportVariable A; |
|
||||||
ExportFunction fcn; |
|
||||||
bool unrolling; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_CHOLESKY_DECOMPOSITION_HPP
|
|
@ -1,90 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_common_header.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_COMMON_HEADER_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_COMMON_HEADER_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Centralized place to export the common header for a generated module. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportCommonHeader : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentstd::string std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportCommonHeader( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportCommonHeader( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const std::string& _moduleName, |
|
||||||
const std::string& _modulePrefix, |
|
||||||
bool _useSinglePrecision, |
|
||||||
bool _useComplexArithmetic, |
|
||||||
QPSolverName _qpSolver, |
|
||||||
const std::map<std::string, std::pair<std::string, std::string> >& _options, |
|
||||||
const std::string& _variables, |
|
||||||
const std::string& _workspace, |
|
||||||
const std::string& _functions |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_COMMON_HEADER_HPP
|
|
@ -1,194 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_data.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_DATA_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_DATA_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <casadi/symbolic/shared_object.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
// Forward declaration
|
|
||||||
class ExportDataInternal; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Abstract base class to define variables to be used for exporting code |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportData serves as an abstract base class to define variables |
|
||||||
* to be used for exporting code. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportData : public CasADi::SharedObject |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportData( ); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportData( ); |
|
||||||
|
|
||||||
/** An operator for access to functions and members of the node
|
|
||||||
*/ |
|
||||||
ExportDataInternal* operator->(); |
|
||||||
|
|
||||||
/** An operator for const access to functions and members of the node
|
|
||||||
*/ |
|
||||||
const ExportDataInternal* operator->() const; |
|
||||||
|
|
||||||
/** Sets the name of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _name New name of the data object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setName( const std::string& _name |
|
||||||
); |
|
||||||
|
|
||||||
/** Sets the data type of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _type New data type of the data object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setType( ExportType _type |
|
||||||
); |
|
||||||
|
|
||||||
/** Sets the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* @param[in] _dataStruct New global data struct to which the data object belongs to. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setDataStruct( ExportStruct _dataStruct |
|
||||||
); |
|
||||||
/** Sets the prefix which is placed before the structure name.
|
|
||||||
* |
|
||||||
* @param[in] _prefix Prefix name. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setPrefix( const std::string& _prefix |
|
||||||
); |
|
||||||
/** Returns the name of the data object.
|
|
||||||
* |
|
||||||
* \return Name of the data object |
|
||||||
*/ |
|
||||||
std::string getName( ) const; |
|
||||||
|
|
||||||
/** Returns the data type of the data object.
|
|
||||||
* |
|
||||||
* \return Data type of the data object |
|
||||||
*/ |
|
||||||
ExportType getType( ) const; |
|
||||||
|
|
||||||
/** Returns a string containing the data type of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* |
|
||||||
* \return std::string containing the data type of the data object. |
|
||||||
*/ |
|
||||||
std::string getTypeString( const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int" |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* \return Global data struct to which the data object belongs to |
|
||||||
*/ |
|
||||||
ExportStruct getDataStruct( ) const; |
|
||||||
|
|
||||||
/** Returns a string containing the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* \return std::string containing the global data struct to which the data object belongs to. |
|
||||||
*/ |
|
||||||
std::string getDataStructString( ) const; |
|
||||||
|
|
||||||
/** Returns a string which contains a prefix name.
|
|
||||||
* |
|
||||||
* \return Prefix name |
|
||||||
*/ |
|
||||||
std::string getPrefix( ) const; |
|
||||||
|
|
||||||
/** Returns the full name of the data object including the possible prefix
|
|
||||||
* of the global data struct. |
|
||||||
* |
|
||||||
* \return Full name of the data object |
|
||||||
*/ |
|
||||||
std::string getFullName( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports declaration of the index variable. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether the index is set to a given value.
|
|
||||||
* |
|
||||||
* \return true iff index is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isGiven( ); |
|
||||||
|
|
||||||
virtual returnValue setDoc(const std::string& _doc); |
|
||||||
|
|
||||||
virtual std::string getDoc() const; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_DATA_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,146 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_data_declaration.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_DATA_DECLARATION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_DATA_DECLARATION_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
#include <acado/code_generation/export_variable.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code containing variable declarations. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportDataDeclaration allows to export code containing variable
|
|
||||||
* declarations of different data types. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportDataDeclaration : public ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportDataDeclaration( ); |
|
||||||
|
|
||||||
/** Constructor taking the variable to be declared.
|
|
||||||
* |
|
||||||
* @param[in] _data Variable to be declared. |
|
||||||
*/ |
|
||||||
ExportDataDeclaration( const ExportVariable& _data |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor taking the index variable to be declared.
|
|
||||||
* |
|
||||||
* @param[in] _data Index Variable to be declared. |
|
||||||
*/ |
|
||||||
ExportDataDeclaration( const ExportIndex& _data |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportDataDeclaration( const ExportDataDeclaration& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportDataDeclaration( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportDataDeclaration& operator=( const ExportDataDeclaration& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportData data; /**< Variable to be declared. */ |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_DATA_DECLARATION_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,201 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_DATA_INTERNAL_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_DATA_INTERNAL_HPP |
|
||||||
|
|
||||||
#include <casadi/symbolic/shared_object.hpp> |
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportDataInternal : public CasADi::SharedObjectNode |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor which optionally takes name and type string
|
|
||||||
* of the data object. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the data object. |
|
||||||
* @param[in] _type Data type of the data object. |
|
||||||
* @param[in] _dataStruct Global data struct to which the data object belongs to (if any). |
|
||||||
* @param[in] _prefix Optional prefix that will be put in front of the name. |
|
||||||
*/ |
|
||||||
explicit ExportDataInternal( const std::string& _name = std::string(), |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportDataInternal( ); |
|
||||||
|
|
||||||
virtual ExportDataInternal* clone() const = 0; |
|
||||||
|
|
||||||
/** Sets the name of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _name New name of the data object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setName( const std::string& _name |
|
||||||
); |
|
||||||
|
|
||||||
/** Sets the data type of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _type New data type of the data object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setType( ExportType _type |
|
||||||
); |
|
||||||
|
|
||||||
/** Sets the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* @param[in] _dataStruct New global data struct to which the data object belongs to. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setDataStruct( ExportStruct _dataStruct |
|
||||||
); |
|
||||||
|
|
||||||
/** Sets the prefix which is placed before the structure name.
|
|
||||||
* |
|
||||||
* @param[in] _prefix Prefix name. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setPrefix( const std::string& _prefix |
|
||||||
); |
|
||||||
/** Returns the name of the data object.
|
|
||||||
* |
|
||||||
* \return Name of the data object |
|
||||||
*/ |
|
||||||
std::string getName( ) const; |
|
||||||
|
|
||||||
/** Returns the data type of the data object.
|
|
||||||
* |
|
||||||
* \return Data type of the data object |
|
||||||
*/ |
|
||||||
ExportType getType( ) const; |
|
||||||
|
|
||||||
/** Returns a string containing the data type of the data object.
|
|
||||||
* |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* |
|
||||||
* \return std::string containing the data type of the data object. |
|
||||||
*/ |
|
||||||
std::string getTypeString( const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int" |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* \return Global data struct to which the data object belongs to |
|
||||||
*/ |
|
||||||
ExportStruct getDataStruct( ) const; |
|
||||||
|
|
||||||
/** Returns a string containing the global data struct to which the data object belongs to.
|
|
||||||
* |
|
||||||
* \return String containing the global data struct to which the data object belongs to. |
|
||||||
*/ |
|
||||||
std::string getDataStructString( ) const; |
|
||||||
|
|
||||||
/** Returns a string which contains a prefix name.
|
|
||||||
* |
|
||||||
* \return Prefix name |
|
||||||
*/ |
|
||||||
std::string getPrefix( ) const; |
|
||||||
|
|
||||||
/** Returns the full name of the data object including the possible prefix
|
|
||||||
* of the global data struct. |
|
||||||
* |
|
||||||
* \return Full name of the data object |
|
||||||
*/ |
|
||||||
std::string getFullName( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports declaration of the index variable. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
/** Returns whether the index is set to a given value.
|
|
||||||
* |
|
||||||
* \return true iff index is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isGiven( ) const = 0; |
|
||||||
|
|
||||||
virtual returnValue setDoc( const std::string& _doc ); |
|
||||||
virtual std::string getDoc( ) const; |
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
returnValue setFullName( void ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Name of the data object. */ |
|
||||||
std::string name; |
|
||||||
|
|
||||||
/** Data type of the data object. */ |
|
||||||
ExportType type; |
|
||||||
|
|
||||||
/** Prefix, which is added before the structure name*/ |
|
||||||
std::string prefix; |
|
||||||
|
|
||||||
/** Global data struct to which the data object belongs to (if any). */ |
|
||||||
ExportStruct dataStruct; |
|
||||||
|
|
||||||
/** Full name of the data object including the possible prefix of the global data struct. */ |
|
||||||
std::string fullName; |
|
||||||
|
|
||||||
/** Description of the variable */ |
|
||||||
std::string description; |
|
||||||
|
|
||||||
|
|
||||||
public: |
|
||||||
static std::string fcnPrefix; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_DATA_INTERNAL_HPP
|
|
@ -1,102 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_exact_hessian_cn2.hpp |
|
||||||
* \authors Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_CN2_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_CN2_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
#include <acado/code_generation/export_gauss_newton_cn2.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief TBD |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Rien Quirynen |
|
||||||
* |
|
||||||
* \note Early experimental implementation |
|
||||||
*/ |
|
||||||
class ExportExactHessianCN2 : public ExportGaussNewtonCN2 |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportExactHessianCN2( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportExactHessianCN2( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Setting up of a Hessian regularization routine */ |
|
||||||
virtual returnValue setupHessianRegularization( void ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_CN2_HPP
|
|
@ -1,115 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_qpdunes.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_QPDUNES_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_QPDUNES_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
#include <acado/code_generation/export_gauss_newton_qpdunes.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for export of an OCP solver using sparse QP solver qpDUNES |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportExactHessianQpDunes allows export of an OCP solver using |
|
||||||
* the generalized Exact-Hessian method. The underlying QP is solved using the |
|
||||||
* structured sparse QP solver qpDUNES. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExportExactHessianQpDunes : public ExportGaussNewtonQpDunes |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportExactHessianQpDunes( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportExactHessianQpDunes( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Setting up of a Hessian regularization routine */ |
|
||||||
virtual returnValue setupHessianRegularization( void ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_EXACT_HESSIAN_QPDUNES_HPP
|
|
@ -1,126 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/export_file.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FILE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FILE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_statement_block.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export files containing automatically generated algorithms for fast model predictive control |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportFile allows to export files containing automatically generated
|
|
||||||
* algorithms for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Milan Vukov, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportFile : public ExportStatementBlock |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportFile( ); |
|
||||||
|
|
||||||
/** Standard constructor.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
*/ |
|
||||||
ExportFile( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportFile( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Setup routine.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the file containing the auto-generated code.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
std::string fileName; /**< Name of exported file. */ |
|
||||||
std::string commonHeaderName; /**< Name of common header file. */ |
|
||||||
|
|
||||||
std::string realString; /**< std::string to be used to declare real variables. */ |
|
||||||
std::string intString; /**< std::string to be used to declare integer variables. */ |
|
||||||
int precision; /**< Number of digits to be used for exporting real values. */ |
|
||||||
std::string commentString; /**< std::string to be used for exporting comments. */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FILE_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,205 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_for_loop.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
#include <acado/code_generation/export_statement_block.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code of a for-loop. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportForLoop allows to export code of a for-loop. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportForLoop : public ExportStatementBlock |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor which optionally takes the name of the
|
|
||||||
* loop variable as well as other loop settings. |
|
||||||
* |
|
||||||
* @param[in] _loopVariable Name of the loop variable. |
|
||||||
* @param[in] _startValue Start value of the loop counter. |
|
||||||
* @param[in] _finalValue Final value of the loop counter. |
|
||||||
* @param[in] _increment Increment of the loop counter. |
|
||||||
* @param[in] _doLoopUnrolling Flag indicating whether loop shall be unrolled. |
|
||||||
*/ |
|
||||||
ExportForLoop( const ExportIndex& _loopVariable = emptyConstExportIndex, |
|
||||||
const ExportIndex& _startValue = emptyConstExportIndex, |
|
||||||
const ExportIndex& _finalValue = emptyConstExportIndex, |
|
||||||
const ExportIndex& _increment = constExportIndexValueOne, |
|
||||||
bool _doLoopUnrolling = false |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportForLoop( const ExportForLoop& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportForLoop( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportForLoop& operator=( const ExportForLoop& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
/** Initializes for-loop with given loop settings.
|
|
||||||
* |
|
||||||
* @param[in] _loopVariable Name of the loop variable. |
|
||||||
* @param[in] _startValue Start value of the loop counter. |
|
||||||
* @param[in] _finalValue Final value of the loop counter. |
|
||||||
* @param[in] _increment Increment of the loop counter. |
|
||||||
* @param[in] _doLoopUnrolling Flag indicating whether loop shall be unrolled. |
|
||||||
*/ |
|
||||||
returnValue init( const ExportIndex& _loopVariable, |
|
||||||
const ExportIndex& _startValue, |
|
||||||
const ExportIndex& _finalValue, |
|
||||||
const ExportIndex& _increment, |
|
||||||
bool _doLoopUnrolling |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports data declaration of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Specifies to unroll for-loop.
|
|
||||||
* |
|
||||||
* \return Reference to for-loop object |
|
||||||
*/ |
|
||||||
ExportForLoop& unrollLoop( ); |
|
||||||
|
|
||||||
/** Specifies not to unroll for-loop.
|
|
||||||
* |
|
||||||
* \return Loop-unrolled copy of for-loop object |
|
||||||
*/ |
|
||||||
ExportForLoop& keepLoop( ); |
|
||||||
|
|
||||||
ExportForLoop& allocate(MemoryAllocatorPtr allocator); |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Frees internal dynamic memory to yield an empty for-loop.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue clear( ); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
returnValue sanityCheck( void ) const; |
|
||||||
|
|
||||||
//
|
|
||||||
// DATA MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportIndex loopVariable; /**< Loop variable. */ |
|
||||||
ExportIndex startValue; /**< Start value of the loop counter. */ |
|
||||||
ExportIndex finalValue; /**< Final value of the loop counter. */ |
|
||||||
ExportIndex increment; /**< Increment of the loop counter. */ |
|
||||||
|
|
||||||
bool doLoopUnrolling; /**< Flag indicating whether loop shall be unrolled when exporting the code. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,100 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_forces_generator.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FORCES_GENERATOR_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FORCES_GENERATOR_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Generator of the FORCES interface, the to, be called from MATLAB |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportForcesGenerator : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _templateName Name of a template. |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportForcesGenerator( const std::string& _templateName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportForcesGenerator( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const unsigned _nx, |
|
||||||
const unsigned _nu, |
|
||||||
const unsigned _NN, |
|
||||||
const std::vector< std::vector< unsigned > >& _lbIdx, |
|
||||||
const std::vector< std::vector< unsigned > >& _ubIdx, |
|
||||||
const std::vector< unsigned >& _AbDim, |
|
||||||
const bool _constHessian, |
|
||||||
const bool _diagHessian, |
|
||||||
const bool _diagHessianN, |
|
||||||
const bool _fixedInitialState, |
|
||||||
const std::string& _solverName, |
|
||||||
const unsigned _printLevel, |
|
||||||
const unsigned _maxIterations, |
|
||||||
const unsigned _parallel, |
|
||||||
bool matlabGenerator, |
|
||||||
bool warmStart |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FORCES_GENERATOR_HPP
|
|
@ -1,91 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_forces_interface.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FORCES_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FORCES_INTERFACE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for configuration and export for interface to the FORCES QP solver |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportForcesInterface : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _templateName Name of a template. |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentstd::string std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportForcesInterface( const std::string& _templateName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportForcesInterface( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const std::string& _forcesHeader, |
|
||||||
const std::string& _forcesParams, |
|
||||||
const std::string& _forcesParamsObj, |
|
||||||
const std::string& _forcesOutput, |
|
||||||
const std::string& _forcesOutputObj, |
|
||||||
const std::string& _forcesInfo, |
|
||||||
const std::string& _forcesInfoObj |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FORCES_INTERFACE_HPP
|
|
@ -1,303 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_function.hpp |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FUNCTION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FUNCTION_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_variable.hpp> |
|
||||||
#include <acado/code_generation/export_argument_list.hpp> |
|
||||||
#include <acado/code_generation/export_statement_block.hpp> |
|
||||||
#include <acado/code_generation/export_statement_string.hpp> |
|
||||||
#include <acado/code_generation/memory_allocator.hpp> |
|
||||||
|
|
||||||
#include <memory> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code of an arbitrary function. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportFunction allows to export code of an arbitrary function. |
|
||||||
* |
|
||||||
*/ |
|
||||||
class ExportFunction : public ExportStatementBlock |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor which optionally takes the name of the function
|
|
||||||
* as well as possible calling arguments. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the function. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
*/ |
|
||||||
ExportFunction( const std::string& _name = "defaultFunctionName", |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportFunction( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
/** Initializes function with given name and possible calling arguments.
|
|
||||||
* |
|
||||||
* @param[in] _name Name of the function. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue init( const std::string& _name = "defaultFunctionName", |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Initializes function with given name and possible calling arguments.
|
|
||||||
* |
|
||||||
* @param[in] _name Name of the function. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return Reference to initialized object |
|
||||||
*/ |
|
||||||
ExportFunction& setup( const std::string& _name = "defaultFunctionName", |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds up to nine calling arguments to the function.
|
|
||||||
* |
|
||||||
* @param[in] _name Name of the function. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addArgument( const ExportArgument& _argument1, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Assigns a return value to the function (by default, its return value is void).
|
|
||||||
* |
|
||||||
* @param[in] _functionReturnValue New return value of the function. |
|
||||||
* @param[in] _returnAsPointer Flag indicating whether value shall be returned as pointer. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportFunction& setReturnValue( const ExportVariable& _functionReturnValue, |
|
||||||
bool _returnAsPointer = false |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets the name of the function. */ |
|
||||||
ExportFunction& setName(const std::string& _name); |
|
||||||
|
|
||||||
/** Returns the name of the function. */ |
|
||||||
std::string getName( ) const; |
|
||||||
|
|
||||||
/** Exports data declaration of the function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] file Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports forward declaration of the function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportForwardDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the function into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export function. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether function has been defined.
|
|
||||||
* |
|
||||||
* \return true iff function has been defined, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isDefined( ) const; |
|
||||||
|
|
||||||
/** Return number of calling arguments of the function. */ |
|
||||||
unsigned getNumArguments( ) const; |
|
||||||
|
|
||||||
/** Add a new index (local) index to the function */ |
|
||||||
ExportFunction& addIndex( const ExportIndex& _index ); |
|
||||||
|
|
||||||
/** Add a new index (local) variable to the function. */ |
|
||||||
ExportFunction& addVariable( const ExportVariable& _var ); |
|
||||||
|
|
||||||
/** Acquire a local variable. */ |
|
||||||
virtual ExportFunction& acquire( ExportIndex& obj ); |
|
||||||
|
|
||||||
/** Release a local variable. */ |
|
||||||
virtual ExportFunction& release( const ExportIndex& obj ); |
|
||||||
|
|
||||||
/** Set a documentation string. */ |
|
||||||
virtual ExportFunction& doc( const std::string& _doc ); |
|
||||||
|
|
||||||
/** Set the function as private. If this is true, then do not export it's declaration. */ |
|
||||||
virtual ExportFunction& setPrivate( bool _set = true ); |
|
||||||
|
|
||||||
/** Is function private? */ |
|
||||||
virtual bool isPrivate() const; |
|
||||||
|
|
||||||
protected: |
|
||||||
/** Frees internal dynamic memory to yield an empty function.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue clear( ); |
|
||||||
|
|
||||||
/** Name of the function. */ |
|
||||||
std::string name; |
|
||||||
/** A description string. */ |
|
||||||
std::string description; |
|
||||||
|
|
||||||
/** List of calling arguments. */ |
|
||||||
ExportArgumentList functionArguments; |
|
||||||
/** Return value of the function. */ |
|
||||||
ExportVariable retVal; |
|
||||||
/** Flag indicating whether value shall be returned as pointer. */ |
|
||||||
bool returnAsPointer; |
|
||||||
/** Memory allocator */ |
|
||||||
MemoryAllocatorPtr memAllocator; |
|
||||||
/** Array of local variables. */ |
|
||||||
std::vector< ExportVariable > localVariables; |
|
||||||
/** Private flag. In principle if this guy is true, do not export function declaration. */ |
|
||||||
bool flagPrivate; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FUNCTION_HPP
|
|
@ -1,249 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_function_call.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FUNCTION_CALL_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FUNCTION_CALL_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
#include <acado/code_generation/export_function.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code of a function call. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportFunctionCall allows to export code of a function call. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportFunctionCall : public ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor which optionally takes the name of the function
|
|
||||||
* to be called as well as possible calling arguments. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the function to be called. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
*/ |
|
||||||
ExportFunctionCall( const std::string& _name = "acadoFcn", |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which optionally takes the function to be called
|
|
||||||
* as well as possible calling arguments. |
|
||||||
* |
|
||||||
* @param[in] _f Function to be called. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
*/ |
|
||||||
ExportFunctionCall( const ExportFunction& _f, |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportFunctionCall( const ExportFunctionCall& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportFunctionCall( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportFunctionCall& operator=( const ExportFunctionCall& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes function call with given name of the function and possible calling arguments.
|
|
||||||
* |
|
||||||
* @param[in] _name Name of the function to be called. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue init( const std::string& _name = "defaultFunctionName", |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Initializes function call with function to be called and possible calling arguments.
|
|
||||||
* |
|
||||||
* @param[in] _f Function to be called. |
|
||||||
* @param[in] _argument1 Calling argument no. 1. |
|
||||||
* @param[in] _argument2 Calling argument no. 2. |
|
||||||
* @param[in] _argument3 Calling argument no. 3. |
|
||||||
* @param[in] _argument4 Calling argument no. 4. |
|
||||||
* @param[in] _argument5 Calling argument no. 5. |
|
||||||
* @param[in] _argument6 Calling argument no. 6. |
|
||||||
* @param[in] _argument7 Calling argument no. 7. |
|
||||||
* @param[in] _argument8 Calling argument no. 8. |
|
||||||
* @param[in] _argument9 Calling argument no. 9. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_INVALID_CALL_TO_EXPORTED_FUNCTION |
|
||||||
*/ |
|
||||||
returnValue init( const ExportFunction& _f, |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the function call into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export function call. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_MEMBER_NOT_INITIALISED |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Frees internal dynamic memory to yield an empty function call.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue clear( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets the name of the function to be called.
|
|
||||||
* |
|
||||||
* @param[in] _name New name of the function to be called. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setName( const std::string& _name |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
std::string name; /**< Name of function to be called. */ |
|
||||||
ExportArgumentList functionArguments; /**< List of calling arguments. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_STATEMENT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,109 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_function_declaration.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_FUNCTION_DECLARATION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_FUNCTION_DECLARATION_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
#include <acado/code_generation/export_function.hpp> |
|
||||||
#include <acado/code_generation/export_acado_function.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code containing function (forward) declarations. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportDataDeclaration allows to export code containing function
|
|
||||||
* (forward) declarations. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportFunctionDeclaration : public ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Constructor taking the function to be declared.
|
|
||||||
* |
|
||||||
* @param[in] _f Function to be declared. |
|
||||||
*/ |
|
||||||
ExportFunctionDeclaration( const ExportFunction& _f |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor taking the ODE function to be declared.
|
|
||||||
* |
|
||||||
* @param[in] _f ODE function to be declared. |
|
||||||
*/ |
|
||||||
ExportFunctionDeclaration( const ExportAcadoFunction& _f |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportFunctionDeclaration( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
/** Exports source code of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
private: |
|
||||||
ExportFunctionDeclaration( ); |
|
||||||
|
|
||||||
const ExportFunction& f; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_FUNCTION_DECLARATION_HPP
|
|
@ -1,176 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_block_cn2.hpp |
|
||||||
* \authors Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_CN2_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_CN2_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_gauss_newton_cn2.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportQpDunesInterface; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief An OCP solver based on the block N^2 condensing algorithm. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Rien Quirynen |
|
||||||
* |
|
||||||
* \note Still a limited experimental version |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonBlockCN2 : public ExportGaussNewtonCN2 |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonBlockCN2( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportGaussNewtonBlockCN2( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
uint getBlockSize( ) const; |
|
||||||
|
|
||||||
uint getNumberOfBlocks( ) const; |
|
||||||
|
|
||||||
uint getNumBlockVariables( ) const; |
|
||||||
|
|
||||||
virtual unsigned getNumStateBoundsPerBlock( ) const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ) = 0; |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ) = 0; |
|
||||||
|
|
||||||
virtual returnValue setupCondensing( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportIndex blockI; |
|
||||||
|
|
||||||
std::vector< unsigned > qpConDim; |
|
||||||
|
|
||||||
ExportVariable qpgN; |
|
||||||
|
|
||||||
ExportVariable qpH; |
|
||||||
ExportVariable qpC; |
|
||||||
ExportVariable qpc; |
|
||||||
ExportVariable qpLb0, qpUb0; |
|
||||||
|
|
||||||
ExportVariable qpLambda, qpMu; |
|
||||||
|
|
||||||
ExportFunction cleanup; |
|
||||||
ExportFunction shiftQpData; |
|
||||||
|
|
||||||
ExportFunction evaluateConstraints; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_CN2_HPP
|
|
@ -1,142 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_block_forces.hpp |
|
||||||
* \authors Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_FORCES_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_FORCES_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_gauss_newton_block_cn2.hpp> |
|
||||||
#include <acado/code_generation/export_forces_interface.hpp> |
|
||||||
#include <acado/code_generation/export_forces_generator.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportQpDunesInterface; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief An OCP solver based on the block N^2 condensing algorithm, in combination with qpDUNES as the QP solver. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Rien Quirynen |
|
||||||
* |
|
||||||
* \note Still a limited experimental version |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonBlockForces : public ExportGaussNewtonBlockCN2 |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonBlockForces( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportGaussNewtonBlockForces( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
virtual returnValue setupCondensing( ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** \name QP interface */ |
|
||||||
/** @{ */ |
|
||||||
std::string qpModuleName; |
|
||||||
std::string qpObjPrefix; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
std::vector< ExportVariable > objHessians; |
|
||||||
std::vector< ExportVariable > objGradients; |
|
||||||
|
|
||||||
std::vector< ExportVariable > conLB; |
|
||||||
std::vector< ExportVariable > conUB; |
|
||||||
std::vector< std::vector< unsigned > > conLBIndices, conUBIndices; |
|
||||||
|
|
||||||
std::vector< ExportVariable > conA, conAB; |
|
||||||
ExportFunction evaluateAffineConstraints; |
|
||||||
std::vector< unsigned > conABDimensions; |
|
||||||
|
|
||||||
std::vector< ExportVariable > conC; |
|
||||||
std::vector< ExportVariable > cond; |
|
||||||
|
|
||||||
/** FORCES interface object. */ |
|
||||||
std::shared_ptr< ExportForcesInterface > qpInterface; |
|
||||||
std::shared_ptr< ExportForcesGenerator > qpGenerator; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_QPDUNES_HPP
|
|
@ -1,105 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_block_qpdunes.hpp |
|
||||||
* \authors Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_QPDUNES_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_QPDUNES_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_gauss_newton_block_cn2.hpp> |
|
||||||
#include <acado/code_generation/export_split_qpdunes_interface.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportQpDunesInterface; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief An OCP solver based on the block N^2 condensing algorithm, in combination with qpDUNES as the QP solver. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Rien Quirynen |
|
||||||
* |
|
||||||
* \note Still a limited experimental version |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonBlockQpDunes : public ExportGaussNewtonBlockCN2 |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonBlockQpDunes( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportGaussNewtonBlockQpDunes( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** qpDUNES interface object. */ |
|
||||||
std::shared_ptr< ExportSplitQpDunesInterface > qpInterface; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_BLOCK_QPDUNES_HPP
|
|
@ -1,259 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_cn2.hpp |
|
||||||
* \authors Milan Vukov, Joel Andersson, Rien Quirynen |
|
||||||
* \date 2013 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief An OCP solver based on the N^2 condensing algorithm |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Milan Vukov, Joel Andersson |
|
||||||
* |
|
||||||
* \note Still a limited experimental version |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonCN2 : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonCN2( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportGaussNewtonCN2( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
/** Returns number of bounds on differential states.
|
|
||||||
* |
|
||||||
* \return Number of bounds on differential states |
|
||||||
*/ |
|
||||||
virtual unsigned getNumStateBounds( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
virtual returnValue setupCondensing( ); |
|
||||||
|
|
||||||
bool performFullCondensing( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
ExportVariable x0, Dx0; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjS1; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
|
|
||||||
/** Variable containing the QP Hessian matrix. */ |
|
||||||
ExportVariable H; |
|
||||||
/** Variable containing the QP constraint matrix. */ |
|
||||||
ExportVariable A; |
|
||||||
|
|
||||||
/** Variable containing the QP gradient. */ |
|
||||||
ExportVariable g; |
|
||||||
|
|
||||||
/** Variable containing the lower limits on QP variables. */ |
|
||||||
ExportVariable lb; |
|
||||||
|
|
||||||
/** Variable containing the upper limits on QP variables. */ |
|
||||||
ExportVariable ub; |
|
||||||
|
|
||||||
/** Variable containing lower limits on QP constraints. */ |
|
||||||
ExportVariable lbA; |
|
||||||
|
|
||||||
/** Variable containing upper limits on QP constraints. */ |
|
||||||
ExportVariable ubA; |
|
||||||
|
|
||||||
/** Variable containing the primal QP variables. */ |
|
||||||
ExportVariable xVars; |
|
||||||
|
|
||||||
/** Variable containing the dual QP variables. */ |
|
||||||
ExportVariable yVars; |
|
||||||
|
|
||||||
std::vector< unsigned > xBoundsIdx; |
|
||||||
ExportVariable lbValues, ubValues; |
|
||||||
ExportVariable lbAValues, ubAValues; |
|
||||||
|
|
||||||
ExportFunction condensePrep; |
|
||||||
ExportFunction condenseFdb; |
|
||||||
ExportFunction expand; |
|
||||||
|
|
||||||
ExportVariable C, E, QDy, Qd; |
|
||||||
|
|
||||||
ExportFunction multGxd; |
|
||||||
ExportFunction moveGxT; |
|
||||||
ExportFunction multGxGx; |
|
||||||
ExportFunction multGxGu; |
|
||||||
ExportFunction moveGuE; |
|
||||||
ExportFunction copyHTH; |
|
||||||
ExportFunction copyHTH1; |
|
||||||
ExportFunction multQ1d; |
|
||||||
ExportFunction multQN1d; |
|
||||||
ExportFunction multRDy; |
|
||||||
ExportFunction multQDy; |
|
||||||
ExportFunction multEQDy; |
|
||||||
ExportFunction multQETGx; |
|
||||||
ExportFunction multEDu; |
|
||||||
ExportFunction multQ1Gx; |
|
||||||
ExportFunction multQN1Gx; |
|
||||||
ExportFunction multQ1Gu; |
|
||||||
ExportFunction multQN1Gu; |
|
||||||
|
|
||||||
ExportFunction multHxC; |
|
||||||
ExportFunction multHxE; |
|
||||||
ExportFunction macHxd; |
|
||||||
|
|
||||||
/** \name Contraint evaluation variables */ |
|
||||||
/** @{ */ |
|
||||||
ExportVariable A10; |
|
||||||
ExportVariable A20; |
|
||||||
ExportVariable pacA01Dx0; |
|
||||||
ExportVariable pocA02Dx0; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
|
|
||||||
//
|
|
||||||
// N2 condensing related
|
|
||||||
//
|
|
||||||
ExportVariable T1, T2, W1, W2; |
|
||||||
ExportVariable sbar, w1, w2; |
|
||||||
|
|
||||||
ExportFunction multBTW1, macBTW1_R1, multGxTGu, macQEW2, mac_S1T_E; |
|
||||||
ExportFunction macATw1QDy, macBTw1, macQSbarW2, macASbar, macS1TSbar; |
|
||||||
ExportFunction expansionStep; |
|
||||||
|
|
||||||
// lagrange multipliers
|
|
||||||
ExportFunction expansionStep2; |
|
||||||
|
|
||||||
// H00 and H10 computations
|
|
||||||
ExportFunction mult_BT_T1, mac_ST_C, multGxTGx, macGxTGx; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_HPP
|
|
@ -1,278 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_cn2_factorization.hpp |
|
||||||
* \authors Milan Vukov |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
#include <acado/code_generation/linear_solvers/export_cholesky_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief TBD |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* \authors Milan Vukov |
|
||||||
* |
|
||||||
* \note Early experimental implementation |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonCn2Factorization : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonCn2Factorization( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportGaussNewtonCn2Factorization( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
/** Returns number of bounds on differential states.
|
|
||||||
* |
|
||||||
* \return Number of bounds on differential states |
|
||||||
*/ |
|
||||||
virtual unsigned getNumStateBounds( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
virtual returnValue setupCondensing( ); |
|
||||||
|
|
||||||
bool performFullCondensing( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
ExportVariable x0, Dx0; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
|
|
||||||
/** Variable containing the QP Hessian matrix. */ |
|
||||||
ExportVariable H, H00, H10, H11; |
|
||||||
/** Variable containing factorization of the QP Hessian matrix; R' * R = H. */ |
|
||||||
ExportVariable U; |
|
||||||
/** Variable containing the QP constraint matrix. */ |
|
||||||
ExportVariable A; |
|
||||||
|
|
||||||
/** Variable containing the QP gradient. */ |
|
||||||
ExportVariable g, g0, g1; |
|
||||||
|
|
||||||
/** Variable containing the lower limits on QP variables. */ |
|
||||||
ExportVariable lb; |
|
||||||
|
|
||||||
/** Variable containing the upper limits on QP variables. */ |
|
||||||
ExportVariable ub; |
|
||||||
|
|
||||||
/** Variable containing lower limits on QP constraints. */ |
|
||||||
ExportVariable lbA; |
|
||||||
|
|
||||||
/** Variable containing upper limits on QP constraints. */ |
|
||||||
ExportVariable ubA; |
|
||||||
|
|
||||||
/** Variable containing the primal QP variables. */ |
|
||||||
ExportVariable xVars; |
|
||||||
|
|
||||||
/** Variable containing the dual QP variables. */ |
|
||||||
ExportVariable yVars; |
|
||||||
|
|
||||||
std::vector< unsigned > xBoundsIdxRev, xBoundsIdx; |
|
||||||
ExportVariable lbValues, ubValues; |
|
||||||
ExportVariable lbAValues, ubAValues; |
|
||||||
|
|
||||||
ExportVariable Qd; |
|
||||||
|
|
||||||
ExportFunction condensePrep; |
|
||||||
ExportFunction condenseFdb; |
|
||||||
ExportFunction expand; |
|
||||||
|
|
||||||
ExportVariable E, QE, QGx, QDy; |
|
||||||
|
|
||||||
ExportFunction multGxd; |
|
||||||
ExportFunction moveGxT; |
|
||||||
ExportFunction multGxGx; |
|
||||||
ExportFunction multGxGu; |
|
||||||
ExportFunction moveGuE; |
|
||||||
ExportFunction setBlockH11; |
|
||||||
ExportFunction zeroBlockH11; |
|
||||||
ExportFunction copyHTH; |
|
||||||
ExportFunction multQ1d; |
|
||||||
ExportFunction multQN1d; |
|
||||||
ExportFunction multRDy; |
|
||||||
ExportFunction multQDy; |
|
||||||
ExportFunction multEQDy; |
|
||||||
ExportFunction multQETGx; |
|
||||||
ExportFunction zeroBlockH10; |
|
||||||
ExportFunction multEDu; |
|
||||||
ExportFunction multQ1Gx; |
|
||||||
ExportFunction multQN1Gx; |
|
||||||
ExportFunction multQ1Gu; |
|
||||||
ExportFunction multQN1Gu; |
|
||||||
ExportFunction zeroBlockH00; |
|
||||||
ExportFunction multCTQC; |
|
||||||
|
|
||||||
ExportVariable A10; |
|
||||||
ExportVariable A20; |
|
||||||
ExportVariable pacA01Dx0; |
|
||||||
ExportVariable pocA02Dx0; |
|
||||||
ExportFunction multHxC; |
|
||||||
ExportFunction multHxE; |
|
||||||
ExportFunction macHxd; |
|
||||||
|
|
||||||
ExportFunction macCTSlx; |
|
||||||
ExportFunction macETSlu; |
|
||||||
|
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
|
|
||||||
// N2 condensing related
|
|
||||||
ExportVariable W1, W2; |
|
||||||
ExportVariable sbar, w1, w2; |
|
||||||
|
|
||||||
ExportFunction mult_H_W2T_W3, mac_H_W2T_W3_R, mac_W3_G_W1T_G; |
|
||||||
|
|
||||||
ExportFunction multBTW1, macBTW1_R1, multGxTGu, macQEW2; |
|
||||||
ExportFunction macATw1QDy, macBTw1, macQSbarW2, macASbar, macASbarD2; |
|
||||||
ExportFunction expansionStep; |
|
||||||
|
|
||||||
ExportCholeskySolver cholSolver; |
|
||||||
|
|
||||||
ExportFunction mac_R_T2_B_D; |
|
||||||
ExportFunction move_D_U; |
|
||||||
ExportFunction mult_L_E_U; |
|
||||||
ExportFunction updateQ; |
|
||||||
ExportFunction mul_T2_A_L; |
|
||||||
ExportFunction mult_BT_T1_T2; |
|
||||||
|
|
||||||
ExportVariable D, L; |
|
||||||
|
|
||||||
ExportVariable T1, T2, T3, F; |
|
||||||
|
|
||||||
ExportFunction mac_R_BT_F_D, mult_FT_A_L; |
|
||||||
ExportFunction updateQ2; |
|
||||||
ExportFunction mac_W1_T1_E_F; |
|
||||||
ExportFunction move_GxT_T3; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP
|
|
@ -1,280 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_condensed.hpp |
|
||||||
* \authors Boris Houska, Hans Joachim Ferreau, Milan Vukov |
|
||||||
* \date 2010 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CONDENSED_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CONDENSED_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
#include <acado/code_generation/linear_solvers/export_cholesky_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for export of Gauss-Newton condensed OCP solver |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportGaussNewtonCondensed allows to export an OCP solver |
|
||||||
* using the generalized Gauss-Newton method. The sparse QP is condensed |
|
||||||
* and solved with qpOASES QP solver. |
|
||||||
* |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonCondensed : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonCondensed( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportGaussNewtonCondensed( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
/** Returns number of bounds on differential states.
|
|
||||||
* |
|
||||||
* \return Number of bounds on differential states |
|
||||||
*/ |
|
||||||
virtual unsigned getNumStateBounds( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
/** Setup qpOASES interface. */ |
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
/** Setup condensing routine variables and functions. */ |
|
||||||
virtual returnValue setupCondensing( ); |
|
||||||
|
|
||||||
/** Indicator for full condensing. */ |
|
||||||
bool performFullCondensing( ) const; |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Current state feedback. */ |
|
||||||
ExportVariable x0; |
|
||||||
/** Current state feedback deviation. */ |
|
||||||
ExportVariable Dx0; |
|
||||||
|
|
||||||
/** \name Objective evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateObjective; |
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Condensing functions and variables */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction condensePrep; |
|
||||||
ExportFunction condenseFdb; |
|
||||||
ExportFunction expand; |
|
||||||
|
|
||||||
ExportVariable T, E, QE, QGx, QDy, Qd; |
|
||||||
|
|
||||||
ExportVariable H00, H10, H11; |
|
||||||
ExportVariable g0, g1; |
|
||||||
|
|
||||||
ExportCholeskySolver cholSolver; |
|
||||||
|
|
||||||
std::vector< unsigned > xBoundsIdx; |
|
||||||
ExportVariable lbValues, ubValues; |
|
||||||
ExportVariable lbAValues, ubAValues; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Helper functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction multGxd; |
|
||||||
ExportFunction moveGxT; |
|
||||||
ExportFunction multGxGx; |
|
||||||
ExportFunction multGxGu; |
|
||||||
ExportFunction moveGuE; |
|
||||||
ExportFunction setBlockH11; |
|
||||||
ExportFunction setBlockH11_R1; |
|
||||||
ExportFunction zeroBlockH11; |
|
||||||
ExportFunction copyHTH; |
|
||||||
ExportFunction multQ1d; |
|
||||||
ExportFunction multQN1d; |
|
||||||
ExportFunction multRDy; |
|
||||||
ExportFunction multQDy; |
|
||||||
ExportFunction multEQDy; |
|
||||||
ExportFunction multQETGx; |
|
||||||
ExportFunction zeroBlockH10; |
|
||||||
ExportFunction multEDu; |
|
||||||
ExportFunction multQ1Gx; |
|
||||||
ExportFunction multQN1Gx; |
|
||||||
ExportFunction multQ1Gu; |
|
||||||
ExportFunction multQN1Gu; |
|
||||||
ExportFunction zeroBlockH00; |
|
||||||
ExportFunction multCTQC; |
|
||||||
|
|
||||||
ExportFunction macCTSlx; |
|
||||||
ExportFunction macETSlu; |
|
||||||
|
|
||||||
ExportFunction multHxC; |
|
||||||
ExportFunction multHxE; |
|
||||||
ExportFunction macHxd; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Contraint evaluation variables */ |
|
||||||
/** @{ */ |
|
||||||
ExportVariable A10; |
|
||||||
ExportVariable A20; |
|
||||||
ExportVariable pacA01Dx0; |
|
||||||
ExportVariable pocA02Dx0; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name RTI related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Covariance calculation varibables and functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportVariable CEN, sigmaTmp, sigma, sigmaN; |
|
||||||
ExportFunction calculateCovariance; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name qpOASES interface variables */ |
|
||||||
/** @{ */ |
|
||||||
/** Variable containing the QP Hessian matrix. */ |
|
||||||
ExportVariable H; |
|
||||||
/** Variable containing factorization of the QP Hessian matrix; R' * R = H. */ |
|
||||||
ExportVariable R; |
|
||||||
/** Variable containing the QP constraint matrix. */ |
|
||||||
ExportVariable A; |
|
||||||
/** Variable containing the QP gradient. */ |
|
||||||
ExportVariable g; |
|
||||||
/** Variable containing the lower limits on QP variables. */ |
|
||||||
ExportVariable lb; |
|
||||||
/** Variable containing the upper limits on QP variables. */ |
|
||||||
ExportVariable ub; |
|
||||||
/** Variable containing lower limits on QP constraints. */ |
|
||||||
ExportVariable lbA; |
|
||||||
/** Variable containing upper limits on QP constraints. */ |
|
||||||
ExportVariable ubA; |
|
||||||
/** Variable containing the primal QP variables. */ |
|
||||||
ExportVariable xVars; |
|
||||||
/** Variable containing the dual QP variables. */ |
|
||||||
ExportVariable yVars; |
|
||||||
/** @} */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CONDENSED_HPP
|
|
@ -1,227 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_forces.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_FORCES_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_FORCES_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportForcesInterface; |
|
||||||
class ExportForcesGenerator; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for export of an OCP solver using sparse QP solver FORCES |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportGaussNewtonForces allows export of and OCP solver using |
|
||||||
* the generalized Gauss-Newton method. The underlying QP is solved using the |
|
||||||
* structured sparse QP solver FORCES. |
|
||||||
*
|
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonForces : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonForces( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportGaussNewtonForces( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
unsigned getNumLowerBounds( ) const; |
|
||||||
|
|
||||||
unsigned getNumUpperBounds( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
private: |
|
||||||
/** Current state feedback. */ |
|
||||||
ExportVariable x0; |
|
||||||
|
|
||||||
/** \name Objective evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
std::vector< ExportVariable > objHessians; |
|
||||||
std::vector< ExportVariable > objGradients; |
|
||||||
|
|
||||||
ExportFunction setStageH; |
|
||||||
ExportFunction setStagef; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
ExportFunction setObjS1; |
|
||||||
|
|
||||||
bool diagH; |
|
||||||
bool diagHN; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Constraint evaluation */ |
|
||||||
/** @{ */ |
|
||||||
std::vector< ExportVariable > conLB; |
|
||||||
std::vector< ExportVariable > conUB; |
|
||||||
ExportVariable lbValues, ubValues; |
|
||||||
|
|
||||||
unsigned numLB; |
|
||||||
unsigned numUB; |
|
||||||
|
|
||||||
std::vector< std::vector< unsigned > > conLBIndices, conUBIndices; |
|
||||||
std::vector< unsigned > conABDimensions; |
|
||||||
std::vector< std::vector< double > > conLBValues, conUBValues; |
|
||||||
|
|
||||||
ExportFunction evaluateConstraints; |
|
||||||
ExportFunction conSetGxGu; |
|
||||||
ExportVariable conStageC; |
|
||||||
|
|
||||||
std::vector< ExportVariable > conC; |
|
||||||
std::vector< ExportVariable > cond; |
|
||||||
ExportFunction conSetd; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name RTI related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Helper functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction acc; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name QP interface */ |
|
||||||
/** @{ */ |
|
||||||
std::string qpModuleName; |
|
||||||
std::string qpObjPrefix; |
|
||||||
|
|
||||||
std::shared_ptr< ExportForcesInterface > qpInterface; |
|
||||||
std::shared_ptr< ExportForcesGenerator > qpGenerator; |
|
||||||
/** @} */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_FORCES_HPP
|
|
@ -1,212 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_generic.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2017 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_GENERIC_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_GENERIC_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief TBD |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* TBD |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonGeneric : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonGeneric( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportGaussNewtonGeneric( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
private: |
|
||||||
/** Current state feedback. */ |
|
||||||
ExportVariable x0; |
|
||||||
|
|
||||||
/** \name Objective evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
ExportFunction setStagef; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjS1; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
|
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Constraint evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateConstraints; |
|
||||||
ExportFunction setStagePac; |
|
||||||
unsigned qpDimHtot; |
|
||||||
unsigned qpDimH; |
|
||||||
unsigned qpDimHN; |
|
||||||
std::vector< unsigned > qpConDim; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name RTI related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Helper functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction acc; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name QP interface */ |
|
||||||
/** @{ */ |
|
||||||
|
|
||||||
ExportVariable qpQ, qpQf, qpS, qpR; |
|
||||||
|
|
||||||
ExportVariable qpq, qpqf, qpr; |
|
||||||
ExportVariable qpx, qpu; |
|
||||||
|
|
||||||
ExportVariable evLbValues, evUbValues; |
|
||||||
ExportVariable evLbAValues, evUbAValues; |
|
||||||
ExportVariable qpLb, qpUb; |
|
||||||
|
|
||||||
ExportVariable qpLbA, qpUbA; |
|
||||||
|
|
||||||
ExportVariable sigmaN; |
|
||||||
|
|
||||||
ExportVariable qpLambda, qpMu, qpSlacks; |
|
||||||
|
|
||||||
ExportVariable nIt; |
|
||||||
|
|
||||||
// ExportVariable qpWork;
|
|
||||||
/** @} */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_GENERIC_HPP
|
|
@ -1,217 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_hpmpc.hpp |
|
||||||
* \author Milan Vukov, Niels van Duijkeren |
|
||||||
* \date 2016 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_HPMPC_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_HPMPC_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportHpmpcInterface; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief TBD |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* TBD |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonHpmpc : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonHpmpc( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportGaussNewtonHpmpc( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
private: |
|
||||||
/** Current state feedback. */ |
|
||||||
ExportVariable x0; |
|
||||||
|
|
||||||
/** \name Objective evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
ExportFunction setStagef; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjS1; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
|
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Constraint evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateConstraints; |
|
||||||
ExportFunction setStagePac; |
|
||||||
unsigned qpDimHtot; |
|
||||||
unsigned qpDimH; |
|
||||||
unsigned qpDimHN; |
|
||||||
std::vector< unsigned > qpConDim; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name RTI related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
|
|
||||||
ExportFunction getKKT; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Helper functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction acc; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name QP interface */ |
|
||||||
/** @{ */ |
|
||||||
|
|
||||||
ExportVariable qpQ, qpQf, qpS, qpR; |
|
||||||
|
|
||||||
ExportVariable qpq, qpqf, qpr; |
|
||||||
ExportVariable qpx, qpu; |
|
||||||
|
|
||||||
ExportVariable evLbValues, evUbValues; |
|
||||||
ExportVariable qpLb, qpUb; |
|
||||||
|
|
||||||
ExportVariable qpLbA, qpUbA; |
|
||||||
|
|
||||||
ExportVariable sigmaN; |
|
||||||
|
|
||||||
ExportVariable qpLambda, qpMu, qpSlacks; |
|
||||||
|
|
||||||
ExportVariable nIt; |
|
||||||
|
|
||||||
// ExportVariable qpWork;
|
|
||||||
|
|
||||||
std::shared_ptr< ExportHpmpcInterface > qpInterface; |
|
||||||
/** @} */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_HPMPC_HPP
|
|
@ -1,222 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_gauss_newton_qpdunes.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_QPDUNES_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_QPDUNES_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_nlp_solver.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportQpDunesInterface; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for export of an OCP solver using sparse QP solver qpDUNES |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExportGaussNewtonQpDunes allows export of and OCP solver using |
|
||||||
* the generalized Gauss-Newton method. The underlying QP is solved using the |
|
||||||
* structured sparse QP solver qpDUNES. |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportGaussNewtonQpDunes : public ExportNLPSolver |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportGaussNewtonQpDunes( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportGaussNewtonQpDunes( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
unsigned getNumQPvars( ) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of an objective evaluation:
|
|
||||||
* - functions and derivatives evaulation |
|
||||||
* - creating Hessians and gradients |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupObjectiveEvaluation( void ); |
|
||||||
|
|
||||||
/** Set-up evaluation of constraints
|
|
||||||
* - box constraints on states and controls |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupConstraintsEvaluation( void ); |
|
||||||
|
|
||||||
/** Initialization of all member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ); |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ); |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm. */ |
|
||||||
virtual returnValue setupEvaluation( ); |
|
||||||
|
|
||||||
/** Setup of the glue code for the QP solver interaction. */ |
|
||||||
virtual returnValue setupQPInterface( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Current state feedback. */ |
|
||||||
ExportVariable x0; |
|
||||||
|
|
||||||
/** \name QP interface variables */ |
|
||||||
/** @{ */ |
|
||||||
ExportVariable qpH; |
|
||||||
ExportVariable qpg; |
|
||||||
ExportVariable qpgN; |
|
||||||
|
|
||||||
ExportVariable qpC; |
|
||||||
ExportVariable qpc; |
|
||||||
ExportVariable qpLb0, qpUb0; |
|
||||||
ExportVariable qpLb, qpUb; |
|
||||||
|
|
||||||
ExportVariable lbValues, ubValues; |
|
||||||
|
|
||||||
ExportVariable qpA; |
|
||||||
ExportVariable qpLbA, qpUbA; |
|
||||||
|
|
||||||
ExportVariable qpPrimal, qpLambda, qpMu; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Objective evaluation. */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateObjective; |
|
||||||
|
|
||||||
ExportFunction setStageH; |
|
||||||
ExportFunction setStagef; |
|
||||||
|
|
||||||
ExportFunction setObjQ1Q2; |
|
||||||
ExportFunction setObjR1R2; |
|
||||||
ExportFunction setObjQN1QN2; |
|
||||||
|
|
||||||
bool diagH, diagHN; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Constraint evaluation */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction evaluateConstraints; |
|
||||||
ExportFunction setStagePac; |
|
||||||
std::vector< unsigned > qpConDim; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name RTI related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction preparation; |
|
||||||
ExportFunction feedback; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name qpDUNES interface functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction cleanup; |
|
||||||
ExportFunction shiftQpData; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Auxiliary functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction getKKT; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Helper functions */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction acc; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** qpDUNES interface object. */ |
|
||||||
std::shared_ptr< ExportQpDunesInterface > qpInterface; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_QPDUNES_HPP
|
|
@ -1,91 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_hessian_regularization.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_HESSIAN_REG_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_HESSIAN_REG_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating code implementing a symmetric EigenValue Decomposition. |
|
||||||
* |
|
||||||
* \ingroup ExportHessianRegularization |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExportHessianRegularization : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _moduleName Module name for customization. |
|
||||||
* @param[in] _modulePrefix Module name for customization. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportHessianRegularization( const std::string& _sourceFileName, |
|
||||||
const std::string& _moduleName = "acado", |
|
||||||
const std::string& _modulePrefix = "ACADO", |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "double", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportHessianRegularization() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( uint DIM, double eps ); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
std::string moduleName; |
|
||||||
std::string modulePrefix; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_HESSIAN_REG_HPP
|
|
@ -1,96 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_hpmpc_interface.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_HPMPC_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_HPMPC_INTERFACE_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Interface generator for the HPMPC QP solver |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportHpmpcInterface : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentstd::string std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportHpmpcInterface( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportHpmpcInterface( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const unsigned _maxIter, |
|
||||||
const unsigned _printLevel, |
|
||||||
bool _useSinglePrecision, |
|
||||||
bool _warmStart, |
|
||||||
const std::string& _Hx, |
|
||||||
const std::string& _Hu, |
|
||||||
const std::string& _lbA, |
|
||||||
const std::string& _ubA, |
|
||||||
const unsigned _DimH, |
|
||||||
const std::vector< unsigned >& _conDim, |
|
||||||
const unsigned _NI, |
|
||||||
const unsigned _NX, |
|
||||||
const unsigned _NU |
|
||||||
); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_HPMPC_INTERFACE_HPP
|
|
@ -1,144 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_index.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_INDEX_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_INDEX_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_data.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportIndexNode; |
|
||||||
class ExportArgument; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Defines a scalar-valued index variable to be used for exporting code. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportIndex defines a scalar-valued index variable to be used for
|
|
||||||
* exporting code. Instances of this class can be used similar to usual integers
|
|
||||||
* but offer additional functionality, e.g. they allow to export arithmetic
|
|
||||||
* expressions involving indices of the form: |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportIndex : public ExportData |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
ExportIndex(); |
|
||||||
|
|
||||||
ExportIndex( const int _value ); |
|
||||||
|
|
||||||
explicit ExportIndex( const std::string& _name, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
ExportIndexNode* operator->(); |
|
||||||
|
|
||||||
const ExportIndexNode* operator->() const; |
|
||||||
|
|
||||||
operator ExportArgument(); |
|
||||||
|
|
||||||
friend ExportIndex operator+( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
friend ExportIndex operator-( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
friend ExportIndex operator*( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
friend ExportIndex operator/( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
friend ExportIndex operator%( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
friend std::string operator==( const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
); |
|
||||||
|
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a string containing the value of the index.
|
|
||||||
* |
|
||||||
* \return std::string containing the value of the index. |
|
||||||
*/ |
|
||||||
const std::string get( ) const; |
|
||||||
|
|
||||||
/** Returns the given value of the index (if defined).
|
|
||||||
* |
|
||||||
* \return Given value of the index or "undefinedValue". |
|
||||||
*/ |
|
||||||
int getGivenValue( ) const; |
|
||||||
|
|
||||||
/** Returns whether the index is set to a given value.
|
|
||||||
* |
|
||||||
* \return true iff index is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isGiven( ) const; |
|
||||||
|
|
||||||
bool isBinary() const; |
|
||||||
|
|
||||||
bool isVariable() const; |
|
||||||
}; |
|
||||||
|
|
||||||
struct ExportIndexComparator |
|
||||||
{ |
|
||||||
bool operator() (const ExportIndex& val1, const ExportIndex& val2) const |
|
||||||
{ |
|
||||||
int tmp = std::string( val1.getName() ).compare( std::string( val2.getName() ) ); |
|
||||||
|
|
||||||
return (tmp < 0) ? true : false; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
const ExportIndex emptyConstExportIndex( int( 0 ) ); |
|
||||||
const ExportIndex constExportIndexValueOne( int( 1 ) ); |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_INDEX_HPP
|
|
@ -1,163 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_index_node.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_INDEX_NODE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_INDEX_NODE_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_data_internal.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
#include <acado/code_generation/export_index_node.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
enum ExportVariableType |
|
||||||
{ |
|
||||||
EVT_VARIABLE, |
|
||||||
EVT_VALUE, |
|
||||||
EVT_BINARY_OPERATOR |
|
||||||
}; |
|
||||||
|
|
||||||
class ExportIndexNode : public ExportDataInternal |
|
||||||
{ |
|
||||||
public: |
|
||||||
ExportIndexNode( const std::string& _name, |
|
||||||
const std::string& _prefix, |
|
||||||
const int _factor = 1, |
|
||||||
const int _offset = 0) |
|
||||||
: ExportDataInternal(_name, INT, ACADO_LOCAL, _prefix) |
|
||||||
{ |
|
||||||
if ( _factor ) |
|
||||||
{ |
|
||||||
varType = EVT_VARIABLE; |
|
||||||
value = 0; |
|
||||||
factor = _factor; |
|
||||||
offset = _offset; |
|
||||||
op = ESO_UNDEFINED; |
|
||||||
} |
|
||||||
else |
|
||||||
{ |
|
||||||
varType = EVT_VALUE; |
|
||||||
value = _offset; |
|
||||||
factor = 1; |
|
||||||
offset = 0; |
|
||||||
op = ESO_UNDEFINED; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
explicit ExportIndexNode( const int _value ) |
|
||||||
: ExportDataInternal("defaultIndexName", INT, ACADO_LOCAL, ""), |
|
||||||
varType( EVT_VALUE ), value( _value ), factor( 1 ), offset( 0 ), op( ESO_UNDEFINED ) |
|
||||||
{} |
|
||||||
|
|
||||||
ExportIndexNode( ExportStatementOperator _op, |
|
||||||
const ExportIndex& _arg1, |
|
||||||
const ExportIndex& _arg2 |
|
||||||
) |
|
||||||
: ExportDataInternal("defaultIndexName", INT, ACADO_LOCAL, ""), |
|
||||||
varType( EVT_BINARY_OPERATOR ), value( 0 ), factor( 1 ), offset( 0 ), |
|
||||||
op( _op ), left( _arg1 ), right( _arg2 ) |
|
||||||
{} |
|
||||||
|
|
||||||
virtual ~ExportIndexNode() |
|
||||||
{} |
|
||||||
|
|
||||||
virtual ExportIndexNode* clone() const |
|
||||||
{ |
|
||||||
return new ExportIndexNode( *this ); |
|
||||||
} |
|
||||||
|
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/// Returns a string containing the value of the index.
|
|
||||||
const std::string get( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the given value of the index (if defined).
|
|
||||||
* |
|
||||||
* \return Given value of the index or 0 in case the index is undefined. |
|
||||||
*/ |
|
||||||
const int getGivenValue( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether the index is set to a given value.
|
|
||||||
* |
|
||||||
* \return true iff index is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
virtual bool isGiven( ) const; |
|
||||||
|
|
||||||
bool isBinary() const |
|
||||||
{ |
|
||||||
if (varType == EVT_BINARY_OPERATOR) |
|
||||||
return true; |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
bool isVariable() const |
|
||||||
{ |
|
||||||
if (varType == EVT_VARIABLE) |
|
||||||
return true; |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
const int getFactor( ) const |
|
||||||
{ |
|
||||||
return factor; |
|
||||||
} |
|
||||||
|
|
||||||
const int getOffset( ) const |
|
||||||
{ |
|
||||||
return offset; |
|
||||||
} |
|
||||||
|
|
||||||
private: |
|
||||||
ExportVariableType varType; |
|
||||||
int value; |
|
||||||
int factor; |
|
||||||
int offset; |
|
||||||
|
|
||||||
int op; |
|
||||||
ExportIndex left; |
|
||||||
ExportIndex right; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_INDEX_NODE_HPP
|
|
||||||
|
|
@ -1,140 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_module.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_MODULE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_MODULE_HPP |
|
||||||
|
|
||||||
#include <acado/user_interaction/user_interaction.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportStatementBlock; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief User-interface to automatically generate algorithms for fast model predictive control |
|
||||||
* |
|
||||||
* \ingroup UserInterfaces |
|
||||||
* |
|
||||||
* The class ExportModule is a user-interface to automatically generate tailored |
|
||||||
* algorithms for fast model predictive control. It takes an optimal control
|
|
||||||
* problem (OCP) formulation and generates code based on given user options. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportModule : public UserInteraction |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor. */ |
|
||||||
ExportModule( ); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportModule( ); |
|
||||||
|
|
||||||
/** Exports all files of the auto-generated code into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] dirName Name of directory to be used to export files. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( const std::string& dirName, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) = 0; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Exports main header file for using the exported algorithm.
|
|
||||||
* |
|
||||||
* @param[in] _dirName Name of directory to be used to export file. |
|
||||||
* @param[in] _fileName Name of file to be exported. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportAcadoHeader( const std::string& _dirName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Collects all data declarations of the auto-generated sub-modules to given
|
|
||||||
* list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_UNABLE_TO_EXPORT_CODE |
|
||||||
*/ |
|
||||||
virtual returnValue collectDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Collects all function (forward) declarations of the auto-generated sub-modules
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_UNABLE_TO_EXPORT_CODE |
|
||||||
*/ |
|
||||||
virtual returnValue collectFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
/** Sets-up default options.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setupOptions( ); |
|
||||||
|
|
||||||
/** Name of common header file. */ |
|
||||||
std::string commonHeaderName; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_MODULE_HPP
|
|
@ -1,378 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_nlp_solver.hpp |
|
||||||
* \author Milan Vukov, Rien Quirynen |
|
||||||
* \date 2012 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_NLP_SOLVER_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_NLP_SOLVER_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/export_algorithm_factory.hpp> |
|
||||||
#include <acado/code_generation/integrators/integrator_export.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/export_cholesky_decomposition.hpp> |
|
||||||
#include <acado/code_generation/linear_solvers/householder_qr_export.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class OCP; |
|
||||||
class Objective; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Base class for export of NLP/OCP solvers. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* This base class is basically used to extract information from an OCP |
|
||||||
* object and prepare low level structures. Later, a derived class is |
|
||||||
* actually building the solver to solve an OCP problem. |
|
||||||
*
|
|
||||||
* \author Milan Vukov |
|
||||||
* |
|
||||||
* \note Based on code originally developed by Boris Houska and Hand Joachim Ferreau. |
|
||||||
*/ |
|
||||||
class ExportNLPSolver : public ExportAlgorithm |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExportNLPSolver( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportNLPSolver( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Initializes export of an algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns module for exporting a tailored integrator.
|
|
||||||
* |
|
||||||
* @param[in] _integrator Integrator module. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setIntegratorExport( IntegratorExportPtr const _integrator |
|
||||||
); |
|
||||||
|
|
||||||
/** Assigns new constant for Levenberg-Marquardt regularization.
|
|
||||||
* |
|
||||||
* @param[in] _levenbergMarquardt Non-negative constant for Levenberg-Marquardt regularization. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setLevenbergMarquardt( double _levenbergMarquardt |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated condensing algorithm
|
|
||||||
* to given list of declarations. |
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated condensing algorithm
|
|
||||||
* into the given directory. |
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated condensing algorithm. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of variables in underlying QP.
|
|
||||||
* |
|
||||||
* \return Number of variables in underlying QP |
|
||||||
*/ |
|
||||||
virtual unsigned getNumQPvars( ) const = 0; |
|
||||||
|
|
||||||
/** Returns whether a single shooting state discretization is used.
|
|
||||||
* |
|
||||||
* \return true iff single shooting state discretization is used, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool performsSingleShooting( ) const; |
|
||||||
|
|
||||||
/** Set objective function
|
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_INITIALIZE_FIRST, \n |
|
||||||
* RET_INVALID_OBJECTIVE_FOR_CODE_EXPORT, \n |
|
||||||
* RET_INVALID_ARGUMENTS |
|
||||||
* */ |
|
||||||
returnValue setObjective(const Objective& _objective); |
|
||||||
returnValue setLSQObjective(const Objective& _objective); |
|
||||||
returnValue setGeneralObjective(const Objective& _objective); |
|
||||||
|
|
||||||
/** Set the "complex" path and point constraints
|
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
* */ |
|
||||||
returnValue setConstraints(const OCP& _ocp); |
|
||||||
|
|
||||||
/** Get the number of complex constraints - path + point constraints.
|
|
||||||
* \return Number of complex constraints |
|
||||||
* */ |
|
||||||
unsigned getNumComplexConstraints( void ); |
|
||||||
|
|
||||||
/** Get the number of path constraints.
|
|
||||||
* \return Number of path constraints |
|
||||||
* */ |
|
||||||
unsigned getNumPathConstraints( void ); |
|
||||||
|
|
||||||
/** Return type of weighting matrices.
|
|
||||||
* \return Type of weighting matrices. */ |
|
||||||
unsigned weightingMatricesType( void ) const; |
|
||||||
|
|
||||||
/** Indicates whether initial state is fixed. */ |
|
||||||
bool initialStateFixed( ) const; |
|
||||||
|
|
||||||
/** Indicates whether linear terms in the objective are used. */ |
|
||||||
bool usingLinearTerms() const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Setting up of a model simulation:
|
|
||||||
* - model integration |
|
||||||
* - sensitivity generation |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupSimulation( void ); |
|
||||||
|
|
||||||
/** Initialization of member variables.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupVariables( ) = 0; |
|
||||||
|
|
||||||
/** Exports source code containing the multiplication routines of the algorithm.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupMultiplicationRoutines( ) = 0; |
|
||||||
|
|
||||||
/** Exports source code containing the evaluation routines of the algorithm. */ |
|
||||||
virtual returnValue setupEvaluation( ) = 0; |
|
||||||
|
|
||||||
/** Setup of functions for evaluation of constraints. */ |
|
||||||
virtual returnValue setupConstraintsEvaluation( ) = 0; |
|
||||||
|
|
||||||
/** Setup of functions for evaluation of auxiliary functions. */ |
|
||||||
returnValue setupAuxiliaryFunctions(); |
|
||||||
|
|
||||||
/** Setup the function for evaluating the actual objective value. */ |
|
||||||
virtual returnValue setupGetObjective(); |
|
||||||
|
|
||||||
/** Setup the function for evaluating the actual LSQ objective value. */ |
|
||||||
virtual returnValue setupGetLSQObjective(); |
|
||||||
|
|
||||||
/** Setup the function for evaluating the actual objective value. */ |
|
||||||
virtual returnValue setupGetGeneralObjective(); |
|
||||||
|
|
||||||
/** Setup of functions and variables for evaluation of arrival cost. */ |
|
||||||
returnValue setupArrivalCostCalculation(); |
|
||||||
|
|
||||||
/** Setup main initialization code for the solver */ |
|
||||||
virtual returnValue setupInitialization(); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** \name Evaluation of model dynamics. */ |
|
||||||
/** @{ */ |
|
||||||
|
|
||||||
/** Module for exporting a tailored integrator. */ |
|
||||||
IntegratorExportPtr integrator; |
|
||||||
|
|
||||||
ExportFunction modelSimulation; |
|
||||||
|
|
||||||
ExportVariable state; |
|
||||||
ExportVariable x; |
|
||||||
ExportVariable z; |
|
||||||
ExportVariable u; |
|
||||||
ExportVariable od; |
|
||||||
ExportVariable d; |
|
||||||
|
|
||||||
ExportVariable evGx; // stack of sensitivities w.r.t. x
|
|
||||||
ExportVariable evGu; // stack of sensitivities w.r.t. u
|
|
||||||
|
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Evaluation of objective */ |
|
||||||
/** @{ */ |
|
||||||
|
|
||||||
/** Non-negative constant for Levenberg-Marquardt regularization. */ |
|
||||||
double levenbergMarquardt; |
|
||||||
|
|
||||||
ExportVariable y, yN, Dy, DyN; |
|
||||||
|
|
||||||
// lagrange multipliers
|
|
||||||
ExportVariable mu; |
|
||||||
|
|
||||||
ExportVariable objg, objS, objSEndTerm; |
|
||||||
ExportVariable objEvFx, objEvFu, objEvFxEnd; // aliasing
|
|
||||||
ExportVariable objEvFxx, objEvFxu, objEvFuu, objEvFxxEnd; // aliasing
|
|
||||||
|
|
||||||
ExportVariable objAuxVar, objValueIn, objValueOut; |
|
||||||
ExportAcadoFunction evaluateStageCost; |
|
||||||
ExportAcadoFunction evaluateTerminalCost; |
|
||||||
|
|
||||||
ExportVariable Q1, Q2; |
|
||||||
ExportVariable R1, R2; |
|
||||||
ExportVariable S1; |
|
||||||
ExportVariable QN1, QN2; |
|
||||||
|
|
||||||
ExportVariable objSlx, objSlu; |
|
||||||
|
|
||||||
bool diagonalH, diagonalHN; |
|
||||||
|
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Evaluation of box constraints*/ |
|
||||||
/** @{ */ |
|
||||||
VariablesGrid uBounds; |
|
||||||
VariablesGrid xBounds; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Evaluation of path constraints */ |
|
||||||
/** @{ */ |
|
||||||
unsigned dimPacH; |
|
||||||
ExportAcadoFunction evaluatePathConstraints; |
|
||||||
ExportVariable conAuxVar; |
|
||||||
ExportVariable conValueIn; |
|
||||||
ExportVariable conValueOut; |
|
||||||
|
|
||||||
DVector lbPathConValues, ubPathConValues; |
|
||||||
|
|
||||||
ExportVariable pacEvH; |
|
||||||
ExportVariable pacEvHx, pacEvHu, pacEvHxd; |
|
||||||
ExportVariable pacEvDDH; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Evaluation of point constraints */ |
|
||||||
/** @{ */ |
|
||||||
unsigned dimPocH; |
|
||||||
std::vector< std::shared_ptr< ExportAcadoFunction > > evaluatePointConstraints; |
|
||||||
DVector lbPointConValues, ubPointConValues; |
|
||||||
|
|
||||||
std::vector< DVector > pocLbStack, pocUbStack; |
|
||||||
|
|
||||||
ExportVariable pocEvH; |
|
||||||
ExportVariable pocEvHx, pocEvHu, pocEvHxd; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Auxiliary functions */ |
|
||||||
/** @{ */ |
|
||||||
|
|
||||||
/** Main initialization function for the solver. */ |
|
||||||
ExportFunction initialize; |
|
||||||
|
|
||||||
ExportFunction shiftStates; |
|
||||||
ExportFunction shiftControls; |
|
||||||
ExportFunction getObjective; |
|
||||||
ExportFunction initializeNodes; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** \name Arrival cost related */ |
|
||||||
/** @{ */ |
|
||||||
ExportFunction updateArrivalCost; |
|
||||||
|
|
||||||
ExportCholeskyDecomposition cholObjS; |
|
||||||
ExportCholeskyDecomposition cholSAC; |
|
||||||
|
|
||||||
ExportHouseholderQR acSolver; |
|
||||||
|
|
||||||
ExportVariable acA, acb, acP, acTmp; |
|
||||||
// acWL and acVL are assumed to be upper triangular matrices
|
|
||||||
ExportVariable acWL, acVL, acHx, acHu, acXx, acXu, acXTilde, acHTilde; |
|
||||||
|
|
||||||
// Older stuff; TODO make this more unique
|
|
||||||
ExportVariable SAC, xAC, DxAC; |
|
||||||
|
|
||||||
ExportFunction regularizeHessian; |
|
||||||
ExportFunction regularization; |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
private: |
|
||||||
returnValue setupResidualVariables(); |
|
||||||
returnValue setupObjectiveLinearTerms(const Objective& _objective); |
|
||||||
}; |
|
||||||
|
|
||||||
/** Types of NLP/OCP solvers. */ |
|
||||||
enum ExportNLPType |
|
||||||
{ |
|
||||||
GAUSS_NEWTON_CONDENSED, |
|
||||||
GAUSS_NEWTON_CN2, |
|
||||||
GAUSS_NEWTON_BLOCK_QPDUNES, |
|
||||||
GAUSS_NEWTON_BLOCK_FORCES, |
|
||||||
GAUSS_NEWTON_CN2_FACTORIZATION, |
|
||||||
GAUSS_NEWTON_FORCES, |
|
||||||
GAUSS_NEWTON_QPDUNES, |
|
||||||
GAUSS_NEWTON_HPMPC, |
|
||||||
GAUSS_NEWTON_GENERIC, |
|
||||||
EXACT_HESSIAN_CN2, |
|
||||||
EXACT_HESSIAN_QPDUNES |
|
||||||
}; |
|
||||||
|
|
||||||
/** Factory for creation of exported NLP/OCP solvers. */ |
|
||||||
typedef ExportAlgorithmFactory<ExportNLPSolver, ExportNLPType> NLPSolverFactory; |
|
||||||
|
|
||||||
/** Shared pointer to an NLP solver. */ |
|
||||||
typedef std::shared_ptr< ExportNLPSolver > ExportNLPSolverPtr; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_NLP_SOLVER_HPP
|
|
@ -1,106 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_qpdunes_interface.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_QPDUNES_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_QPDUNES_INTERFACE_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Interface generator for the qpDUNES QP solver |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportQpDunesInterface : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentstd::string std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportQpDunesInterface( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportQpDunesInterface( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const unsigned _maxIter, |
|
||||||
const unsigned _printLevel, |
|
||||||
const std::string& _HH, |
|
||||||
const std::string& _g, |
|
||||||
const std::string& _gN, |
|
||||||
const std::string& _CC, |
|
||||||
const std::string& _c, |
|
||||||
const std::string& _DD, |
|
||||||
const std::string& _lb0, |
|
||||||
const std::string& _ub0, |
|
||||||
const std::string& _lb, |
|
||||||
const std::string& _ub, |
|
||||||
const std::string& _lbA, |
|
||||||
const std::string& _ubA, |
|
||||||
const std::string& _primal, |
|
||||||
const std::string& _lambda, |
|
||||||
const std::string& _mu, |
|
||||||
const std::vector< unsigned >& conDim, |
|
||||||
const std::string& _initialStateFixed, |
|
||||||
const std::string& _diagH, |
|
||||||
const std::string& _diagHN, |
|
||||||
const unsigned _NI, |
|
||||||
const unsigned _NX, |
|
||||||
const unsigned _NU |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_QPDUNES_INTERFACE_HPP
|
|
@ -1,116 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_qpoases3_interface.hpp |
|
||||||
* \author Milan Vukov, Joachim Ferreau |
|
||||||
* \date 2012 - 2015 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_QPOASES3_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_QPOASES3_INTERFACE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
#include <acado/code_generation/export_qpoases_interface.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating the glue code for interfacing qpOASES. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
* |
|
||||||
* \note Based on code originally developed by Hans Joachim Ferreau and Boris Houska. |
|
||||||
*/ |
|
||||||
class ExportQpOases3Interface : public ExportQpOasesInterface |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _headerFileName Name of exported file for header file. |
|
||||||
* @param[in] _sourceFileName Name of exported file for source file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportQpOases3Interface( const std::string& _headerFileName, |
|
||||||
const std::string& _sourceFileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportQpOases3Interface() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue configure( const std::string& _prefix, |
|
||||||
const std::string& _solverDefine, |
|
||||||
const int nvmax, |
|
||||||
const int ncmax, |
|
||||||
const int nwsrmax, |
|
||||||
const std::string& _printLevel, |
|
||||||
bool _useSinglePrecision, |
|
||||||
|
|
||||||
const std::string& _commonHeader, |
|
||||||
const std::string& _namespace, |
|
||||||
const std::string& _primalSolution, |
|
||||||
const std::string& _dualSolution, |
|
||||||
const std::string& _sigma, |
|
||||||
bool _hotstartQP, |
|
||||||
bool _externalCholesky, |
|
||||||
const std::string& _qpH, |
|
||||||
const std::string& _qpR, |
|
||||||
const std::string& _qpg, |
|
||||||
const std::string& _qpA, |
|
||||||
const std::string& _qplb, |
|
||||||
const std::string& _qpub, |
|
||||||
const std::string& _qplbA, |
|
||||||
const std::string& _qpubA |
|
||||||
); |
|
||||||
|
|
||||||
/** Export the interface. */ |
|
||||||
virtual returnValue exportCode(); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_QPOASES3_INTERFACE_HPP
|
|
@ -1,116 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_qpoases_interface.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_QPOASES_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_QPOASES_INTERFACE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating the glue code for interfacing qpOASES. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
* |
|
||||||
* \note Based on code originally developed by Hans Joachim Ferreau and Boris Houska. |
|
||||||
*/ |
|
||||||
class ExportQpOasesInterface |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _headerFileName Name of exported file for header file. |
|
||||||
* @param[in] _sourceFileName Name of exported file for source file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportQpOasesInterface( const std::string& _headerFileName, |
|
||||||
const std::string& _sourceFileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportQpOasesInterface() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue configure( const std::string& _prefix, |
|
||||||
const std::string& _solverDefine, |
|
||||||
const int nvmax, |
|
||||||
const int ncmax, |
|
||||||
const int nwsrmax, |
|
||||||
const std::string& _printLevel, |
|
||||||
bool _useSinglePrecision, |
|
||||||
const std::string& _commonHeader, |
|
||||||
const std::string& _namespace, |
|
||||||
const std::string& _primalSolution, |
|
||||||
const std::string& _dualSolution, |
|
||||||
const std::string& _sigma, |
|
||||||
bool _hotstartQP, |
|
||||||
bool _externalCholesky, |
|
||||||
const std::string& _qpH, |
|
||||||
const std::string& _qpR, |
|
||||||
const std::string& _qpg, |
|
||||||
const std::string& _qpA, |
|
||||||
const std::string& _qplb, |
|
||||||
const std::string& _qpub, |
|
||||||
const std::string& _qplbA, |
|
||||||
const std::string& _qpubA |
|
||||||
); |
|
||||||
|
|
||||||
/** Export the interface. */ |
|
||||||
virtual returnValue exportCode(); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportTemplatedFile qpoHeader; |
|
||||||
ExportTemplatedFile qpoSource; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_QPOASES_INTERFACE_HPP
|
|
@ -1,113 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_simulink_interface.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2013 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_SIMULINK_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_SIMULINK_INTERFACE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating the glue code and makefile |
|
||||||
* for interfacing generated code and Simulink. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportSimulinkInterface |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _moduleName Module name for customization. |
|
||||||
* @param[in] _modulePrefix Module prefix for customization. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportSimulinkInterface( const std::string& _makefileName, |
|
||||||
const std::string& _wrapperHeaderFileName, |
|
||||||
const std::string& _wrapperSourceFileName, |
|
||||||
const std::string& _moduleName = "acado", |
|
||||||
const std::string& _modulePrefix = "ACADO", |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "double", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportSimulinkInterface() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( unsigned N, |
|
||||||
unsigned NX, |
|
||||||
unsigned NDX, |
|
||||||
unsigned NXA, |
|
||||||
unsigned NU, |
|
||||||
unsigned NP, |
|
||||||
unsigned NY, |
|
||||||
unsigned NYN, |
|
||||||
bool _initialStateFixed, |
|
||||||
unsigned _wMatrixType, |
|
||||||
bool _hardcodedConstraints, |
|
||||||
bool _useArrivalCost, |
|
||||||
bool _compCovMatrix, |
|
||||||
std::string _qpSolver |
|
||||||
); |
|
||||||
|
|
||||||
/** Export the interface. */ |
|
||||||
returnValue exportCode(); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
ExportTemplatedFile makefile; |
|
||||||
ExportTemplatedFile wrapperSource; |
|
||||||
ExportTemplatedFile wrapperHeader; |
|
||||||
std::string moduleName; |
|
||||||
std::string modulePrefix; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_SIMULINK_INTERFACE_HPP
|
|
@ -1,106 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_split_qpdunes_interface.hpp |
|
||||||
* \author Milan Vukov, Rien Quirynen |
|
||||||
* \date 2013 - 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_SPLIT_QPDUNES_INTERFACE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_SPLIT_QPDUNES_INTERFACE_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Interface generator for the qpDUNES QP solver |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportSplitQpDunesInterface : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentstd::string std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportSplitQpDunesInterface( const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportSplitQpDunesInterface( ) |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const unsigned _maxIter, |
|
||||||
const unsigned _printLevel, |
|
||||||
const std::string& _HH, |
|
||||||
const std::string& _g, |
|
||||||
const std::string& _gN, |
|
||||||
const std::string& _CC, |
|
||||||
const std::string& _c, |
|
||||||
const std::string& _DD, |
|
||||||
const std::string& _lb0, |
|
||||||
const std::string& _ub0, |
|
||||||
const std::string& _lb, |
|
||||||
const std::string& _ub, |
|
||||||
const std::string& _lbA, |
|
||||||
const std::string& _ubA, |
|
||||||
const std::string& _primal, |
|
||||||
const std::string& _lambda, |
|
||||||
const std::string& _mu, |
|
||||||
const std::vector< unsigned >& conDim, |
|
||||||
const std::string& _initialStateFixed, |
|
||||||
const std::string& _diagH, |
|
||||||
const std::string& _diagHN, |
|
||||||
const unsigned _NI, |
|
||||||
const unsigned _NX, |
|
||||||
const unsigned _NU |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_SPLIT_QPDUNES_INTERFACE_HPP
|
|
@ -1,164 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_statement.hpp |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_STATEMENT_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_STATEMENT_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
|
|
||||||
#include <memory> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
class ExportIndex; |
|
||||||
class MemoryAllocator; |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Base class for all kind of statements to be exported by the code generation tool. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportStatement serves as a base class for all kind of statements to be exported
|
|
||||||
* by the code generation tool. |
|
||||||
* |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Shared pointer to a statement. */ |
|
||||||
typedef std::shared_ptr< ExportStatement > StatementPtr; |
|
||||||
|
|
||||||
/** A vector of shared pointer statements. */ |
|
||||||
typedef std::vector< StatementPtr > StatementPtrArray; |
|
||||||
|
|
||||||
/** Shared pointer to a memory allocator */ |
|
||||||
typedef std::shared_ptr< MemoryAllocator > MemoryAllocatorPtr; |
|
||||||
|
|
||||||
/** Default constructor. */ |
|
||||||
ExportStatement( ); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportStatement( const ExportStatement& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportStatement( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportStatement& operator=( const ExportStatement& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports data declaration of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the statement into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
/** Acquire an index. */ |
|
||||||
virtual ExportStatement& acquire( ExportIndex& ) |
|
||||||
{ |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
/** Release an index. */ |
|
||||||
virtual ExportStatement& release( const ExportIndex& ) |
|
||||||
{ |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
/** Set a memory allocator. */ |
|
||||||
virtual ExportStatement& allocate( MemoryAllocatorPtr ) |
|
||||||
{ |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public: |
|
||||||
static std::string fcnPrefix; |
|
||||||
static std::string varPrefix; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_STATEMENT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,312 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_statement_block.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
* \date 2010-2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_STATEMENT_BLOCK_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_STATEMENT_BLOCK_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
#include <acado/code_generation/export_argument.hpp> |
|
||||||
|
|
||||||
#include <vector> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportFunction; |
|
||||||
class ExportAcadoFunction; |
|
||||||
class ExportFunctionDeclaration; |
|
||||||
class ExportVariable; |
|
||||||
class ExportIndex; |
|
||||||
class ExportDataDeclaration; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code for a block of statements. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportStatementBlock allows to export code for a block of statements. |
|
||||||
* |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportStatementBlock : public ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/**< Default Constructor.
|
|
||||||
*/ |
|
||||||
ExportStatementBlock( ); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportStatementBlock( const ExportStatementBlock& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportStatementBlock( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportStatementBlock& operator=( const ExportStatementBlock& rhs |
|
||||||
); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds a statement to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _statement Statement to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addStatement( const ExportStatement& _statement |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a string statement to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _statementString std::string statement to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addStatement( const std::string& _statementString |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds a function to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _function Function to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addFunction( const ExportFunction& _function |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds a function call to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _fName Name of function to be called. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addFunctionCall( const std::string& _fName, |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a function call to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _f Function to be called. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addFunctionCall( const ExportFunction& _f, |
|
||||||
const ExportArgument& _argument1 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument2 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument3 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument4 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument5 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument6 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument7 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument8 = emptyConstExportArgument, |
|
||||||
const ExportArgument& _argument9 = emptyConstExportArgument |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds a variable declaration to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _data Variable declaration to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addDeclaration( const ExportVariable& _data, |
|
||||||
ExportStruct _dataStruct = ACADO_ANY |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds an index declaration to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _data Index declaration to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addDeclaration( const ExportIndex& _data, |
|
||||||
ExportStruct _dataStruct = ACADO_ANY |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a function forward declaration to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _f function forward declaration to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addDeclaration( const ExportFunction& _f |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a forward declaration of an ODE function to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _f ODE function whose forward declaration is to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addDeclaration( const ExportAcadoFunction& _f |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds a line break to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] num Number of line breaks to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addLinebreak( uint num = 1 |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a comment to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _comment Comment to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addComment( const std::string& _comment |
|
||||||
); |
|
||||||
|
|
||||||
/** Adds a comment preceded by a given number of blanks to the statement block.
|
|
||||||
* |
|
||||||
* @param[in] _nBlanks Number of blanks. |
|
||||||
* @param[in] _comment Comment to be added. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue addComment( uint _nBlanks, |
|
||||||
const std::string& _comment |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns number of statement within statement block.
|
|
||||||
* |
|
||||||
* \return Number of statement within statement block |
|
||||||
*/ |
|
||||||
uint getNumStatements( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports data declaration of the statement block into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement block. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportDataDeclaration( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Exports source code of the statement block into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export statement block. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Removes all statements to yield an empty statement block.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue clear( ); |
|
||||||
|
|
||||||
/** Add a statement. */ |
|
||||||
friend ExportStatementBlock& operator<<(ExportStatementBlock& _block, const ExportStatement& _statement); |
|
||||||
|
|
||||||
/** Add a string. */ |
|
||||||
friend ExportStatementBlock& operator<<(ExportStatementBlock& _block, const std::string& _statement); |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// DATA MEMBERS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Array containing all statements of the statement block. */ |
|
||||||
StatementPtrArray statements; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_STATEMENT_BLOCK_HPP
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* end of file |
|
||||||
*/ |
|
@ -1,106 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_statement_string.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_STATEMENT_STRING_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_STATEMENT_STRING_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_statement.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export code writing a string. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* The class ExportStatementstd::string allows to export code writing a string. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska |
|
||||||
*/ |
|
||||||
class ExportStatementString : public ExportStatement |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor which optionally takes the string to be exported.
|
|
||||||
* |
|
||||||
* @param[in] _statementstd::string std::string to be exported. |
|
||||||
*/ |
|
||||||
ExportStatementString( const std::string& _statementString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportStatementString( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportStatement* clone( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the string into given file. Its appearance can
|
|
||||||
* can be adjusted by various options. |
|
||||||
* |
|
||||||
* @param[in] stream Name of file to be used to export string. |
|
||||||
* @param[in] _realSstring std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue exportCode( std::ostream& stream, |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16 |
|
||||||
) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
std::string statementString; /**< std::string to be exported. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_STATEMENT_STRING_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,139 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_templated_file.hpp |
|
||||||
* \author Milan Vukov |
|
||||||
* \date 2012 - 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_TEMPLATED_FILE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_TEMPLATED_FILE_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_file.hpp> |
|
||||||
|
|
||||||
#include <map> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportQpOasesInterface; |
|
||||||
class ExportSimulinkInterface; |
|
||||||
class ExportAuxiliaryFunctions; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows export of template files. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Milan Vukov |
|
||||||
*/ |
|
||||||
class ExportTemplatedFile : public ExportFile |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
friend class ExportQpOasesInterface; |
|
||||||
friend class ExportQpOases3Interface; |
|
||||||
friend class ExportSimulinkInterface; |
|
||||||
friend class ExportAuxiliaryFunctions; |
|
||||||
friend class ExportHessianRegularization; |
|
||||||
friend class ExportAuxiliarySimFunctions; |
|
||||||
friend class OCPexport; |
|
||||||
friend class SIMexport; |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportTemplatedFile( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Standard constructor.
|
|
||||||
* |
|
||||||
* @param[in] _templateName Name of a template. |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
*/ |
|
||||||
ExportTemplatedFile( const std::string& _templateName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportTemplatedFile( ) |
|
||||||
{} |
|
||||||
|
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _templateName Name of a template. |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( const std::string& _templateName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue configure( ) |
|
||||||
{ |
|
||||||
return fillTemplate( ); |
|
||||||
} |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Fill in the template. */ |
|
||||||
returnValue fillTemplate( ); |
|
||||||
/** Name of the template file. */ |
|
||||||
std::string templateName; |
|
||||||
/** Dictionary used to fill in the template file. */ |
|
||||||
std::map< std::string, std::string > dictionary; |
|
||||||
/** List of folders where templates are stored. */ |
|
||||||
std::string folders; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_TEMPLATED_FILE_HPP
|
|
@ -1,536 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_variable.hpp |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_VARIABLE_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_VARIABLE_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_argument.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
class ExportArithmeticStatement; |
|
||||||
class ExportVariableInternal; |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Defines a matrix-valued variable to be used for exporting code. |
|
||||||
* |
|
||||||
* \ingroup UserDataStructures |
|
||||||
* |
|
||||||
* The class ExportVariable defines a matrix-valued variable to be used for exporting |
|
||||||
* code. Instances of this class can be used similar to usual DMatrix objects |
|
||||||
* but offer additional functionality, e.g. they allow to export arithmetic
|
|
||||||
* expressions and they can be passed as argument to exported functions. By
|
|
||||||
* default, all entries of a ExportVariable are undefined, but each of its
|
|
||||||
* component can be set to a fixed value if known beforehand. |
|
||||||
* |
|
||||||
* \authors Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportVariable : public ExportArgument |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor. */ |
|
||||||
ExportVariable(); |
|
||||||
|
|
||||||
/** Constructor which takes the name, type string
|
|
||||||
* and dimensions of the variable. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _nRows Number of rows of the argument. |
|
||||||
* @param[in] _nCols Number of columns of the argument. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
*/ |
|
||||||
ExportVariable( const std::string& _name, |
|
||||||
uint _nRows, |
|
||||||
uint _nCols, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type string of the variable.
|
|
||||||
* Moreover, it initializes the variable with the dimensions and the
|
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
*/ |
|
||||||
ExportVariable( const std::string& _name, |
|
||||||
const DMatrix& _data, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string(), |
|
||||||
bool _isGiven = true |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type string of the variable.
|
|
||||||
* Moreover, it initializes the variable with the dimensions and the |
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data Shared pointer to DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
*/ |
|
||||||
ExportVariable( const std::string& _name, |
|
||||||
const DMatrixPtr& _data, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type string of the variable.
|
|
||||||
* Moreover, it initializes the variable with the dimensions of the matrix. |
|
||||||
* |
|
||||||
* @param[in] _nRows Name of the argument. |
|
||||||
* @param[in] _nCols Name of the argument. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
*/ |
|
||||||
ExportVariable( unsigned _nRows, |
|
||||||
unsigned _nCols, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** \name Constructor which converts a given matrix/vector/scalar into an ExportVariable.
|
|
||||||
* @{ */ |
|
||||||
|
|
||||||
template<typename Derived> |
|
||||||
ExportVariable( const Eigen::MatrixBase<Derived>& _data |
|
||||||
) |
|
||||||
{ |
|
||||||
simpleForward(DMatrix( _data )); |
|
||||||
} |
|
||||||
|
|
||||||
ExportVariable( const double _data /**< Scalar used for initialization */ |
|
||||||
); |
|
||||||
/** @} */ |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportVariable( ); |
|
||||||
|
|
||||||
ExportVariable clone() const; |
|
||||||
|
|
||||||
ExportVariableInternal* operator->(); |
|
||||||
|
|
||||||
const ExportVariableInternal* operator->() const; |
|
||||||
|
|
||||||
/** Initializes variable with given name, type string
|
|
||||||
* and dimensions of the variable. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _nRows Number of rows of the argument. |
|
||||||
* @param[in] _nCols Number of columns of the argument. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
* |
|
||||||
* \return Reference to initialized object |
|
||||||
*/ |
|
||||||
ExportVariable& setup( const std::string& _name, |
|
||||||
uint _nRows = 1, |
|
||||||
uint _nCols = 1, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Initializes variable with given name and type string of the variable.
|
|
||||||
* Moreover, the variable is initialized with the dimensions and the
|
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
* |
|
||||||
* \return Reference to initialized object |
|
||||||
*/ |
|
||||||
ExportVariable& setup( const std::string& _name, |
|
||||||
const DMatrix& _data, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string(), |
|
||||||
bool _isGiven = true |
|
||||||
); |
|
||||||
|
|
||||||
/** Returns value of given component.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Row index of the component to be returned. |
|
||||||
* @param[in] colIdx Column index of the component to be returned. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
double operator()( uint rowIdx, |
|
||||||
uint colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns value of given component.
|
|
||||||
* |
|
||||||
* @param[in] totalIdx Memory location of the component to be returned. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
double operator()( uint totalIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to zero.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to zero, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isZero( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to one.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to one, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isOne( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to a given value.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isGiven( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether all components of the variable are set to a given value.
|
|
||||||
* |
|
||||||
* \return true iff all components of the variable are set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isGiven( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns string containing the value of a given component. If its
|
|
||||||
* value is undefined, the string contains the address of the component. |
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return std::string containing the value of a given component |
|
||||||
*/ |
|
||||||
const std::string get( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns number of rows of the variable.
|
|
||||||
* |
|
||||||
* \return Number of rows of the variable |
|
||||||
*/ |
|
||||||
virtual uint getNumRows( ) const; |
|
||||||
|
|
||||||
/** Returns number of columns of the variable.
|
|
||||||
* |
|
||||||
* \return Number of columns of the variable |
|
||||||
*/ |
|
||||||
virtual uint getNumCols( ) const; |
|
||||||
|
|
||||||
/** Returns total dimension of the variable.
|
|
||||||
* |
|
||||||
* \return Total dimension of the variable |
|
||||||
*/ |
|
||||||
virtual uint getDim( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Operator for adding two ExportVariables.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be added. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the addition |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator+( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for subtracting an ExportVariable from another.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be subtracted. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the subtraction |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator-( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for add-assigning an ExportVariable to another.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be add-assigned. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the add-assignment |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator+=( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for subtract-assigning an ExportVariables from another.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be subtract-assigned. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the subtract-assignment |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator-=( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for multiplying two ExportVariables.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be multiplied from the right. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the multiplication |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator*( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for multiplying an ExportVariable to the transposed on another.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be multiplied from the right. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the multiplication with left-hand side variable transposed |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator^( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for assigning an ExportVariable to another.
|
|
||||||
* |
|
||||||
* @param[in] arg Variable to be assined. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the assignment |
|
||||||
*/ |
|
||||||
friend ExportArithmeticStatement operator==( const ExportVariable& arg1, |
|
||||||
const ExportVariable& arg2 |
|
||||||
); |
|
||||||
|
|
||||||
/** Operator for assigning an arithmetic statement to an ExportVariable.
|
|
||||||
* |
|
||||||
* @param[in] arg Arithmetic statement to be assigned. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the assignment |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement operator==( ExportArithmeticStatement arg |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Operator for adding an arithmetic statement to an ExportVariable.
|
|
||||||
* |
|
||||||
* @param[in] arg Arithmetic statement to be added. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the addition |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement operator+( ExportArithmeticStatement arg |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Operator for subtraction an arithmetic statement from an ExportVariable.
|
|
||||||
* |
|
||||||
* @param[in] arg Arithmetic statement to be subtracted. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the subtraction |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement operator-( ExportArithmeticStatement arg |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Operator for add-assigning an arithmetic statement to an ExportVariable.
|
|
||||||
* |
|
||||||
* @param[in] arg Arithmetic statement to be add-assigned. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the add-assignment |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement operator+=( ExportArithmeticStatement arg |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Operator for subtract-assigning an arithmetic statement from an ExportVariable.
|
|
||||||
* |
|
||||||
* @param[in] arg Arithmetic statement to be subtract-assigned. |
|
||||||
* |
|
||||||
* \return Arithmetic statement containing the subtract-assignment |
|
||||||
*/ |
|
||||||
ExportArithmeticStatement operator-=( ExportArithmeticStatement arg |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a copy of the variable with transposed components.
|
|
||||||
* |
|
||||||
* \return Copy of the variable with transposed components |
|
||||||
*/ |
|
||||||
ExportVariable getTranspose( ) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given row of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx Variable row index. |
|
||||||
* |
|
||||||
* \return New variable containing only the given row of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getRow( const ExportIndex& idx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given column of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx Variable column index. |
|
||||||
* |
|
||||||
* \return New variable containing only the given column of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getCol( const ExportIndex& idx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given rows of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx1 Variable index of first row of new variable. |
|
||||||
* @param[in] idx2 Variable index following last row of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given rows of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getRows( const ExportIndex& idx1, |
|
||||||
const ExportIndex& idx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given columns of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx1 Variable index of first column of new variable. |
|
||||||
* @param[in] idx2 Variable index following last column of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given columns of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getCols( const ExportIndex& idx1, |
|
||||||
const ExportIndex& idx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given rows and columns of the variable.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx1 Variable index of first row of new variable. |
|
||||||
* @param[in] rowIdx2 Variable index following last row of new variable. |
|
||||||
* @param[in] colIdx1 Variable index of first column of new variable. |
|
||||||
* @param[in] colIdx2 Variable index following last column of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given sub-matrix of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getSubMatrix( const ExportIndex& rowIdx1, |
|
||||||
const ExportIndex& rowIdx2, |
|
||||||
const ExportIndex& colIdx1, |
|
||||||
const ExportIndex& colIdx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns element at position (rowIdx, colIdx).
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return Element at position (rowIdx, colIdx) |
|
||||||
*/ |
|
||||||
ExportVariable getElement( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a copy of the variable that is transformed to a row vector.
|
|
||||||
* |
|
||||||
* \return Copy of the variable that is transformed to a row vector |
|
||||||
*/ |
|
||||||
ExportVariable makeRowVector( ) const; |
|
||||||
|
|
||||||
/** Returns a copy of the variable that is transformed to a column vector.
|
|
||||||
* |
|
||||||
* \return Copy of the variable that is transformed to a column vector |
|
||||||
*/ |
|
||||||
ExportVariable makeColVector( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether variable is a vector.
|
|
||||||
* |
|
||||||
* \return true iff variable is a vector, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isVector( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the internal data matrix.
|
|
||||||
* |
|
||||||
* \return Internal data matrix |
|
||||||
*/ |
|
||||||
const DMatrix& getGivenMatrix( ) const; |
|
||||||
|
|
||||||
/** Check whether the matrix is actually a submatrix. */ |
|
||||||
bool isSubMatrix() const; |
|
||||||
|
|
||||||
/** Check whether the matrix is diagonal. */ |
|
||||||
bool isDiagonal() const; |
|
||||||
|
|
||||||
/** Prints contents of variable to screen.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue print( ) const; |
|
||||||
|
|
||||||
private: |
|
||||||
void simpleForward(const DMatrix& _value); |
|
||||||
}; |
|
||||||
|
|
||||||
static const ExportVariable emptyConstExportVariable; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_VARIABLE_HPP
|
|
@ -1,349 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/export_variable.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_utils.hpp> |
|
||||||
#include <acado/code_generation/export_argument_internal.hpp> |
|
||||||
#include <acado/code_generation/export_index.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
class ExportArithmeticStatement; |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Defines a matrix-valued variable to be used for exporting code. |
|
||||||
* |
|
||||||
* \ingroup UserDataStructures |
|
||||||
* |
|
||||||
* The class ExportVariableInternal defines a matrix-valued variable to be used for exporting |
|
||||||
* code. Instances of this class can be used similar to usual DMatrix objects |
|
||||||
* but offer additional functionality, e.g. they allow to export arithmetic |
|
||||||
* expressions and they can be passed as argument to exported functions. By |
|
||||||
* default, all entries of a ExportVariableInternal are undefined, but each of its |
|
||||||
* component can be set to a fixed value if known beforehand. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Milan Vukov |
|
||||||
*/ |
|
||||||
|
|
||||||
class ExportVariableInternal : public ExportArgumentInternal |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
*/ |
|
||||||
ExportVariableInternal( ); |
|
||||||
|
|
||||||
/** Constructor which takes the name and type string of the variable.
|
|
||||||
* Moreover, it initializes the variable with the dimensions and the |
|
||||||
* values of the given matrix. |
|
||||||
* |
|
||||||
* @param[in] _name Name of the argument. |
|
||||||
* @param[in] _data DMatrix used for initialization. |
|
||||||
* @param[in] _type Data type of the argument. |
|
||||||
* @param[in] _dataStruct Global data struct to which the argument belongs to (if any). |
|
||||||
* @param[in] _callByValue Flag indicating whether argument it to be called by value. |
|
||||||
*/ |
|
||||||
ExportVariableInternal( const std::string& _name, |
|
||||||
const DMatrixPtr& _data, |
|
||||||
ExportType _type = REAL, |
|
||||||
ExportStruct _dataStruct = ACADO_LOCAL, |
|
||||||
bool _callItByValue = false, |
|
||||||
const std::string& _prefix = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportVariableInternal( ); |
|
||||||
|
|
||||||
/** Clone constructor (deep copy).
|
|
||||||
* |
|
||||||
* \return Pointer to cloned object. |
|
||||||
*/ |
|
||||||
virtual ExportVariableInternal* clone() const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to zero.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to zero, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isZero( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to one.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to one, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isOne( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns whether given component is set to a given value.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return true iff given component is set to a given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isGiven( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
virtual bool isGiven() const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns string containing the value of a given component. If its
|
|
||||||
* value is undefined, the string contains the address of the component. |
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* |
|
||||||
* \return std::string containing the value of a given component |
|
||||||
*/ |
|
||||||
const std::string get( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns number of rows of the variable.
|
|
||||||
* |
|
||||||
* \return Number of rows of the variable |
|
||||||
*/ |
|
||||||
virtual uint getNumRows( ) const; |
|
||||||
|
|
||||||
/** Returns number of columns of the variable.
|
|
||||||
* |
|
||||||
* \return Number of columns of the variable |
|
||||||
*/ |
|
||||||
virtual uint getNumCols( ) const; |
|
||||||
|
|
||||||
/** Returns total dimension of the variable.
|
|
||||||
* |
|
||||||
* \return Total dimension of the variable |
|
||||||
*/ |
|
||||||
virtual uint getDim( ) const; |
|
||||||
|
|
||||||
/** Returns a copy of the variable with transposed components.
|
|
||||||
* |
|
||||||
* \return Copy of the variable with transposed components |
|
||||||
*/ |
|
||||||
ExportVariable getTranspose( ) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given row of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx Variable row index. |
|
||||||
* |
|
||||||
* \return New variable containing only the given row of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getRow( const ExportIndex& idx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given column of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx Variable column index. |
|
||||||
* |
|
||||||
* \return New variable containing only the given column of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getCol( const ExportIndex& idx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given rows of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx1 Variable index of first row of new variable. |
|
||||||
* @param[in] idx2 Variable index following last row of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given rows of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getRows( const ExportIndex& idx1, |
|
||||||
const ExportIndex& idx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given columns of the variable.
|
|
||||||
* |
|
||||||
* @param[in] idx1 Variable index of first column of new variable. |
|
||||||
* @param[in] idx2 Variable index following last column of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given columns of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getCols( const ExportIndex& idx1, |
|
||||||
const ExportIndex& idx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Returns a new variable containing only the given rows and columns of the variable.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx1 Variable index of first row of new variable. |
|
||||||
* @param[in] rowIdx2 Variable index following last row of new variable. |
|
||||||
* @param[in] colIdx1 Variable index of first column of new variable. |
|
||||||
* @param[in] colIdx2 Variable index following last column of new variable. |
|
||||||
* |
|
||||||
* \return New variable containing only the given sub-matrix of the variable |
|
||||||
*/ |
|
||||||
ExportVariable getSubMatrix( const ExportIndex& _rowIdx1, |
|
||||||
const ExportIndex& _rowIdx2, |
|
||||||
const ExportIndex& _colIdx1, |
|
||||||
const ExportIndex& _colIdx2 |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns a copy of the variable that is transformed to a row vector.
|
|
||||||
* |
|
||||||
* \return Copy of the variable that is transformed to a row vector |
|
||||||
*/ |
|
||||||
ExportVariable makeRowVector( ) const; |
|
||||||
|
|
||||||
/** Returns a copy of the variable that is transformed to a column vector.
|
|
||||||
* |
|
||||||
* \return Copy of the variable that is transformed to a column vector |
|
||||||
*/ |
|
||||||
ExportVariable makeColVector( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether variable is a vector.
|
|
||||||
* |
|
||||||
* \return true iff variable is a vector, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool isVector( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the internal data matrix.
|
|
||||||
* |
|
||||||
* \return Internal data matrix |
|
||||||
*/ |
|
||||||
const DMatrix& getGivenMatrix( ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Prints contents of variable to screen.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue print( ) const; |
|
||||||
|
|
||||||
/** Check whether the matrix is actually a submatrix. */ |
|
||||||
bool isSubMatrix() const; |
|
||||||
|
|
||||||
/** Check whether the matrix is diagonal. */ |
|
||||||
bool isDiagonal() const; |
|
||||||
|
|
||||||
//
|
|
||||||
// PROTECTED MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
protected: |
|
||||||
|
|
||||||
/** Returns column dimension of the variable.
|
|
||||||
* |
|
||||||
* \return Column dimension of the variable |
|
||||||
*/ |
|
||||||
virtual uint getColDim( ) const; |
|
||||||
|
|
||||||
/** Returns total index of given component within memory.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Row index of the component. |
|
||||||
* @param[in] colIdx Column index of the component. |
|
||||||
* |
|
||||||
* \return Total index of given component |
|
||||||
*/ |
|
||||||
virtual ExportIndex getTotalIdx( const ExportIndex& rowIdx, |
|
||||||
const ExportIndex& colIdx |
|
||||||
) const; |
|
||||||
|
|
||||||
/** Assigns offsets and dimensions of a sub-matrix. This function is used to
|
|
||||||
* access only a sub-matrix of the variable without copying its values to |
|
||||||
* a new variable. |
|
||||||
* |
|
||||||
* @param[in] _rowOffset Variable index of first row of sub-matrix. |
|
||||||
* @param[in] _colOffset Variable index of first column of sub-matrix. |
|
||||||
* @param[in] _rowDim Row dimension of variable (as only the submatrix data is stored). |
|
||||||
* @param[in] _colDim Column dimension of variable (as only the submatrix data is stored). |
|
||||||
* @param[in] _nRows Number of rows of sub-matrix. |
|
||||||
* @param[in] _nCols Number of columns of sub-matrix. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN, \n |
|
||||||
* RET_INVALID_ARGUMENTS |
|
||||||
*/ |
|
||||||
returnValue setSubmatrixOffsets( const ExportIndex& _rowOffset, |
|
||||||
const ExportIndex& _colOffset, |
|
||||||
unsigned _rowDim = 0, |
|
||||||
unsigned _colDim = 0, |
|
||||||
unsigned _nRows = 0, |
|
||||||
unsigned _nCols = 0 |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether given component is set to given value.
|
|
||||||
* |
|
||||||
* @param[in] rowIdx Variable row index of the component. |
|
||||||
* @param[in] colIdx Variable column index of the component. |
|
||||||
* @param[in] _value Value used for comparison. |
|
||||||
* |
|
||||||
* \return true iff given component is set to given value, \n |
|
||||||
* false otherwise |
|
||||||
*/ |
|
||||||
bool hasValue( const ExportIndex& _rowIdx, |
|
||||||
const ExportIndex& _colIdx, |
|
||||||
double _value |
|
||||||
) const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
bool doAccessTransposed; /**< Flag indicating whether variable is to be accessed in a transposed manner. */ |
|
||||||
|
|
||||||
ExportIndex rowOffset; /**< Index of first row of a possible sub-matrix of the variable. */ |
|
||||||
ExportIndex colOffset; /**< Index of first column of a possible sub-matrix of the variable. */ |
|
||||||
unsigned rowDim; /**< Row dimension of variable (as only the submatrix data is stored). */ |
|
||||||
unsigned colDim; /**< Column dimension of variable (as only the submatrix data is stored). */ |
|
||||||
unsigned nRows; /**< Number of rows of a possible sub-matrix of the variable. */ |
|
||||||
unsigned nCols; /**< Number of columns of a possible sub-matrix of the variable. */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/dirk3_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_DIRK3_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_DIRK3_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/dirk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored diagonally implicit 2-stage Runge-Kutta method of order 3 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class DiagonallyIRK3Export allows to export a tailored diagonally implicit 2-stage Runge-Kutta method of order 3 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class DiagonallyIRK3Export : public DiagonallyImplicitRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
DiagonallyIRK3Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiagonallyIRK3Export( const DiagonallyIRK3Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~DiagonallyIRK3Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createDiagonallyIRK3Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_DIRK3_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/dirk4_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_DIRK4_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_DIRK4_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/dirk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored diagonally implicit 3-stage Runge-Kutta method of order 4 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class DiagonallyIRK4Export allows to export a tailored diagonally implicit 3-stage Runge-Kutta method of order 4 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class DiagonallyIRK4Export : public DiagonallyImplicitRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
DiagonallyIRK4Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiagonallyIRK4Export( const DiagonallyIRK4Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~DiagonallyIRK4Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createDiagonallyIRK4Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_DIRK4_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/dirk5_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_DIRK5_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_DIRK5_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/dirk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored diagonally implicit 5-stage Runge-Kutta method of order 5 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class DiagonallyIRK5Export allows to export a tailored diagonally implicit 5-stage Runge-Kutta method of order 5 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class DiagonallyIRK5Export : public DiagonallyImplicitRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
DiagonallyIRK5Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiagonallyIRK5Export( const DiagonallyIRK5Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~DiagonallyIRK5Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createDiagonallyIRK5Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_DIRK5_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,308 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/dirk_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_DIRK_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_DIRK_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored diagonally implicit Runge-Kutta integrator for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class DiagonallyImplicitRKExport allows to export a tailored diagonally implicit Runge-Kutta integrator |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class DiagonallyImplicitRKExport : public ForwardIRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
DiagonallyImplicitRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiagonallyImplicitRKExport( const DiagonallyImplicitRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~DiagonallyImplicitRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiagonallyImplicitRKExport& operator=( const DiagonallyImplicitRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] A1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] B1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& Ah ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear input system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareInputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] A3 A constant matrix defining the equations of the linear output system. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& Ah, |
|
||||||
bool DERIVATIVES = false ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states, defined by the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& index4, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& Bh, |
|
||||||
bool STATES, |
|
||||||
uint number ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear output system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareOutputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Forms a constant linear system matrix for the collocation equations, given a constant jacobian and mass matrix.
|
|
||||||
* |
|
||||||
* @param[in] jacobian given constant Jacobian matrix |
|
||||||
* @param[in] mass given constant mass matrix |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual DMatrix formMatrix( const DMatrix& mass, const DMatrix& jacobian ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
const ExportVariable& det, |
|
||||||
bool DERIVATIVES = false ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& Bh, |
|
||||||
const ExportVariable& det, |
|
||||||
bool STATES, |
|
||||||
uint number ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the matrix of the linear system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index1 The loop index of the outer loop. |
|
||||||
* @param[in] index2 The loop index of the inner loop. |
|
||||||
* @param[in] tmp_index A temporary index to be used. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] evaluateB True if the right-hand side of the linear system should also be evaluated, false otherwise. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateMatrix( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& _rk_A, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
bool evaluateB, |
|
||||||
bool DERIVATIVES ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateStatesImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
const ExportIndex& stage, |
|
||||||
const ExportIndex& i, |
|
||||||
const ExportIndex& j ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the right-hand side of the linear system at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateRhsImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& stage ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the integrator
|
|
||||||
//
|
|
||||||
inline DiagonallyImplicitRKExport* createDiagonallyImplicitRKExport( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName ) |
|
||||||
{ |
|
||||||
int sensGen; |
|
||||||
_userInteraction->get( DYNAMIC_SENSITIVITY, sensGen ); |
|
||||||
if ( (ExportSensitivityType)sensGen == FORWARD ) { |
|
||||||
return new DiagonallyImplicitRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else { |
|
||||||
ACADOERROR( RET_INVALID_OPTION ); |
|
||||||
return new DiagonallyImplicitRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_DIRK_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,229 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/discrete_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_DT_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_DT_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/integrator_export.hpp> |
|
||||||
|
|
||||||
#include <acado/code_generation/export_algorithm_factory.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored discrete-time 'integrator' for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class DiscreteTimeExport allows to export a tailored discrete-time 'integrator' |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class DiscreteTimeExport : public IntegratorExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
DiscreteTimeExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiscreteTimeExport( const DiscreteTimeExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~DiscreteTimeExport( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
DiscreteTimeExport& operator=( const DiscreteTimeExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets a polynomial NARX model to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] delay The delay for the states in the NARX model. |
|
||||||
* @param[in] parms The parameters defining the polynomial NARX model. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setNARXmodel( const uint delay, const DMatrix& parms ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param rhs The expressions corresponding the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<Expression> rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \param _outputDependencies A separate dependency matrix for each output. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output, |
|
||||||
const std::vector<DMatrix> _outputDependencies ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
/** Copies all class members from given object.
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue copy( const DiscreteTimeExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportVariable rk_diffsTemp3; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createDiscreteTimeExport( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName ); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_DT_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,92 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/erk2_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK2_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK2_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator of order 2 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExplicitRungeKutta2Export allows to export a tailored explicit Runge-Kutta integrator of order 2 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExplicitRungeKutta2Export : public ExplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta2Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta2Export( const ExplicitRungeKutta2Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExplicitRungeKutta2Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createExplicitRungeKutta2Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK2_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/erk3_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK3_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK3_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator of order 3 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExplicitRungeKutta3Export allows to export a tailored explicit Runge-Kutta integrator of order 3 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExplicitRungeKutta3Export : public ExplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta3Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta3Export( const ExplicitRungeKutta3Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExplicitRungeKutta3Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createExplicitRungeKutta3Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK3_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,94 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/erk4_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK4_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK4_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator of order 4 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExplicitRungeKutta4Export allows to export a tailored explicit Runge-Kutta integrator of order 4 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExplicitRungeKutta4Export : public ExplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta4Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExplicitRungeKutta4Export( const ExplicitRungeKutta4Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExplicitRungeKutta4Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createExplicitRungeKutta4Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK4_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,146 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrators/erk_3sweep_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK_3SWP_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK_3SWP_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_adjoint_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator with three-sweeps second order sensitivity propagation for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ThreeSweepsERKExport allows to export a tailored explicit Runge-Kutta integrator with three-sweeps second order sensitivity propagation |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ThreeSweepsERKExport : public AdjointERKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ThreeSweepsERKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ThreeSweepsERKExport( const ThreeSweepsERKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ThreeSweepsERKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
Expression returnLowerTriangular( const Expression& expr ); |
|
||||||
|
|
||||||
Expression symmetricDoubleProduct( const Expression& expr, const Expression& arg ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportAcadoFunction diffs_sweep3; /**< Module to export ODE. */ |
|
||||||
ExportVariable rk_backward_sweep; /**< Variable containing intermediate results of a backward sweep of the RK integrator. */ |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK_3SWP_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,137 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrators/erk_adjoint_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK_ADJOINT_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK_ADJOINT_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator with adjoint first order sensitivity propagation for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class AdjointERKExport allows to export a tailored explicit Runge-Kutta integrator with adjoint first order sensitivity propagation |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class AdjointERKExport : public ExplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
AdjointERKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
AdjointERKExport( const AdjointERKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~AdjointERKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportVariable rk_forward_sweep; /**< Variable containing intermediate results of a forward sweep of the RK integrator. */ |
|
||||||
// ExportVariable seed_backward; /**< Variable containing the seed for a backward propagation of the RK integrator. */
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK_ADJOINT_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,229 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrators/erk_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/rk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExplicitRungeKuttaExport allows to export a tailored explicit Runge-Kutta integrator |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExplicitRungeKuttaExport : public RungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExplicitRungeKuttaExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExplicitRungeKuttaExport( const ExplicitRungeKuttaExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExplicitRungeKuttaExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearInput( const DMatrix& M1, const DMatrix& A1, const DMatrix& B1 ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const std::string& _rhs3, const std::string& _diffs_rhs3 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param rhs The expressions corresponding the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<Expression> rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \param _outputDependencies A separate dependency matrix for each output. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output, |
|
||||||
const std::vector<DMatrix> _outputDependencies ); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/lifted_erk_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk_adjoint_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk_fob_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk_3sweep_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk_export.ipp> |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,73 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file include/acado/code_generation/integrators/erk_export.ipp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// Create the integrator |
|
||||||
// |
|
||||||
inline ExplicitRungeKuttaExport* createExplicitRungeKuttaExport( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName ) |
|
||||||
{ |
|
||||||
int sensGen; |
|
||||||
_userInteraction->get( DYNAMIC_SENSITIVITY, sensGen ); |
|
||||||
int liftedGen; |
|
||||||
_userInteraction->get( IMPLICIT_INTEGRATOR_MODE, liftedGen ); |
|
||||||
if ( (ImplicitIntegratorMode)liftedGen == LIFTED && ((ExportSensitivityType)sensGen == FORWARD || (ExportSensitivityType)sensGen == INEXACT) ) { |
|
||||||
return new LiftedERKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ExportSensitivityType)sensGen == FORWARD || (ExportSensitivityType)sensGen == NO_SENSITIVITY ) { |
|
||||||
return new ExplicitRungeKuttaExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if( (ExportSensitivityType)sensGen == BACKWARD ) { |
|
||||||
return new AdjointERKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if( (ExportSensitivityType)sensGen == FORWARD_OVER_BACKWARD || (ExportSensitivityType)sensGen == SYMMETRIC_FB ) { |
|
||||||
return new ForwardOverBackwardERKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if( (ExportSensitivityType)sensGen == SYMMETRIC ) { |
|
||||||
return new ThreeSweepsERKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else { |
|
||||||
ACADOERROR( RET_INVALID_OPTION ); |
|
||||||
return new ExplicitRungeKuttaExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
// end of file. |
|
@ -1,115 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrators/erk_fob_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_ERK_FOB_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_ERK_FOB_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_adjoint_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Runge-Kutta integrator with forward-over-backward second order sensitivity propagation for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ForwardOverBackwardERKExport allows to export a tailored explicit Runge-Kutta integrator with forward-over-backward second order sensitivity propagation |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ForwardOverBackwardERKExport : public AdjointERKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ForwardOverBackwardERKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardOverBackwardERKExport( const ForwardOverBackwardERKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ForwardOverBackwardERKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
Expression returnLowerTriangular( const Expression& expr ); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_ERK_FOB_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/explicit_euler_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPLICIT_EULER_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPLICIT_EULER_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored explicit Euler method for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ExplicitEulerExport allows to export a tailored explicit Euler method |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExplicitEulerExport : public ExplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ExplicitEulerExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExplicitEulerExport( const ExplicitEulerExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExplicitEulerExport( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createExplicitEulerExport( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPLICIT_EULER_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,96 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/export_auxiliary_sim_functions.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_AUXILIARY_SIM_FUNCTIONS_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_AUXILIARY_SIM_FUNCTIONS_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief A class for generating some helper functions. |
|
||||||
* |
|
||||||
* \ingroup AuxiliaryFunctionality |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExportAuxiliarySimFunctions |
|
||||||
{ |
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _moduleName Module name for customization. |
|
||||||
* @param[in] _modulePrefix Module prefix for customization. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportAuxiliarySimFunctions( const std::string& _headerFileName, |
|
||||||
const std::string& _sourceFileName, |
|
||||||
const std::string& _moduleName = "acado", |
|
||||||
const std::string& _modulePrefix = "ACADO", |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "double", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = std::string() |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor. */ |
|
||||||
virtual ~ExportAuxiliarySimFunctions() |
|
||||||
{} |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( ); |
|
||||||
|
|
||||||
/** Export the interface. */ |
|
||||||
returnValue exportCode(); |
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
ExportTemplatedFile source; |
|
||||||
ExportTemplatedFile header; |
|
||||||
std::string moduleName; |
|
||||||
std::string modulePrefix; |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_AUXILIARY_SIM_FUNCTIONS_HPP
|
|
@ -1,112 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file ... |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_EXPORT_MATLAB_INTEGRATOR_HPP |
|
||||||
#define ACADO_TOOLKIT_EXPORT_MATLAB_INTEGRATOR_HPP |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/export_templated_file.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief ... |
|
||||||
* |
|
||||||
* \ingroup ... |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ExportMatlabIntegrator : public ExportTemplatedFile |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _templateName Name of a template. |
|
||||||
* @param[in] _fileName Name of exported file. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
* @param[in] _realString std::string to be used to declare real variables. |
|
||||||
* @param[in] _intString std::string to be used to declare integer variables. |
|
||||||
* @param[in] _precision Number of digits to be used for exporting real values. |
|
||||||
* @param[in] _commentString std::string to be used for exporting comments. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportMatlabIntegrator( const std::string& _templateName, |
|
||||||
const std::string& _fileName, |
|
||||||
const std::string& _commonHeaderName = "", |
|
||||||
const std::string& _realString = "real_t", |
|
||||||
const std::string& _intString = "int", |
|
||||||
int _precision = 16, |
|
||||||
const std::string& _commentString = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportMatlabIntegrator( const ExportMatlabIntegrator& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ExportMatlabIntegrator( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ExportMatlabIntegrator& operator=( const ExportMatlabIntegrator& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Configure the template
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue configure( const uint firstOrder, const uint online, const uint debugMode, const uint timingCalls, const uint numStages ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_EXPORT_MATLAB_INTEGRATOR_HPP
|
|
@ -1,94 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/gauss_legendre2_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_GAUSS_LEG2_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_GAUSS_LEG2_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored Gauss-Legendre method of order 2 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class GaussLegendre2Export allows to export a tailored Gauss-Legendre method of order 2 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class GaussLegendre2Export : public ImplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
GaussLegendre2Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GaussLegendre2Export( const GaussLegendre2Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~GaussLegendre2Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createGaussLegendre2Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_GAUSS_LEG2_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,95 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/gauss_legendre4_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_GAUSS_LEG4_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_GAUSS_LEG4_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored Gauss-Legendre method of order 4 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class GaussLegendre4Export allows to export a tailored Gauss-Legendre method of order 4 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class GaussLegendre4Export : public ImplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
GaussLegendre4Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GaussLegendre4Export( const GaussLegendre4Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~GaussLegendre4Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createGaussLegendre4Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_GAUSS_LEG4_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,96 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/gauss_legendre6_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_GAUSS_LEG6_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_GAUSS_LEG6_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored Gauss-Legendre method of order 6 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class GaussLegendre6Export allows to export a tailored Gauss-Legendre method of order 6 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class GaussLegendre6Export : public ImplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
GaussLegendre6Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GaussLegendre6Export( const GaussLegendre6Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~GaussLegendre6Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createGaussLegendre6Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_GAUSS_LEG6_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,94 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/gauss_legendre8_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_GAUSS_LEG8_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_GAUSS_LEG8_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored Gauss-Legendre method of order 8 for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class GaussLegendre8Export allows to export a tailored Gauss-Legendre method of order 8 |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class GaussLegendre8Export : public ImplicitRungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
private: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
GaussLegendre8Export( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
GaussLegendre8Export( const GaussLegendre8Export& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~GaussLegendre8Export( ); |
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
IntegratorExport* createGaussLegendre8Export( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName); |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_GAUSS_LEG6_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,508 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/integrator_export.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Rien Quirynen |
|
||||||
* \date 2010-2011 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/matrix_vector/matrix_vector.hpp> |
|
||||||
#include <acado/code_generation/export_algorithm_factory.hpp> |
|
||||||
#include <acado/ocp/model_data.hpp> |
|
||||||
#include <acado/code_generation/integrators/integrator_export_types.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored integrator for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class IntegratorExport allows to export a tailored integrator |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Rien Quirynen |
|
||||||
*/ |
|
||||||
class IntegratorExport : public ExportAlgorithm |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
IntegratorExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
IntegratorExport( const IntegratorExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~IntegratorExport( ); |
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
IntegratorExport& operator=( const IntegratorExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearInput( const DMatrix& M1, const DMatrix& A1, const DMatrix& B1 ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setNonlinearFeedback( const DMatrix& C, const Expression& feedb ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const std::string& _rhs3, const std::string& _diffs_rhs3 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns the model to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] _name_ODE Name of the function, evaluating the ODE right-hand side. |
|
||||||
* @param[in] _name_diffs_ODE Name of the function, evaluating the derivatives of the ODE right-hand side. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setModel( const std::string& _name_ODE, |
|
||||||
const std::string& _name_diffs_ODE ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets a polynomial NARX model to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] delay The delay for the states in the NARX model. |
|
||||||
* @param[in] parms The parameters defining the polynomial NARX model. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
virtual returnValue setNARXmodel( const uint delay, const DMatrix& parms ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Passes all the necessary model data to the integrator.
|
|
||||||
* |
|
||||||
* @param[in] data The model data. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setModelData( const ModelData& data ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to update the sensitivities of the states, defined by the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue updateInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to propagate the sensitivities of the states, defined by the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue propagateInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to update the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue updateImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to propagate the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue propagateImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& _index3, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to update the sensitivities of the states, defined by the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue updateOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to propagate the sensitivities of the states, defined by the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue propagateOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets integration grid (this grid is expected to be non equidistant, otherwise use the other setGrid function).
|
|
||||||
* |
|
||||||
* @param[in] _grid integration grid |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setGrid( const Grid& _grid ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const = 0; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param rhs The expressions corresponding the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<Expression> rhs ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \param _outputDependencies A separate dependency matrix for each output. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output, |
|
||||||
const std::vector<DMatrix> _outputDependencies ) = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the grid of the integrator. \n
|
|
||||||
*
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue getGrid( Grid& grid_ ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the number of integration steps along the prediction horizon. \n
|
|
||||||
*
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue getNumSteps( DVector& _numSteps ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the output expressions. \n
|
|
||||||
*
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue getOutputExpressions( std::vector<Expression>& outputExpressions_ ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the output grids. \n
|
|
||||||
*
|
|
||||||
* \return SUCCESSFUL_RETURN \n |
|
||||||
*/ |
|
||||||
virtual returnValue getOutputGrids( std::vector<Grid>& outputGrids_ ) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns whether the grid is equidistant. \n
|
|
||||||
*
|
|
||||||
* \return true iff the grid is equidistant, false otherwise. \n |
|
||||||
*/ |
|
||||||
virtual bool equidistantControlGrid( ) const; |
|
||||||
|
|
||||||
|
|
||||||
const std::string getNameRHS() const; |
|
||||||
const std::string getNameDiffsRHS() const; |
|
||||||
virtual const std::string getNameFullRHS() const; |
|
||||||
|
|
||||||
const std::string getNameOutputRHS() const; |
|
||||||
const std::string getNameOutputDiffs() const; |
|
||||||
|
|
||||||
const std::string getNameOUTPUT( uint index ) const; |
|
||||||
const std::string getNameDiffsOUTPUT( uint index ) const; |
|
||||||
uint getDimOUTPUT( uint index ) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] A3 . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
DMatrix expandOutputMatrix( const DMatrix& A3 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Copies all class members from given object.
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue copy( const IntegratorExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Frees internal dynamic memory to yield an empty function.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue clear( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Get the index of the integration interval, corresponding a certain time.
|
|
||||||
* |
|
||||||
* @param[in] time The time. |
|
||||||
* |
|
||||||
* \return The index of the integration interval. |
|
||||||
*/ |
|
||||||
uint getIntegrationInterval( double time ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual ExportVariable getAuxVariable() const = 0; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
uint NX1; |
|
||||||
uint NX2; |
|
||||||
uint NX3; |
|
||||||
uint NDX3; |
|
||||||
uint NXA3; |
|
||||||
|
|
||||||
uint diffsDim; /**< This is the total number of sensitivities needed. */ |
|
||||||
uint inputDim; /**< This is the dimension of the input to the integrator. */ |
|
||||||
|
|
||||||
bool timeDependant; |
|
||||||
|
|
||||||
DMatrix M11, A11, B11; |
|
||||||
DMatrix A33, M33; |
|
||||||
|
|
||||||
bool exportRhs; /**< True if the right-hand side and their derivatives should be exported too. */ |
|
||||||
bool crsFormat; /**< True if the CRS format is used for the jacobian of output functions. */ |
|
||||||
|
|
||||||
Grid grid; /**< Evaluation grid along the prediction horizon. */ |
|
||||||
DVector numSteps; /**< The number of integration steps per shooting interval. */ |
|
||||||
|
|
||||||
ExportFunction fullRhs; /**< Function that evaluates the full right-hand side. */ |
|
||||||
ExportVariable rhs_in; |
|
||||||
ExportVariable rhs_out; |
|
||||||
|
|
||||||
ExportFunction integrate; /**< Function that integrates the exported ODE. */ |
|
||||||
ExportAcadoFunction rhs; /**< Module to export ODE. */ |
|
||||||
ExportAcadoFunction diffs_rhs; /**< Module to export the evaluation of the derivatives of the ordinary differential equations. */ |
|
||||||
|
|
||||||
ExportAcadoFunction lin_input; |
|
||||||
|
|
||||||
ExportAcadoFunction rhs3; |
|
||||||
ExportAcadoFunction diffs_rhs3; |
|
||||||
|
|
||||||
ExportVariable error_code; /**< Variable containing the error code, returned by the integrator. */ |
|
||||||
ExportVariable reset_int; /**< Variable containing the number of the current integration step. */ |
|
||||||
ExportVariable rk_index; /**< Variable containing the number of the current shooting interval. */ |
|
||||||
ExportVariable rk_ttt; /**< Variable containing the integration time. */ |
|
||||||
ExportVariable rk_xxx; /**< Variable containing the current integrator state. */ |
|
||||||
ExportVariable rk_eta; /**< Variable containing the inputs or the results of the integrator. */ |
|
||||||
|
|
||||||
ExportVariable rk_diffsPrev1; |
|
||||||
ExportVariable rk_diffsNew1; |
|
||||||
|
|
||||||
ExportVariable rk_diffsPrev2; /**< Variable containing the sensitivities from the previous integration step. */ |
|
||||||
ExportVariable rk_diffsNew2; /**< Variable containing the derivatives wrt the previous values. */ |
|
||||||
ExportVariable rk_diffsTemp2; /**< Variable containing intermediate results of evaluations of the derivatives of the differential equations (ordinary and algebraic). */ |
|
||||||
|
|
||||||
ExportVariable rk_diffsNew3; |
|
||||||
ExportVariable rk_diffsPrev3; |
|
||||||
|
|
||||||
DifferentialState x; /**< The differential states in the model. */ |
|
||||||
DifferentialStateDerivative dx; /**< The differential state derivatives in the model. */ |
|
||||||
AlgebraicState z; /**< The algebraic states in the model. */ |
|
||||||
Control u; /**< The control inputs in the model. */ |
|
||||||
OnlineData od; /**< The "online" data values in the model. */ |
|
||||||
|
|
||||||
std::vector<Grid> outputGrids; /**< A separate grid for each output. */ |
|
||||||
std::vector<Expression> outputExpressions; /**< A separate expression for each output. */ |
|
||||||
std::vector<DMatrix> outputDependencies; /**< A separate dependency matrix for each output. */ |
|
||||||
std::vector<ExportAcadoFunction> outputs; /**< Module to export output functions. */ |
|
||||||
std::vector<ExportAcadoFunction> diffs_outputs; /**< Module to export the evaluation of the derivatives of the output functions. */ |
|
||||||
|
|
||||||
std::vector<uint> num_outputs; /**< A separate dimension for each output. */ |
|
||||||
}; |
|
||||||
|
|
||||||
/** Factory for creation of exported integrators.*/ |
|
||||||
typedef ExportAlgorithmFactory<IntegratorExport, ExportIntegratorType> IntegratorExportFactory; |
|
||||||
|
|
||||||
/** Shared pointer to an integrator. */ |
|
||||||
typedef std::shared_ptr< IntegratorExport > IntegratorExportPtr; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,77 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/integrator/integrator_export_types.hpp |
|
||||||
* \author Hans Joachim Ferreau, Boris Houska, Rien Quirynen, Milan Vukov |
|
||||||
* \date 2010-2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_INTEGRATOR_EXPORT_TYPES_HPP |
|
||||||
#define ACADO_TOOLKIT_INTEGRATOR_EXPORT_TYPES_HPP |
|
||||||
|
|
||||||
#include <acado/utils/acado_namespace_macros.hpp> |
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/** Summarizes all available integrators for code generation. */ |
|
||||||
enum ExportIntegratorType{ |
|
||||||
|
|
||||||
INT_EX_EULER, /**< Explicit Euler method. */ |
|
||||||
INT_RK2, /**< Explicit Runge-Kutta integrator of order 2. */ |
|
||||||
INT_RK3, /**< Explicit Runge-Kutta integrator of order 3. */ |
|
||||||
INT_RK4, /**< Explicit Runge-Kutta integrator of order 4. */ |
|
||||||
INT_IRK_GL2, /**< Gauss-Legendre integrator of order 2 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
INT_IRK_GL4, /**< Gauss-Legendre integrator of order 4 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
INT_IRK_GL6, /**< Gauss-Legendre integrator of order 6 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
INT_IRK_GL8, /**< Gauss-Legendre integrator of order 8 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
|
|
||||||
INT_IRK_RIIA1, /**< Radau IIA integrator of order 1 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
INT_IRK_RIIA3, /**< Radau IIA integrator of order 3 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
INT_IRK_RIIA5, /**< Radau IIA integrator of order 5 (Continuous output Implicit Runge-Kutta). */ |
|
||||||
|
|
||||||
INT_DIRK3, /**< Diagonally Implicit 2-stage Runge-Kutta integrator of order 3 (Continuous output). */ |
|
||||||
INT_DIRK4, /**< Diagonally Implicit 3-stage Runge-Kutta integrator of order 4 (Continuous output). */ |
|
||||||
INT_DIRK5, /**< Diagonally Implicit 5-stage Runge-Kutta integrator of order 5 (Continuous output). */ |
|
||||||
|
|
||||||
INT_DT, /**< An algorithm which handles the simulation and sensitivity generation for a discrete time state-space model. */ |
|
||||||
INT_NARX /**< An algorithm which handles the simulation and sensitivity generation for a NARX model. */ |
|
||||||
}; |
|
||||||
|
|
||||||
/** Summarizes all possible sensitivity generation types for exported integrators. */ |
|
||||||
enum ExportSensitivityType{ |
|
||||||
|
|
||||||
NO_SENSITIVITY, /**< No sensitivities are computed, if possible. */ |
|
||||||
FORWARD, /**< Sensitivities are computed in forward mode. */ |
|
||||||
BACKWARD, /**< Sensitivities are computed in backward mode. */ |
|
||||||
FORWARD_OVER_BACKWARD, /**< Sensitivities (first and second order) are computed. */ |
|
||||||
SYMMETRIC, /**< Sensitivities (first and second order) are computed. */ |
|
||||||
SYMMETRIC_FB, /**< Sensitivities (first and second order) are computed. */ |
|
||||||
INEXACT /**< Inexact sensitivities are computed by Newton iterations. */ |
|
||||||
}; |
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_INTEGRATOR_EXPORT_TYPES_HPP
|
|
@ -1,59 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/code_generation/integrators/integrator_generation.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_INTEGRATOR_GENERATION_HPP |
|
||||||
#define ACADO_TOOLKIT_INTEGRATOR_GENERATION_HPP |
|
||||||
|
|
||||||
|
|
||||||
// LIST OF HEADER FILES:
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/integrator_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/rk_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/explicit_euler_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk2_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk3_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/erk4_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/gauss_legendre2_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/gauss_legendre4_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/gauss_legendre6_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/gauss_legendre8_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/radau_IIA1_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/radau_IIA3_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/radau_IIA5_export.hpp> |
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_INTEGRATOR_GENERATION_HPP
|
|
@ -1,606 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2012 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_IRK_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_IRK_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/rk_export.hpp> |
|
||||||
#include <acado/code_generation/linear_solvers/linear_solver_generation.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored implicit Runge-Kutta integrator for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ImplicitRungeKuttaExport allows to export a tailored implicit Runge-Kutta integrator |
|
||||||
* for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ImplicitRungeKuttaExport : public RungeKuttaExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ImplicitRungeKuttaExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ImplicitRungeKuttaExport( const ImplicitRungeKuttaExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ImplicitRungeKuttaExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ImplicitRungeKuttaExport& operator=( const ImplicitRungeKuttaExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** This routine sets the eigenvalues of the inverse of the AA matrix. */ |
|
||||||
returnValue setEigenvalues( const DMatrix& _eig ); |
|
||||||
|
|
||||||
/** This routine sets the transformation matrices, defined by the inverse of the AA matrix. */ |
|
||||||
returnValue setSimplifiedTransformations( const DMatrix& _transf1, const DMatrix& _transf2 ); |
|
||||||
returnValue setSimplifiedTransformations( const DMatrix& _transf1, const DMatrix& _transf2, const DMatrix& _transf1_T, const DMatrix& _transf2_T ); |
|
||||||
|
|
||||||
/** This routine sets the transformation matrices, defined by the inverse of the AA matrix. */ |
|
||||||
returnValue setSingleTransformations( const double _tau, const DVector& _low_tria, const DMatrix& _transf1, const DMatrix& _transf2 ); |
|
||||||
returnValue setSingleTransformations( const double _tau, const DVector& _low_tria, const DMatrix& _transf1, const DMatrix& _transf2, const DMatrix& _transf1_T, const DMatrix& _transf2_T ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns the model to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] _rhs Name of the function, evaluating the right-hand side. |
|
||||||
* @param[in] _diffs_rhs Name of the function, evaluating the derivatives of the right-hand side. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
|
|
||||||
returnValue setModel( const std::string& _rhs, const std::string& _diffs_rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param rhs The expressions corresponding the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<Expression> rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output ); |
|
||||||
|
|
||||||
|
|
||||||
/** Sets up the output with the grids for the different output functions. \n
|
|
||||||
* \n |
|
||||||
* \param outputGrids_ The vector containing a grid for each output function. \n |
|
||||||
* \param _outputNames The names of the output functions. \n |
|
||||||
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n |
|
||||||
* \param _dims_output The dimensions of the output functions. \n |
|
||||||
* \param _outputDependencies A separate dependency matrix for each output. \n |
|
||||||
* \n |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_, |
|
||||||
const std::vector<std::string> _outputNames, |
|
||||||
const std::vector<std::string> _diffs_outputNames, |
|
||||||
const std::vector<uint> _dims_output, |
|
||||||
const std::vector<DMatrix> _outputDependencies ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes the matrix DD, which is used to extrapolate the variables of the IRK method to the next step.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue initializeDDMatrix( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes the matrix coeffs, containing coefficients of polynomials that are used to evaluate the
|
|
||||||
* continuous output (see evaluatePolynomial). |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue initializeCoefficients( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Recursive function that helps with the computation of the coefficients of polynomials that are used to evaluate the
|
|
||||||
* continuous output (see initializeCoefficients), by computing the correct combinations of elements of the vector |
|
||||||
* cc from the Butcher table. |
|
||||||
* |
|
||||||
* @param[in] cVec The vector with all the elements of the vector cc from the Butcher table, of which combinations |
|
||||||
* are computed in a recursive way. |
|
||||||
* @param[in] index An index of the vector cVec which denotes the relevant part for this invocation. |
|
||||||
* @param[in] numEls The number of elements in the combination. |
|
||||||
*
|
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
DVector computeCombinations( const DVector& cVec, uint index, uint numEls ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the coefficients of the polynomial, representing the continuous output of the integrator.
|
|
||||||
* |
|
||||||
* @param[in] time The point in the interval (0,1] for which the coefficients are returned. |
|
||||||
* |
|
||||||
* \return Coefficients of the polynomial, corresponding the given grid point |
|
||||||
*/ |
|
||||||
DVector evaluatePolynomial( double time ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the coefficients of the derived polynomial, representing the derivative of the continuous output with respect to time.
|
|
||||||
* |
|
||||||
* @param[in] time The point in the interval (0,1] for which the coefficients are returned. |
|
||||||
* |
|
||||||
* \return Coefficients of the polynomial, corresponding the given grid point |
|
||||||
*/ |
|
||||||
DVector evaluateDerivedPolynomial( double time ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the coefficients of the polynomial, representing the continuous output of the integrator.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] variable The variable containing the coefficients of the polynomial. |
|
||||||
* @param[in] grid The variable containing the grid point for the specific output. |
|
||||||
* @param[in] h The integration step size. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue evaluatePolynomial( ExportStatementBlock& block,
|
|
||||||
const ExportVariable& variable,
|
|
||||||
const ExportVariable& grid,
|
|
||||||
const std::string& h ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the coefficients of the derived polynomial, representing the derivative of the continuous output with respect to time.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] variable The variable containing the coefficients of the polynomial. |
|
||||||
* @param[in] grid The variable containing the grid point for the specific output. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue evaluateDerivedPolynomial( ExportStatementBlock& block, |
|
||||||
const ExportVariable& variable, |
|
||||||
const ExportVariable& grid ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the coefficients of the polynomial for the complete grid of the output, corresponding a certain index.
|
|
||||||
* |
|
||||||
* @param[in] index The index of the continuous output for which the coefficients are returned. |
|
||||||
* |
|
||||||
* \return Coefficients of the polynomial, corresponding the given continuous output |
|
||||||
*/ |
|
||||||
DMatrix evaluatePolynomial( uint index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the coefficients of the derived polynomial for the complete grid of the output, corresponding a certain index.
|
|
||||||
* |
|
||||||
* @param[in] index The index of the continuous output for which the coefficients are returned. |
|
||||||
* |
|
||||||
* \return Coefficients of the derived polynomial, corresponding the given continuous output |
|
||||||
*/ |
|
||||||
DMatrix evaluateDerivedPolynomial( uint index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Divide the total number of measurements over the different integration steps.
|
|
||||||
* |
|
||||||
* @param[in] index The index of the continuous output for which the division of measurements is returned. |
|
||||||
* |
|
||||||
* \return The division of measurements over the integration steps, corresponding the given continuous output. |
|
||||||
*/ |
|
||||||
DVector divideMeasurements( uint index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear input system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareInputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear output system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareOutputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Forms a constant linear system matrix for the collocation equations, given a constant jacobian and mass matrix.
|
|
||||||
* |
|
||||||
* @param[in] jacobian given constant Jacobian matrix |
|
||||||
* @param[in] mass given constant mass matrix |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual DMatrix formMatrix( const DMatrix& mass, const DMatrix& jacobian ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] A1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] B1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& Ah ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] A3 A constant matrix defining the equations of the linear output system. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportVariable& Ah, |
|
||||||
bool DERIVATIVES = false ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateStatesImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
const ExportIndex& stage, |
|
||||||
const ExportIndex& i, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue evaluateStatesOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportIndex& stage ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the right-hand side of the linear system at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateRhsImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportIndex& stage ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the matrix of the linear system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index1 The loop index of the outer loop. |
|
||||||
* @param[in] index2 The loop index of the inner loop. |
|
||||||
* @param[in] tmp_index A temporary index to be used. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] evaluateB True if the right-hand side of the linear system should also be evaluated, false otherwise. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateMatrix( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportVariable& _rk_A, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
bool evaluateB, |
|
||||||
bool DERIVATIVES ); |
|
||||||
|
|
||||||
|
|
||||||
/** Prepares the structures to evaluate the continuous output and exports the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue prepareOutputEvaluation( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the necessary code for the computation of the continuous output.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] tmp_meas The number of measurements in the current integration step (in case of an online grid). |
|
||||||
* @param[in] rk_tPrev The time point, defining the beginning of the current integration step (in case of an online grid). |
|
||||||
* @param[in] time_tmp A variable used for time transformations (in case of an online grid). |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue generateOutput( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index0, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& tmp_meas, |
|
||||||
const ExportVariable& time_tmp, |
|
||||||
const uint directions ); |
|
||||||
|
|
||||||
|
|
||||||
/** Copies all class members from given object.
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue copy( const ImplicitRungeKuttaExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the performed number of Newton iterations.
|
|
||||||
*
|
|
||||||
* \return The performed number of Newton iterations. |
|
||||||
*/ |
|
||||||
uint getNumIts() const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the performed number of Newton iterations for the initialization of the first step.
|
|
||||||
*
|
|
||||||
* \return The performed number of Newton iterations for the initialization of the first step. |
|
||||||
*/ |
|
||||||
uint getNumItsInit() const; |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
bool REUSE; /**< This boolean is true when the IFTR method is used instead of the IFT method. */ |
|
||||||
bool CONTINUOUS_OUTPUT; /**< This boolean is true when continuous output needs to be provided. */ |
|
||||||
|
|
||||||
uint numIts; /**< This is the performed number of Newton iterations. */ |
|
||||||
uint numItsInit; /**< This is the performed number of Newton iterations for the initialization of the first step. */ |
|
||||||
|
|
||||||
uint NDX2; |
|
||||||
uint NVARS2; |
|
||||||
|
|
||||||
uint NVARS3; |
|
||||||
|
|
||||||
ExportLinearSolver* solver; /**< This is the exported linear solver that is used by the implicit Runge-Kutta method. */ |
|
||||||
|
|
||||||
DMatrix DD; /**< This matrix is used for the initialization of the variables for the next integration step. */ |
|
||||||
DMatrix coeffs; /**< This matrix contains coefficients of polynomials that are used to evaluate the continuous output (see evaluatePolynomial). */ |
|
||||||
|
|
||||||
DVector numDX_output; |
|
||||||
DVector numXA_output; |
|
||||||
DVector numVARS_output; |
|
||||||
|
|
||||||
|
|
||||||
// DEFINITION OF THE EXPORTVARIABLES
|
|
||||||
ExportVariable rk_rhsOutputTemp; /**< Variable containing intermediate results of evaluations of the right-hand side expression of an output function. */ |
|
||||||
ExportVariable rk_diffsOutputTemp; /**< Variable containing intermediate results of evaluations of the derivatives of an output function. */ |
|
||||||
ExportVariable rk_outH; /**< Variable that is used for the evaluations of the continuous output. */ |
|
||||||
ExportVariable rk_out; /**< Variable that is used for the evaluations of the continuous output. */ |
|
||||||
ExportVariable polynEvalVar; /**< Local variable that is used for the evaluations of the continuous output. */ |
|
||||||
|
|
||||||
ExportVariable stepsH; /**< Variable defining the different integration step sizes in case of a non equidistant grid. */ |
|
||||||
|
|
||||||
std::vector<ExportVariable> gridVariables; /**< This vector contains an ExportVariable for the grid of each continuous output. */ |
|
||||||
std::vector<uint> totalMeas; /**< This vector contains the total number of measurements per output (per shooting or integration interval, depending on grid type). */ |
|
||||||
|
|
||||||
std::vector<ExportVariable> rk_outputs; /**< Variables containing the evaluations of the continuous output from the integrator. */ |
|
||||||
std::vector<ExportVariable> polynVariables; /**< Variables containing the coefficients for the polynomial. */ |
|
||||||
std::vector<ExportVariable> polynDerVariables; /**< Variables containing the coefficients for the derived polynomial. */ |
|
||||||
std::vector<ExportVariable> numMeasVariables; /**< Variables containing the number of measurements per integration interval. */ |
|
||||||
std::vector<ExportIndex> numMeas; /**< Indices containing the number of measurements that are already computed. */ |
|
||||||
|
|
||||||
ExportVariable rk_mat1; |
|
||||||
ExportVariable rk_dk1; |
|
||||||
|
|
||||||
ExportVariable rk_A; /**< Variable containing the matrix of the linear system. */ |
|
||||||
ExportVariable rk_b; /**< Variable containing the right-hand side of the linear system. */ |
|
||||||
ExportVariable rk_auxSolver; /**< Variable containing auxiliary values for the exported linear solver. */ |
|
||||||
ExportVariable rk_rhsTemp; /**< Variable containing intermediate results of evaluations of the right-hand side expression. */ |
|
||||||
|
|
||||||
ExportAcadoFunction lin_output; |
|
||||||
ExportVariable rk_mat3; |
|
||||||
ExportVariable rk_dk3; |
|
||||||
ExportVariable rk_diffsTemp3; |
|
||||||
|
|
||||||
ExportVariable rk_diffK; |
|
||||||
ExportVariable debug_mat; |
|
||||||
|
|
||||||
DMatrix eig; |
|
||||||
DMatrix simplified_transf1; |
|
||||||
DMatrix simplified_transf2; |
|
||||||
DMatrix simplified_transf1_T; |
|
||||||
DMatrix simplified_transf2_T; |
|
||||||
|
|
||||||
double tau; |
|
||||||
DVector low_tria; |
|
||||||
DMatrix single_transf1; |
|
||||||
DMatrix single_transf2; |
|
||||||
|
|
||||||
DMatrix single_transf1_T; |
|
||||||
DMatrix single_transf2_T; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_lifted_adjoint_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_lifted_symmetric_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_lifted_fob_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_lifted_forward_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_lifted_feedback_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_symmetric_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_forward_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/irk_export.ipp> |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_IRK_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,83 +0,0 @@ |
|||||||
/* |
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* \file include/acado/code_generation/integrators/irk_export.ipp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
// |
|
||||||
// Create the correct integrator |
|
||||||
// |
|
||||||
inline ImplicitRungeKuttaExport* createImplicitRungeKuttaExport( UserInteraction* _userInteraction, |
|
||||||
const std::string &_commonHeaderName ) |
|
||||||
{ |
|
||||||
int sensGen; |
|
||||||
_userInteraction->get( DYNAMIC_SENSITIVITY, sensGen ); |
|
||||||
int liftedGen; |
|
||||||
_userInteraction->get( IMPLICIT_INTEGRATOR_MODE, liftedGen ); |
|
||||||
|
|
||||||
if ( (ImplicitIntegratorMode)liftedGen == LIFTED && ((ExportSensitivityType)sensGen == FORWARD || (ExportSensitivityType)sensGen == INEXACT) ) { |
|
||||||
return new ForwardLiftedIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ImplicitIntegratorMode)liftedGen == LIFTED && (ExportSensitivityType)sensGen == BACKWARD ) { |
|
||||||
return new AdjointLiftedIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ImplicitIntegratorMode)liftedGen == LIFTED && (ExportSensitivityType)sensGen == SYMMETRIC ) { |
|
||||||
return new SymmetricLiftedIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ImplicitIntegratorMode)liftedGen == LIFTED && (ExportSensitivityType)sensGen == FORWARD_OVER_BACKWARD ) { |
|
||||||
return new ForwardBackwardLiftedIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ImplicitIntegratorMode)liftedGen == LIFTED_FEEDBACK && ((ExportSensitivityType)sensGen == FORWARD || (ExportSensitivityType)sensGen == INEXACT) ) { |
|
||||||
return new FeedbackLiftedIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ExportSensitivityType)sensGen == SYMMETRIC || (ExportSensitivityType)sensGen == FORWARD_OVER_BACKWARD ) { |
|
||||||
return new SymmetricIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if ( (ExportSensitivityType)sensGen == FORWARD ) { |
|
||||||
return new ForwardIRKExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else if( (ExportSensitivityType)sensGen == NO_SENSITIVITY ) { |
|
||||||
return new ImplicitRungeKuttaExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
else { |
|
||||||
ACADOERROR( RET_INVALID_OPTION ); |
|
||||||
return new ImplicitRungeKuttaExport(_userInteraction, _commonHeaderName); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
// end of file. |
|
@ -1,287 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_forward_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2013 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_IRK_FORWARD_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_IRK_FORWARD_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_export.hpp> |
|
||||||
#include <acado/code_generation/integrators/rk_sensitivities_export.hpp> |
|
||||||
#include <acado/code_generation/linear_solvers/linear_solver_generation.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored implicit Runge-Kutta integrator with forward sensitivity generation for fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ForwardIRKExport allows to export a tailored implicit Runge-Kutta integrator |
|
||||||
* with forward sensitivity generation for fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ForwardIRKExport : public ImplicitRungeKuttaExport, public RKSensitivitiesExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ForwardIRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardIRKExport( const ForwardIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ForwardIRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardIRKExport& operator=( const ForwardIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the index corresponding Compressed Row Storage (CRS) for the dependency matrix of a specific output function.
|
|
||||||
* |
|
||||||
* @param[in] output The number of the output function. |
|
||||||
* @param[in] row The number of the row, corresponding the element of interest. |
|
||||||
* @param[in] col The number of the column, corresponding the element of interest. |
|
||||||
* |
|
||||||
* \return The CRS index. |
|
||||||
*/ |
|
||||||
returnValue getCRSIndex( uint output, ExportIndex row, ExportIndex col ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear input system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareInputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear output system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareOutputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states, defined by the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportVariable& Bh, |
|
||||||
bool STATES ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& Bh, |
|
||||||
const ExportVariable& det, |
|
||||||
bool STATES, |
|
||||||
uint number ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states, defined by the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& index4, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& Bh, |
|
||||||
bool STATES, |
|
||||||
uint number ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the computation of the sensitivities for the continuous output.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] tmp_meas The number of measurements in the current integration step (in case of an online grid). |
|
||||||
* @param[in] rk_tPrev The time point, defining the beginning of the current integration step (in case of an online grid). |
|
||||||
* @param[in] time_tmp A variable used for time transformations (in case of an online grid). |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] base The number of states in stages with respect to which the sensitivities have already been computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue sensitivitiesOutputs( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index0, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportIndex& tmp_index3, |
|
||||||
const ExportVariable& tmp_meas, |
|
||||||
const ExportVariable& time_tmp, |
|
||||||
bool STATES, |
|
||||||
uint base ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the propagation of the sensitivities for the continuous output.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] tmp_meas The number of measurements in the current integration step (in case of an online grid). |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue propagateOutputs( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index, |
|
||||||
const ExportIndex& index0, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportIndex& tmp_index3, |
|
||||||
const ExportIndex& tmp_index4, |
|
||||||
const ExportVariable& tmp_meas ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_IRK_FORWARD_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,184 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_lifted_adjoint_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2015 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_LIFTED_IRK_ADJOINT_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_LIFTED_IRK_ADJOINT_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_lifted_forward_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored lifted implicit Runge-Kutta integrator with adjoint sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class AdjointLiftedIRKExport allows to export a tailored lifted implicit Runge-Kutta integrator |
|
||||||
* with adjoint sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class AdjointLiftedIRKExport : public ForwardLiftedIRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
AdjointLiftedIRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
AdjointLiftedIRKExport( const AdjointLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~AdjointLiftedIRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
AdjointLiftedIRKExport& operator=( const AdjointLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
Expression returnLowerTriangular( const Expression& expr ); |
|
||||||
|
|
||||||
|
|
||||||
virtual returnValue evaluateRhsSensitivities( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2 ); |
|
||||||
|
|
||||||
|
|
||||||
virtual returnValue updateImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
ExportAcadoFunction diffs_sweep; /**< Module to export the evaluation of a forward sweep of the derivatives of the ordinary differential equations. */ |
|
||||||
|
|
||||||
ExportVariable rk_diffsTemp2_full; |
|
||||||
|
|
||||||
ExportVariable rk_S_traj; /**< Variable containing the forward trajectory of the first order sensitivities. */ |
|
||||||
// ExportVariable rk_A_traj; /**< Variable containing the factorized matrix of the linear system over the forward trajectory. */
|
|
||||||
// ExportVariable rk_aux_traj; /**< Variable containing the factorized matrix of the linear system over the forward trajectory. */
|
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_LIFTED_IRK_ADJOINT_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,229 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_lifted_feedback_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2016 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_LIFTED_IRK_FEEDBACK_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_LIFTED_IRK_FEEDBACK_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_forward_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored lifted implicit Runge-Kutta integrator with forward sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class FeedbackLiftedIRKExport allows to export a tailored lifted implicit Runge-Kutta integrator |
|
||||||
* with forward sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class FeedbackLiftedIRKExport : public ForwardIRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
FeedbackLiftedIRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
FeedbackLiftedIRKExport( const FeedbackLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~FeedbackLiftedIRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
FeedbackLiftedIRKExport& operator=( const FeedbackLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** .
|
|
||||||
* |
|
||||||
* @param[in] . |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setNonlinearFeedback( const DMatrix& C, const Expression& feedb ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear input system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue setInputSystem( ); |
|
||||||
returnValue prepareInputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] A1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] B1 A constant matrix defining the equations of the linear input system. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue solveInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportVariable& Ah ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at all stages.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportVariable rk_seed; /**< Variable containing the forward seed. */ |
|
||||||
ExportVariable rk_stageValues; /**< Variable containing the evaluated stage values. */ |
|
||||||
|
|
||||||
ExportVariable rk_Xprev; /**< Variable containing the full previous state trajectory. */ |
|
||||||
ExportVariable rk_Uprev; /**< Variable containing the previous control trajectory. */ |
|
||||||
|
|
||||||
ExportVariable rk_delta; /**< Variable containing the update on the optimization variables. */ |
|
||||||
|
|
||||||
ExportVariable rk_xxx_lin; |
|
||||||
ExportVariable rk_Khat_traj; |
|
||||||
ExportVariable rk_Xhat_traj; |
|
||||||
|
|
||||||
// Static feedback function:
|
|
||||||
ExportAcadoFunction feedb; |
|
||||||
DMatrix C11; |
|
||||||
uint NF; |
|
||||||
|
|
||||||
DMatrix mat1, sensMat; |
|
||||||
|
|
||||||
ExportVariable rk_kTemp; |
|
||||||
ExportVariable rk_dk1_tmp; |
|
||||||
ExportVariable rk_dk2_tmp; |
|
||||||
|
|
||||||
ExportAcadoFunction sens_input; |
|
||||||
ExportAcadoFunction sens_fdb; |
|
||||||
ExportVariable rk_sensF; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_LIFTED_IRK_FEEDBACK_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,240 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_lifted_fob_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2015 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_LIFTED_IRK_FORWARD_BACKWARD_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_LIFTED_IRK_FORWARD_BACKWARD_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_lifted_forward_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored lifted implicit Runge-Kutta integrator with forward-over-adjoint second order sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ForwardBackwardLiftedIRKExport allows to export a tailored lifted implicit Runge-Kutta integrator |
|
||||||
* with forward-over-adjoint second order sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ForwardBackwardLiftedIRKExport : public ForwardLiftedIRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ForwardBackwardLiftedIRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardBackwardLiftedIRKExport( const ForwardBackwardLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ForwardBackwardLiftedIRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardBackwardLiftedIRKExport& operator=( const ForwardBackwardLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at all stages.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
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 updateImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
Expression returnLowerTriangular( const Expression& expr ); |
|
||||||
|
|
||||||
|
|
||||||
returnValue updateHessianTerm( ExportStatementBlock* block, const ExportIndex& index1, const ExportIndex& index2 ); |
|
||||||
|
|
||||||
|
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateRhsInexactSensitivities( 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& Ah ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
ExportAcadoFunction diffs_sweep; /**< Module to export the evaluation of a forward sweep of the derivatives of the ordinary differential equations. */ |
|
||||||
ExportAcadoFunction adjoint_sweep; /**< Module to export the evaluation of a forward sweep of the derivatives of the ordinary differential equations. */ |
|
||||||
|
|
||||||
ExportVariable rk_b_trans; |
|
||||||
|
|
||||||
ExportVariable rk_adj_diffs_tmp; |
|
||||||
|
|
||||||
ExportVariable rk_Khat_traj; |
|
||||||
ExportVariable rk_Xhat_traj; |
|
||||||
|
|
||||||
ExportVariable rk_xxx_traj; /**< Variable containing the forward trajectory of the state values. */ |
|
||||||
ExportVariable rk_adj_traj; /**< Variable containing the adjoint trajectory of the lambda_hat values. */ |
|
||||||
ExportVariable rk_S_traj; /**< Variable containing the forward trajectory of the first order sensitivities. */ |
|
||||||
ExportVariable rk_A_traj; /**< Variable containing the factorized matrix of the linear system over the forward trajectory. */ |
|
||||||
|
|
||||||
ExportVariable rk_hess_tmp1; |
|
||||||
ExportVariable rk_hess_tmp2; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_LIFTED_IRK_FORWARD_BACKWARD_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
@ -1,426 +0,0 @@ |
|||||||
/*
|
|
||||||
* This file is part of ACADO Toolkit. |
|
||||||
* |
|
||||||
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. |
|
||||||
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, |
|
||||||
* Milan Vukov, Rien Quirynen, KU Leuven. |
|
||||||
* Developed within the Optimization in Engineering Center (OPTEC) |
|
||||||
* under supervision of Moritz Diehl. All rights reserved. |
|
||||||
* |
|
||||||
* ACADO Toolkit is free software; you can redistribute it and/or |
|
||||||
* modify it under the terms of the GNU Lesser General Public |
|
||||||
* License as published by the Free Software Foundation; either |
|
||||||
* version 3 of the License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* ACADO Toolkit is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
* Lesser General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU Lesser General Public |
|
||||||
* License along with ACADO Toolkit; if not, write to the Free Software |
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
* |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file include/acado/code_generation/integrators/irk_lifted_forward_export.hpp |
|
||||||
* \author Rien Quirynen |
|
||||||
* \date 2014 |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACADO_TOOLKIT_LIFTED_IRK_FORWARD_EXPORT_HPP |
|
||||||
#define ACADO_TOOLKIT_LIFTED_IRK_FORWARD_EXPORT_HPP |
|
||||||
|
|
||||||
#include <acado/code_generation/integrators/irk_forward_export.hpp> |
|
||||||
|
|
||||||
|
|
||||||
BEGIN_NAMESPACE_ACADO |
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allows to export a tailored lifted implicit Runge-Kutta integrator with forward sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \ingroup NumericalAlgorithms |
|
||||||
* |
|
||||||
* The class ForwardLiftedIRKExport allows to export a tailored lifted implicit Runge-Kutta integrator |
|
||||||
* with forward sensitivity generation for extra fast model predictive control. |
|
||||||
* |
|
||||||
* \author Rien Quirynen |
|
||||||
*/ |
|
||||||
class ForwardLiftedIRKExport : public ForwardIRKExport |
|
||||||
{ |
|
||||||
//
|
|
||||||
// PUBLIC MEMBER FUNCTIONS:
|
|
||||||
//
|
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
/** Default constructor.
|
|
||||||
* |
|
||||||
* @param[in] _userInteraction Pointer to corresponding user interface. |
|
||||||
* @param[in] _commonHeaderName Name of common header file to be included. |
|
||||||
*/ |
|
||||||
ForwardLiftedIRKExport( UserInteraction* _userInteraction = 0, |
|
||||||
const std::string& _commonHeaderName = "" |
|
||||||
); |
|
||||||
|
|
||||||
/** Copy constructor (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardLiftedIRKExport( const ForwardLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
/** Destructor.
|
|
||||||
*/ |
|
||||||
virtual ~ForwardLiftedIRKExport( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator (deep copy).
|
|
||||||
* |
|
||||||
* @param[in] arg Right-hand side object. |
|
||||||
*/ |
|
||||||
ForwardLiftedIRKExport& operator=( const ForwardLiftedIRKExport& arg |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
/** Initializes export of a tailored integrator.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setup( ); |
|
||||||
|
|
||||||
|
|
||||||
/** Assigns Differential Equation to be used by the integrator.
|
|
||||||
* |
|
||||||
* @param[in] rhs Right-hand side expression. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue setDifferentialEquation( const Expression& rhs ); |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, |
|
||||||
ExportStruct dataStruct = ACADO_ANY |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
||||||
* |
|
||||||
* @param[in] declarations List of declarations. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations |
|
||||||
) const; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Exports source code of the auto-generated integrator into the given directory.
|
|
||||||
* |
|
||||||
* @param[in] code Code block containing the auto-generated integrator. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue getCode( ExportStatementBlock& code |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear input system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareInputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Precompute as much as possible for the linear output system and export the resulting definitions.
|
|
||||||
* |
|
||||||
* @param[in] code The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue prepareOutputSystem( ExportStatementBlock& code ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to solve the system of collocation equations for the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the inexact matrix for the linear system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index1 The loop index of the outer loop. |
|
||||||
* @param[in] index2 The loop index of the inner loop. |
|
||||||
* @param[in] tmp_index A temporary index to be used. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] evaluateB True if the right-hand side of the linear system should also be evaluated, false otherwise. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateInexactMatrix( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportVariable& _rk_A, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
bool evaluateB, |
|
||||||
bool DERIVATIVES ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states, defined by the linear input system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesInputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportVariable& Bh, |
|
||||||
bool STATES ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] det The variable that holds the determinant of the matrix in the linear system. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateRhsInexactSensitivities( 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& Ah ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at all stages.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the states at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The matrix A of the IRK method, multiplied by the step size h. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateStatesImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& C, |
|
||||||
const ExportIndex& stage, |
|
||||||
const ExportIndex& i, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the evaluation of the right-hand side of the linear system at a specific stage.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] index The loop index, defining the stage. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue evaluateRhsImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& k_index, |
|
||||||
const ExportIndex& stage ); |
|
||||||
|
|
||||||
|
|
||||||
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 ); |
|
||||||
|
|
||||||
|
|
||||||
virtual returnValue evaluateRhsSensitivities( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2 ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to update the sensitivities of the states defined by the nonlinear, fully implicit system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue updateImplicitSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the code needed to compute the sensitivities of the states, defined by the linear output system.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] Ah The variable containing the internal coefficients of the RK method, multiplied with the step size. |
|
||||||
* @param[in] Bh The variable containing the weights of the RK method, multiplied with the step size. |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] number This number defines the stage of the state with respect to which the sensitivities are computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue sensitivitiesOutputSystem( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& index4, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportVariable& Ah, |
|
||||||
const ExportVariable& Bh, |
|
||||||
bool STATES, |
|
||||||
uint number ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the computation of the sensitivities for the continuous output.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] tmp_meas The number of measurements in the current integration step (in case of an online grid). |
|
||||||
* @param[in] rk_tPrev The time point, defining the beginning of the current integration step (in case of an online grid). |
|
||||||
* @param[in] time_tmp A variable used for time transformations (in case of an online grid). |
|
||||||
* @param[in] STATES True if the sensitivities with respect to a state are needed, false otherwise. |
|
||||||
* @param[in] base The number of states in stages with respect to which the sensitivities have already been computed. |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
returnValue sensitivitiesOutputs( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index0, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportIndex& tmp_index3, |
|
||||||
const ExportVariable& tmp_meas, |
|
||||||
const ExportVariable& time_tmp, |
|
||||||
bool STATES, |
|
||||||
uint base ); |
|
||||||
|
|
||||||
|
|
||||||
/** Exports the propagation of the sensitivities for the continuous output.
|
|
||||||
* |
|
||||||
* @param[in] block The block to which the code will be exported. |
|
||||||
* @param[in] tmp_meas The number of measurements in the current integration step (in case of an online grid). |
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
virtual returnValue propagateOutputs( ExportStatementBlock* block, |
|
||||||
const ExportIndex& index, |
|
||||||
const ExportIndex& index0, |
|
||||||
const ExportIndex& index1, |
|
||||||
const ExportIndex& index2, |
|
||||||
const ExportIndex& index3, |
|
||||||
const ExportIndex& tmp_index1, |
|
||||||
const ExportIndex& tmp_index2, |
|
||||||
const ExportIndex& tmp_index3, |
|
||||||
const ExportIndex& tmp_index4, |
|
||||||
const ExportVariable& tmp_meas ); |
|
||||||
|
|
||||||
|
|
||||||
/** Returns the largest global export variable.
|
|
||||||
* |
|
||||||
* \return SUCCESSFUL_RETURN |
|
||||||
*/ |
|
||||||
ExportVariable getAuxVariable() const; |
|
||||||
|
|
||||||
|
|
||||||
protected: |
|
||||||
|
|
||||||
ExportAcadoFunction forward_sweep; /**< Module to export the evaluation of a forward sweep of the derivatives of the ordinary differential equations. */ |
|
||||||
ExportAcadoFunction adjoint_sweep; /**< Module to export the evaluation of an adjoint sweep of the derivatives of the ordinary differential equations. */ |
|
||||||
ExportVariable rk_b_trans; |
|
||||||
ExportVariable rk_adj_traj; /**< Variable containing the adjoint trajectory of the lambda_hat values. */ |
|
||||||
ExportVariable rk_adj_diffs_tmp; |
|
||||||
ExportVariable rk_seed2; |
|
||||||
ExportVariable rk_xxx_traj; /**< Variable containing the forward trajectory of the state values. */ |
|
||||||
|
|
||||||
ExportVariable rk_diffSweep; |
|
||||||
ExportVariable rk_I; |
|
||||||
|
|
||||||
ExportVariable rk_seed; /**< Variable containing the forward seed. */ |
|
||||||
ExportVariable rk_stageValues; /**< Variable containing the evaluated stage values. */ |
|
||||||
|
|
||||||
ExportVariable rk_Xprev; /**< Variable containing the full previous state trajectory. */ |
|
||||||
ExportVariable rk_Uprev; /**< Variable containing the previous control trajectory. */ |
|
||||||
|
|
||||||
ExportVariable rk_delta; /**< Variable containing the update on the optimization variables. */ |
|
||||||
|
|
||||||
ExportVariable rk_xxx_lin; |
|
||||||
ExportVariable rk_Khat_traj; |
|
||||||
ExportVariable rk_Xhat_traj; |
|
||||||
|
|
||||||
ExportVariable rk_diffK_local; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
CLOSE_NAMESPACE_ACADO |
|
||||||
|
|
||||||
|
|
||||||
#endif // ACADO_TOOLKIT_LIFTED_IRK_FORWARD_EXPORT_HPP
|
|
||||||
|
|
||||||
// end of file.
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue