40 const std::string& _commonHeaderName
46 LOG(
LVL_DEBUG ) <<
"Solver: setup initialization... " << endl;
54 <<
"ret = (int)initializeQpDunes();\n" 55 <<
"if ((return_t)ret != QPDUNES_OK) return ret;\n";
59 cleanupQpDunes.
setName(
"cleanupQpDunes" );
63 LOG(
LVL_DEBUG ) <<
"Solver: setup setupVariables... " << endl;
67 LOG(
LVL_DEBUG ) <<
"Solver: setup setupSimulation... " << endl;
71 LOG(
LVL_DEBUG ) <<
"Solver: setup setupObjectiveEvaluation... " << endl;
75 LOG(
LVL_DEBUG ) <<
"Solver: setup setupConstraintsEvaluation... " << endl;
79 LOG(
LVL_DEBUG ) <<
"Solver: setup setupEvaluation... " << endl;
83 LOG(
LVL_DEBUG ) <<
"Solver: setup setupAuxiliaryFunctions... " << endl;
156 code.
addStatement(
"/******************************************************************************/\n" );
160 code.
addStatement(
"/******************************************************************************/\n" );
215 return (
N + 1) *
NX +
N *
NU;
226 "Mixed control-state terms in the objective function are not supported at the moment.");
276 unsigned indexX =
getNY();
423 for (
unsigned i = 0; i <
N; ++i)
435 for (
unsigned i = 0; i <
N; ++i)
509 int hardcodeConstraintValues;
532 for (
unsigned i = 0; i <
N + 1; ++i)
536 lbXValues.
append( lbXInf );
538 lbXValues.
append( lbTmp );
542 ubXValues.
append( ubXInf );
544 ubXValues.
append( ubTmp );
558 for (
unsigned i = 0; i <
N; ++i)
562 lbUValues.
append( lbUInf );
564 lbUValues.
append( lbTmp );
568 ubUValues.
append( ubUInf );
570 ubUValues.
append( ubTmp );
580 if( hardcodeConstraintValues ==
YES ) {
592 for(
uint i = 0; i <
N; i++ ) {
593 for(
uint j = 0; j <
NX; j++ ) {
597 for(
uint j = 0; j <
NU; j++ ) {
602 for(
uint j = 0; j <
NX; j++ ) {
631 if( hardcodeConstraintValues ==
YES ) {
642 qpUb.
getCols(ind * (NX + NU), ind * (NX + NU) + NX) ==
646 qpUb.
getCols(ind * (NX + NU) + NX, (ind + 1) * (NX + NU)) ==
674 if( hardcodeConstraintValues ==
YES ) {
737 else if(hardcodeConstraintValues ==
YES)
741 unsigned dimConA = dimLbA * (NX +
NU);
744 for (
unsigned i = 0; i <
N; ++i)
747 for (
unsigned i = 0; i <
N; ++i)
753 dimConA += dim * (NX +
NU);
777 for (
unsigned i = 0; i <
N; ++i)
825 derOffset = derOffset + dimPacH *
NX;
845 for (
unsigned i = 0, intRowOffset = 0, dim = 0; i < N + 1; ++i)
851 string(
"Evaluating constraint on node: #" ) +
toString( i )
905 setStagePac.
setup(
"setStagePac", offsetPac, indPac, tPacA, tLbAValues, tUbAValues);
920 << (
qpLbA.
getRows(offsetPac, offsetPac + dimPacH) == tLbAValues -
pacEvH.
getRows(indPac * dimPacH, indPac * dimPacH + dimPacH))
921 << (
qpUbA.
getRows(offsetPac, offsetPac + dimPacH) == tUbAValues -
pacEvH.
getRows(indPac * dimPacH, indPac * dimPacH + dimPacH));
928 unsigned offsetEval = 0;
929 unsigned offsetPoc = 0;
930 for (
unsigned i = 0; i <
N; ++i)
951 << (tPocA.getSubMatrix(0, dim, 0, NX) ==
pocEvHx.
getSubMatrix(offsetPoc, offsetPoc + dim, 0, NX))
952 << (tPocA.getSubMatrix(0, dim, NX, NX + NU) ==
pocEvHu.
getSubMatrix(offsetPoc, offsetPoc + dim, 0, NU))
957 evUbAValues.
getRows(offsetEval, offsetEval + dim) -
pocEvH.
getRows(offsetPoc, offsetPoc + dim));
969 << (
qpA.
getRows(offsetEval * (NX + NU), offsetEval * (NX + NU) + dim * NX) ==
974 evUbAValues.
getRows(offsetEval, offsetEval + dim) -
pocEvH.
getRows(offsetPoc, offsetPoc + dim));
985 x0.
setDoc( (std::string)
"Current state feedback vector." );
1009 retSim.
setDoc(
"Status of the integration module. =0: OK, otherwise the error code.");
1025 returnValueFeedbackPhase.
setDoc(
"Status code of the FORCES QP solver." );
1027 feedback.
doc(
"Feedback/estimation step of the RTI scheme." );
1037 int sensitivityProp;
1046 for (
unsigned i = 0; i <
N; ++i)
1076 acc.
setup(
"accumulate", stageOut, index);
1081 for (
unsigned i = 0; i <
N; ++i)
1092 int hessianApproximation;
1105 ss <<
"qpDUNES_shiftLambda( &qpData );" << endl
1106 <<
"qpDUNES_shiftIntervals( &qpData );" << endl;
1119 getKKT.
doc(
"Get the KKT tolerance of the current iterate." );
1120 kkt.
setDoc(
"KKT tolerance." );
1153 "KKT Tolerance with affine stage constraints is under development");
1159 for (
unsigned el = 0; el < NX +
NU; ++el)
1171 <<
qpLb.
get(0, index * (NX +
NU) + index2) <<
" * " <<
qpMu.
get(index * 2 * (NX +
NU) + 2 * index2 + 0, 0) <<
");\n";
1173 <<
qpUb.
get(0, index * (NX +
NU) + index2) <<
" * " <<
qpMu.
get(index * 2 * (NX +
NU) + 2 * index2 + 1, 0) <<
");\n";
1177 for (
unsigned el = 0; el <
NX; ++el)
1180 <<
qpLb.
get(0, N * (NX +
NU) + el) <<
" * " <<
qpMu.
get(N * 2 * (NX +
NU) + 2 * el + 0, 0) <<
");\n";
1182 <<
qpUb.
get(0, N * (NX +
NU) + el) <<
" * " <<
qpMu.
get(N * 2 * (NX +
NU) + 2 * el + 1, 0) <<
");\n";
1196 int maxNumQPiterations;
1200 if ( maxNumQPiterations <= 0 )
#define LOG(level)
Just define a handy macro for getting the logger.
Lowest level, the debug level.
virtual returnValue setupEvaluation()
virtual returnValue getCode(ExportStatementBlock &code)
ExportVariable conValueOut
ExportVariable getRow(const ExportIndex &idx) const
ExportFunction evaluateObjective
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
ExportFunction shiftStates
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
ExportFunction & setName(const std::string &_name)
ExportVariable getTranspose() const
bool initialStateFixed() const
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())
bool isGiven(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportFunction setObjQ1Q2
Allows to pass back messages to the calling function.
ExportVariable conValueIn
DVector getUpperBounds(uint pointIdx) const
std::vector< DVector > pocLbStack
returnValue addComment(const std::string &_comment)
ExportVariable objEvFxEnd
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
std::vector< unsigned > qpConDim
ExportFunction shiftQpData
const DMatrix & getGivenMatrix() const
Allows to export code of a for-loop.
string toString(T const &value)
virtual returnValue setupVariables()
ExportFunction preparation
virtual returnValue setupMultiplicationRoutines()
#define CLOSE_NAMESPACE_ACADO
ExportVariable getSubMatrix(const ExportIndex &rowIdx1, const ExportIndex &rowIdx2, const ExportIndex &colIdx1, const ExportIndex &colIdx2) const
virtual returnValue setupConstraintsEvaluation(void)
Defines a scalar-valued index variable to be used for exporting code.
Base class for export of NLP/OCP solvers.
ExportAcadoFunction evaluateStageCost
ExportFunction setStagePac
Defines a matrix-valued variable that can be passed as argument to exported functions.
ExportAcadoFunction evaluateTerminalCost
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)
Interface generator for the qpDUNES QP solver.
virtual returnValue setDoc(const std::string &_doc)
std::shared_ptr< ExportQpDunesInterface > qpInterface
virtual returnValue setupInitialization()
std::string commonHeaderName
ExportFunction modelSimulation
virtual ExportFunction & doc(const std::string &_doc)
virtual bool isDefined() const
ExportVariable getCols(const ExportIndex &idx1, const ExportIndex &idx2) const
ExportFunction getObjective
virtual returnValue setupObjectiveEvaluation(void)
ExportFunction evaluateConstraints
ExportVariable makeRowVector() const
ExportVariable objValueIn
ExportFunction initializeNodes
double levenbergMarquardt
const std::string get(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportFunction setObjR1R2
virtual returnValue setupSimulation(void)
std::vector< std::shared_ptr< ExportAcadoFunction > > evaluatePointConstraints
Encapsulates all user interaction for setting options, logging data and plotting results.
Allows to export code of an arbitrary function.
virtual uint getDim() const
ExportFunction shiftControls
returnValue addStatement(const ExportStatement &_statement)
virtual bool isGiven() const
std::string getFullName() const
returnValue addLinebreak(uint num=1)
ExportAcadoFunction evaluatePathConstraints
GenericVector & append(const GenericVector &_arg)
#define ACADOWARNINGTEXT(retval, text)
ExportFunction & setReturnValue(const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
virtual ExportFunction & acquire(ExportIndex &obj)
ExportFunction & addVariable(const ExportVariable &_var)
ExportGaussNewtonQpDunes(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
void setAll(const T &_value)
ExportVariable objSEndTerm
std::string getName() const
ExportVariable getRows(const ExportIndex &idx1, const ExportIndex &idx2) const
returnValue addDeclaration(const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
returnValue setupAuxiliaryFunctions()
virtual ExportFunction & release(const ExportIndex &obj)
unsigned getNumComplexConstraints(void)
virtual returnValue setupQPInterface()
DVector getLowerBounds(uint pointIdx) const
unsigned getNumQPvars() const
#define BEGIN_NAMESPACE_ACADO
virtual returnValue setup()
ExportFunction setObjQN1QN2
returnValue addFunction(const ExportFunction &_function)
std::vector< DVector > pocUbStack
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
Allows to export code for a block of statements.
ExportFunction initialize
ExportArgument getAddress(const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const
ExportVariable objValueOut
ExportVariable getCol(const ExportIndex &idx) const
ExportFunction & addIndex(const ExportIndex &_index)
ExportFunction regularizeHessian
#define ACADOERROR(retval)
Defines a matrix-valued variable to be used for exporting code.
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)
ExportVariable makeColVector() const