Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00032 #include <acado/code_generation/export_qpdunes_interface.hpp>
00033 #include <acado/code_generation/templates/templates.hpp>
00034
00035 using namespace std;
00036
00037 BEGIN_NAMESPACE_ACADO
00038
00039 ExportQpDunesInterface::ExportQpDunesInterface( const std::string& _fileName,
00040 const std::string& _commonHeaderName,
00041 const std::string& _realString,
00042 const std::string& _intString,
00043 int _precision,
00044 const std::string& _commentString
00045 ) : ExportTemplatedFile(QPDUNES_TEMPLATE, _fileName, _commonHeaderName, _realString, _intString, _precision, _commentString)
00046 {}
00047
00048 returnValue ExportQpDunesInterface::configure( const unsigned _maxIter,
00049 const unsigned _printLevel,
00050 const std::string& _HH,
00051 const std::string& _g,
00052 const std::string& _gN,
00053 const std::string& _CC,
00054 const std::string& _c,
00055 const std::string& _DD,
00056 const std::string& _lb0,
00057 const std::string& _ub0,
00058 const std::string& _lb,
00059 const std::string& _ub,
00060 const std::string& _lbA,
00061 const std::string& _ubA,
00062 const std::string& _primal,
00063 const std::string& _lambda,
00064 const std::string& _mu,
00065 const std::vector< unsigned >& conDim,
00066 const std::string& _initialStateFixed,
00067 const std::string& _diagH,
00068 const std::string& _diagHN
00069 )
00070 {
00071 stringstream ss;
00072
00073
00074
00075 ss << _maxIter;
00076 dictionary[ "@MAX_ITER@" ] = ss.str();
00077
00078 ss.str( string() );
00079 ss << _printLevel;
00080 dictionary[ "@PRINT_LEVEL@" ] = ss.str();
00081
00082 dictionary[ "@QP_H@" ] = _HH;
00083 dictionary[ "@QP_G@" ] = _g;
00084 dictionary[ "@QP_G_N@" ] = _gN;
00085 dictionary[ "@QP_C@" ] = _CC;
00086 dictionary[ "@QP_c@" ] = _c;
00087
00088 dictionary[ "@QP_LB@" ] = _lb;
00089 dictionary[ "@QP_UB@" ] = _ub;
00090
00091 dictionary[ "@QP_LB_0@" ] = _lb0;
00092 dictionary[ "@QP_UB_0@" ] = _ub0;
00093
00094 if (conDim.size() > 0)
00095 {
00096 dictionary[ "@QP_D@" ] = _DD;
00097 dictionary[ "@QP_LBA@" ] = _lbA;
00098 dictionary[ "@QP_UBA@" ] = _ubA;
00099
00100 ss.str( string() );
00101 ss << "const unsigned int nD[ACADO_N + 1] = {";
00102 for (unsigned i = 0; i < conDim.size(); ++i)
00103 {
00104 ss << conDim[ i ];
00105 if (i < conDim.size() - 1)
00106 ss << ", ";
00107 }
00108 ss << "};";
00109 dictionary[ "@QP_ND_ARRAY@" ] = ss.str();
00110 }
00111 else
00112 {
00113 dictionary[ "@QP_D@" ] = dictionary[ "@QP_LBA@" ] = dictionary[ "@QP_UBA@" ] = "0";
00114 dictionary[ "@QP_ND_ARRAY@" ] = "unsigned int nD[ACADO_N + 1]; for (kk = 0; kk < ACADO_N + 1; nD[ kk++ ] = 0);";
00115 }
00116
00117 dictionary[ "@QP_PRIMAL@" ] = _primal;
00118 dictionary[ "@QP_LAMBDA@" ] = _lambda;
00119 dictionary[ "@QP_MU@" ] = _mu;
00120
00121 dictionary[ "@INITIAL_STATE_FIXED@" ] = _initialStateFixed;
00122
00123 dictionary[ "@DIAG_H@" ] = _diagH;
00124 dictionary[ "@DIAG_HN@" ] = _diagHN;
00125
00126
00127 fillTemplate();
00128
00129 return SUCCESSFUL_RETURN;
00130 }
00131
00132 CLOSE_NAMESPACE_ACADO