wip
This commit is contained in:
543
third_party/acados/include/qpOASES_e/Bounds.h
vendored
Normal file
543
third_party/acados/include/qpOASES_e/Bounds.h
vendored
Normal file
@@ -0,0 +1,543 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Bounds.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the Bounds class designed to manage working sets of
|
||||
* bounds within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_BOUNDS_H
|
||||
#define QPOASES_BOUNDS_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Indexlist.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Manages working sets of bounds (= box constraints).
|
||||
*
|
||||
* This class manages working sets of bounds (= box constraints)
|
||||
* by storing index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Indexlist *freee; /**< Index list of free variables. */
|
||||
Indexlist *fixed; /**< Index list of fixed variables. */
|
||||
|
||||
Indexlist *shiftedFreee; /**< Memory for shifting free variables. */
|
||||
Indexlist *shiftedFixed; /**< Memory for shifting fixed variables. */
|
||||
|
||||
Indexlist *rotatedFreee; /**< Memory for rotating free variables. */
|
||||
Indexlist *rotatedFixed; /**< Memory for rotating fixed variables. */
|
||||
|
||||
SubjectToType *type; /**< Type of bounds. */
|
||||
SubjectToStatus *status; /**< Status of bounds. */
|
||||
|
||||
SubjectToType *typeTmp; /**< Temp memory for type of bounds. */
|
||||
SubjectToStatus *statusTmp; /**< Temp memory for status of bounds. */
|
||||
|
||||
BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */
|
||||
BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */
|
||||
|
||||
int n; /**< Total number of bounds. */
|
||||
} Bounds;
|
||||
|
||||
int Bounds_calculateMemorySize( int n);
|
||||
|
||||
char *Bounds_assignMemory(int n, Bounds **mem, void *raw_memory);
|
||||
|
||||
Bounds *Bounds_createMemory( int n );
|
||||
|
||||
/** Constructor which takes the number of bounds. */
|
||||
void BoundsCON( Bounds* _THIS,
|
||||
int _n /**< Number of bounds. */
|
||||
);
|
||||
|
||||
/** Copies all members from given rhs object.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
void BoundsCPY( Bounds* FROM,
|
||||
Bounds* TO
|
||||
);
|
||||
|
||||
|
||||
/** Initialises object with given number of bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Bounds_init( Bounds* _THIS,
|
||||
int _n /**< Number of bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) bound to
|
||||
* given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Bounds_setupBound( Bounds* _THIS,
|
||||
int number, /**< Number of new bound. */
|
||||
SubjectToStatus _status /**< Status of new bound. */
|
||||
);
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set of free bounds; the order depends on the SujectToType
|
||||
* of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue Bounds_setupAllFree( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set of fixed bounds (on their lower bounds);
|
||||
* the order depends on the SujectToType of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue Bounds_setupAllLower( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set of fixed bounds (on their upper bounds);
|
||||
* the order depends on the SujectToType of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue Bounds_setupAllUpper( Bounds* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Moves index of a bound from index list of fixed to that of free bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue Bounds_moveFixedToFree( Bounds* _THIS,
|
||||
int number /**< Number of bound to be freed. */
|
||||
);
|
||||
|
||||
/** Moves index of a bound from index list of free to that of fixed bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue Bounds_moveFreeToFixed( Bounds* _THIS,
|
||||
int number, /**< Number of bound to be fixed. */
|
||||
SubjectToStatus _status /**< Status of bound to be fixed. */
|
||||
);
|
||||
|
||||
/** Flip fixed bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_BOUND_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue Bounds_flipFixed( Bounds* _THIS,
|
||||
int number
|
||||
);
|
||||
|
||||
/** Swaps the indices of two free bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED */
|
||||
returnValue Bounds_swapFree( Bounds* _THIS,
|
||||
int number1, /**< Number of first bound. */
|
||||
int number2 /**< Number of second bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of variables.
|
||||
* \return Number of variables. */
|
||||
static inline int Bounds_getNV( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns number of implicitly fixed variables.
|
||||
* \return Number of implicitly fixed variables. */
|
||||
static inline int Bounds_getNFV( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns number of bounded (but possibly free) variables.
|
||||
* \return Number of bounded (but possibly free) variables. */
|
||||
static inline int Bounds_getNBV( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns number of unbounded variables.
|
||||
* \return Number of unbounded variables. */
|
||||
static inline int Bounds_getNUV( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns number of free variables.
|
||||
* \return Number of free variables. */
|
||||
static inline int Bounds_getNFR( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns number of fixed variables.
|
||||
* \return Number of fixed variables. */
|
||||
static inline int Bounds_getNFX( Bounds* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Returns a pointer to free variables index list.
|
||||
* \return Pointer to free variables index list. */
|
||||
static inline Indexlist* Bounds_getFree( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns a pointer to fixed variables index list.
|
||||
* \return Pointer to fixed variables index list. */
|
||||
static inline Indexlist* Bounds_getFixed( Bounds* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of bounds with given SubjectTo type.
|
||||
* \return Number of bounds with given type. */
|
||||
static inline int Bounds_getNumberOfType( Bounds* _THIS,
|
||||
SubjectToType _type /**< Type of bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns type of bound.
|
||||
* \return Type of bound \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline SubjectToType Bounds_getType( Bounds* _THIS,
|
||||
int i /**< Number of bound. */
|
||||
);
|
||||
|
||||
/** Returns status of bound.
|
||||
* \return Status of bound \n
|
||||
ST_UNDEFINED */
|
||||
static inline SubjectToStatus Bounds_getStatus( Bounds* _THIS,
|
||||
int i /**< Number of bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets type of bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline returnValue Bounds_setType( Bounds* _THIS,
|
||||
int i, /**< Number of bound. */
|
||||
SubjectToType value /**< Type of bound. */
|
||||
);
|
||||
|
||||
/** Sets status of bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline returnValue Bounds_setStatus( Bounds* _THIS,
|
||||
int i, /**< Number of bound. */
|
||||
SubjectToStatus value /**< Status of bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets status of lower bounds. */
|
||||
static inline void Bounds_setNoLower( Bounds* _THIS,
|
||||
BooleanType _status /**< Status of lower bounds. */
|
||||
);
|
||||
|
||||
/** Sets status of upper bounds. */
|
||||
static inline void Bounds_setNoUpper( Bounds* _THIS,
|
||||
BooleanType _status /**< Status of upper bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns status of lower bounds.
|
||||
* \return BT_TRUE if there is no lower bound on any variable. */
|
||||
static inline BooleanType Bounds_hasNoLower( Bounds* _THIS
|
||||
);
|
||||
|
||||
/** Returns status of upper bounds.
|
||||
* \return BT_TRUE if there is no upper bound on any variable. */
|
||||
static inline BooleanType Bounds_hasNoUpper( Bounds* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Shifts forward type and status of all bounds by a given
|
||||
* offset. This offset has to lie within the range [0,n/2] and has to
|
||||
* be an integer divisor of the total number of bounds n.
|
||||
* Type and status of the first \<offset\> bounds is thrown away,
|
||||
* type and status of the last \<offset\> bounds is doubled,
|
||||
* e.g. for offset = 2: \n
|
||||
* shift( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b5,b6}
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS \n
|
||||
RET_SHIFTING_FAILED */
|
||||
returnValue Bounds_shift( Bounds* _THIS,
|
||||
int offset /**< Shift offset within the range [0,n/2] and integer divisor of n. */
|
||||
);
|
||||
|
||||
/** Rotates forward type and status of all bounds by a given
|
||||
* offset. This offset has to lie within the range [0,n].
|
||||
* Example for offset = 2: \n
|
||||
* rotate( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b1,b2}
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_ROTATING_FAILED */
|
||||
returnValue Bounds_rotate( Bounds* _THIS,
|
||||
int offset /**< Rotation offset within the range [0,n]. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints information on bounds object
|
||||
* (in particular, lists of free and fixed bounds.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue Bounds_print( Bounds* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set corresponding to the desired status;
|
||||
* the order depends on the SujectToType of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_BOUND_FAILED */
|
||||
returnValue Bounds_setupAll( Bounds* _THIS,
|
||||
SubjectToStatus _status /**< Desired initial status for all bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Adds the index of a new bound to index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_ADDINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Bounds_addIndex( Bounds* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list to which the new index shall be added. */
|
||||
int newnumber, /**< Number of new bound. */
|
||||
SubjectToStatus newstatus /**< Status of new bound. */
|
||||
);
|
||||
|
||||
/** Removes the index of a bound from index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_REMOVEINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Bounds_removeIndex( Bounds* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */
|
||||
int removenumber /**< Number of bound to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two constraints or bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Bounds_swapIndex( Bounds* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */
|
||||
int number1, /**< Number of first bound. */
|
||||
int number2 /**< Number of second bound. */
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N u m b e r O f T y p e
|
||||
*/
|
||||
static inline int Bounds_getNumberOfType( Bounds* _THIS, SubjectToType _type )
|
||||
{
|
||||
int i;
|
||||
int numberOfType = 0;
|
||||
|
||||
if ( _THIS->type != 0 )
|
||||
{
|
||||
for( i=0; i<_THIS->n; ++i )
|
||||
if ( _THIS->type[i] == _type )
|
||||
++numberOfType;
|
||||
}
|
||||
|
||||
return numberOfType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t T y p e
|
||||
*/
|
||||
static inline SubjectToType Bounds_getType( Bounds* _THIS, int i )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
return _THIS->type[i];
|
||||
|
||||
return ST_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
static inline SubjectToStatus Bounds_getStatus( Bounds* _THIS, int i )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
return _THIS->status[i];
|
||||
|
||||
return ST_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t T y p e
|
||||
*/
|
||||
static inline returnValue Bounds_setType( Bounds* _THIS, int i, SubjectToType value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
{
|
||||
_THIS->type[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t S t a t u s
|
||||
*/
|
||||
static inline returnValue Bounds_setStatus( Bounds* _THIS, int i, SubjectToStatus value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
{
|
||||
_THIS->status[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o L o w e r
|
||||
*/
|
||||
static inline void Bounds_setNoLower( Bounds* _THIS, BooleanType _status )
|
||||
{
|
||||
_THIS->noLower = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o U p p e r
|
||||
*/
|
||||
static inline void Bounds_setNoUpper( Bounds* _THIS, BooleanType _status )
|
||||
{
|
||||
_THIS->noUpper = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* h a s N o L o w e r
|
||||
*/
|
||||
static inline BooleanType Bounds_hasNoLower( Bounds* _THIS )
|
||||
{
|
||||
return _THIS->noLower;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* h a s N o U p p p e r
|
||||
*/
|
||||
static inline BooleanType Bounds_hasNoUpper( Bounds* _THIS )
|
||||
{
|
||||
return _THIS->noUpper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N V
|
||||
*/
|
||||
static inline int Bounds_getNV( Bounds* _THIS )
|
||||
{
|
||||
return _THIS->n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F V
|
||||
*/
|
||||
static inline int Bounds_getNFV( Bounds* _THIS )
|
||||
{
|
||||
return Bounds_getNumberOfType( _THIS,ST_EQUALITY );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N B V
|
||||
*/
|
||||
static inline int Bounds_getNBV( Bounds* _THIS )
|
||||
{
|
||||
return Bounds_getNumberOfType( _THIS,ST_BOUNDED );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U V
|
||||
*/
|
||||
static inline int Bounds_getNUV( Bounds* _THIS )
|
||||
{
|
||||
return Bounds_getNumberOfType( _THIS,ST_UNBOUNDED );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F R
|
||||
*/
|
||||
static inline int Bounds_getNFR( Bounds* _THIS )
|
||||
{
|
||||
return Indexlist_getLength( _THIS->freee );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N F X
|
||||
*/
|
||||
static inline int Bounds_getNFX( Bounds* _THIS )
|
||||
{
|
||||
return Indexlist_getLength( _THIS->fixed );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F r e e
|
||||
*/
|
||||
static inline Indexlist* Bounds_getFree( Bounds* _THIS )
|
||||
{
|
||||
return _THIS->freee;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t F i x e d
|
||||
*/
|
||||
static inline Indexlist* Bounds_getFixed( Bounds* _THIS )
|
||||
{
|
||||
return _THIS->fixed;
|
||||
}
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
#endif /* QPOASES_BOUNDS_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
134
third_party/acados/include/qpOASES_e/Constants.h
vendored
Normal file
134
third_party/acados/include/qpOASES_e/Constants.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Constants.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Definition of all global constants.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTANTS_H
|
||||
#define QPOASES_CONSTANTS_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Types.h>
|
||||
|
||||
#ifdef __CODE_GENERATION__
|
||||
|
||||
#define CONVERTTOSTRINGAUX(x) #x
|
||||
#define CONVERTTOSTRING(x) CONVERTTOSTRINGAUX(x)
|
||||
|
||||
#ifndef QPOASES_CUSTOM_INTERFACE
|
||||
#include "acado_qpoases3_interface.h"
|
||||
#else
|
||||
#include CONVERTTOSTRING(QPOASES_CUSTOM_INTERFACE)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#ifndef __EXTERNAL_DIMENSIONS__
|
||||
|
||||
/*#define QPOASES_NVMAX 50
|
||||
#define QPOASES_NCMAX 100*/
|
||||
#define QPOASES_NVMAX 287
|
||||
#define QPOASES_NCMAX 709
|
||||
|
||||
#endif /* __EXTERNAL_DIMENSIONS__ */
|
||||
|
||||
|
||||
/** Maximum number of variables within a QP formulation.
|
||||
* Note: this value has to be positive! */
|
||||
#define NVMAX QPOASES_NVMAX
|
||||
|
||||
/** Maximum number of constraints within a QP formulation.
|
||||
* Note: this value has to be positive! */
|
||||
#define NCMAX QPOASES_NCMAX
|
||||
|
||||
#if ( QPOASES_NVMAX > QPOASES_NCMAX )
|
||||
#define NVCMAX QPOASES_NVMAX
|
||||
#else
|
||||
#define NVCMAX QPOASES_NCMAX
|
||||
#endif
|
||||
|
||||
#if ( QPOASES_NVMAX > QPOASES_NCMAX )
|
||||
#define NVCMIN QPOASES_NCMAX
|
||||
#else
|
||||
#define NVCMIN QPOASES_NVMAX
|
||||
#endif
|
||||
|
||||
|
||||
/** Maximum number of QPs in a sequence solved by means of the OQP interface.
|
||||
* Note: this value has to be positive! */
|
||||
#define NQPMAX 1000
|
||||
|
||||
|
||||
/** Numerical value of machine precision (min eps, s.t. 1+eps > 1).
|
||||
* Note: this value has to be positive! */
|
||||
#ifndef __CODE_GENERATION__
|
||||
|
||||
#ifdef __USE_SINGLE_PRECISION__
|
||||
static const real_t QPOASES_EPS = 1.193e-07;
|
||||
#else
|
||||
static const real_t QPOASES_EPS = 2.221e-16;
|
||||
#endif /* __USE_SINGLE_PRECISION__ */
|
||||
|
||||
#endif /* __CODE_GENERATION__ */
|
||||
|
||||
|
||||
/** Numerical value of zero (for situations in which it would be
|
||||
* unreasonable to compare with 0.0).
|
||||
* Note: this value has to be positive! */
|
||||
static const real_t QPOASES_ZERO = 1.0e-25;
|
||||
|
||||
/** Numerical value of infinity (e.g. for non-existing bounds).
|
||||
* Note: this value has to be positive! */
|
||||
static const real_t QPOASES_INFTY = 1.0e20;
|
||||
|
||||
/** Tolerance to used for isEqual, isZero etc.
|
||||
* Note: this value has to be positive! */
|
||||
static const real_t QPOASES_TOL = 1.0e-25;
|
||||
|
||||
|
||||
/** Maximum number of characters within a string.
|
||||
* Note: this value should be at least 41! */
|
||||
#define QPOASES_MAX_STRING_LENGTH 160
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_CONSTANTS_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
62
third_party/acados/include/qpOASES_e/ConstraintProduct.h
vendored
Normal file
62
third_party/acados/include/qpOASES_e/ConstraintProduct.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/ConstraintProduct.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches (thanks to D. Kwame Minde Kufoalor)
|
||||
* \version 3.1embedded
|
||||
* \date 2009-2015
|
||||
*
|
||||
* Declaration of the ConstraintProduct interface which allows to specify a
|
||||
* user-defined function for evaluating the constraint product at the
|
||||
* current iterate to speed-up QP solution in case of a specially structured
|
||||
* constraint matrix.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTRAINT_PRODUCT_H
|
||||
#define QPOASES_CONSTRAINT_PRODUCT_H
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Interface for specifying user-defined evaluations of constraint products.
|
||||
*
|
||||
* An interface which allows to specify a user-defined function for evaluating the
|
||||
* constraint product at the current iterate to speed-up QP solution in case
|
||||
* of a specially structured constraint matrix.
|
||||
*
|
||||
* \author Hans Joachim Ferreau (thanks to Kwame Minde Kufoalor)
|
||||
* \version 3.1embedded
|
||||
* \date 2009-2015
|
||||
*/
|
||||
typedef int(*ConstraintProduct)( int, const real_t* const, real_t* const );
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
#endif /* QPOASES_CONSTRAINT_PRODUCT_H */
|
||||
535
third_party/acados/include/qpOASES_e/Constraints.h
vendored
Normal file
535
third_party/acados/include/qpOASES_e/Constraints.h
vendored
Normal file
@@ -0,0 +1,535 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Constraints.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the Constraints class designed to manage working sets of
|
||||
* constraints within a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_CONSTRAINTS_H
|
||||
#define QPOASES_CONSTRAINTS_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Indexlist.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Manages working sets of constraints.
|
||||
*
|
||||
* This class manages working sets of constraints by storing
|
||||
* index sets and other status information.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Indexlist *active; /**< Index list of active constraints. */
|
||||
Indexlist *inactive; /**< Index list of inactive constraints. */
|
||||
|
||||
Indexlist *shiftedActive; /**< Memory for shifting active constraints. */
|
||||
Indexlist *shiftedInactive; /**< Memory for shifting inactive constraints. */
|
||||
|
||||
Indexlist *rotatedActive; /**< Memory for rotating active constraints. */
|
||||
Indexlist *rotatedInactive; /**< Memory for rotating inactive constraints. */
|
||||
|
||||
SubjectToType *type; /**< Type of constraints. */
|
||||
SubjectToStatus *status; /**< Status of constraints. */
|
||||
|
||||
SubjectToType *typeTmp; /**< Temp memory for type of constraints. */
|
||||
SubjectToStatus *statusTmp; /**< Temp memory for status of constraints. */
|
||||
|
||||
BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */
|
||||
BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */
|
||||
|
||||
int n; /**< Total number of constraints. */
|
||||
} Constraints;
|
||||
|
||||
int Constraints_calculateMemorySize( int n);
|
||||
|
||||
char *Constraints_assignMemory(int n, Constraints **mem, void *raw_memory);
|
||||
|
||||
Constraints *Constraints_createMemory( int n );
|
||||
|
||||
/** Constructor which takes the number of constraints. */
|
||||
void ConstraintsCON( Constraints* _THIS,
|
||||
int _n /**< Number of constraints. */
|
||||
);
|
||||
|
||||
/** Copies all members from given rhs object.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
void ConstraintsCPY( Constraints* FROM,
|
||||
Constraints* TO
|
||||
);
|
||||
|
||||
|
||||
/** Initialises object with given number of constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Constraints_init( Constraints* _THIS,
|
||||
int _n /**< Number of constraints. */
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds number of a new (i.e. not yet in the list) constraint to
|
||||
* a given index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Constraints_setupConstraint( Constraints* _THIS,
|
||||
int number, /**< Number of new constraint. */
|
||||
SubjectToStatus _status /**< Status of new constraint. */
|
||||
);
|
||||
|
||||
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
|
||||
* to the index set of inactive constraints; the order depends on the SujectToType
|
||||
* of each index. Only disabled constraints are added to index set of disabled constraints!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_setupAllInactive( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
|
||||
* to the index set of active constraints (on their lower bounds); the order depends on the SujectToType
|
||||
* of each index. Only disabled constraints are added to index set of disabled constraints!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_setupAllLower( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
|
||||
* to the index set of active constraints (on their upper bounds); the order depends on the SujectToType
|
||||
* of each index. Only disabled constraints are added to index set of disabled constraints!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_setupAllUpper( Constraints* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Moves index of a constraint from index list of active to that of inactive constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_moveActiveToInactive( Constraints* _THIS,
|
||||
int number /**< Number of constraint to become inactive. */
|
||||
);
|
||||
|
||||
/** Moves index of a constraint from index list of inactive to that of active constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_moveInactiveToActive( Constraints* _THIS,
|
||||
int number, /**< Number of constraint to become active. */
|
||||
SubjectToStatus _status /**< Status of constraint to become active. */
|
||||
);
|
||||
|
||||
/** Flip fixed constraint.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_MOVING_CONSTRAINT_FAILED \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
returnValue Constraints_flipFixed( Constraints* _THIS,
|
||||
int number
|
||||
);
|
||||
|
||||
|
||||
/** Returns the number of constraints.
|
||||
* \return Number of constraints. */
|
||||
static inline int Constraints_getNC( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns the number of implicit equality constraints.
|
||||
* \return Number of implicit equality constraints. */
|
||||
static inline int Constraints_getNEC( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns the number of "real" inequality constraints.
|
||||
* \return Number of "real" inequality constraints. */
|
||||
static inline int Constraints_getNIC( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns the number of unbounded constraints (i.e. without any bounds).
|
||||
* \return Number of unbounded constraints (i.e. without any bounds). */
|
||||
static inline int Constraints_getNUC( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns the number of active constraints.
|
||||
* \return Number of active constraints. */
|
||||
static inline int Constraints_getNAC( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns the number of inactive constraints.
|
||||
* \return Number of inactive constraints. */
|
||||
static inline int Constraints_getNIAC( Constraints* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Returns a pointer to active constraints index list.
|
||||
* \return Pointer to active constraints index list. */
|
||||
static inline Indexlist* Constraints_getActive( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns a pointer to inactive constraints index list.
|
||||
* \return Pointer to inactive constraints index list. */
|
||||
static inline Indexlist* Constraints_getInactive( Constraints* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Returns number of constraints with given SubjectTo type.
|
||||
* \return Number of constraints with given type. */
|
||||
static inline int Constraints_getNumberOfType( Constraints* _THIS,
|
||||
SubjectToType _type /**< Type of constraints' bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns type of constraints' bound.
|
||||
* \return Type of constraints' bound \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline SubjectToType Constraints_getType( Constraints* _THIS,
|
||||
int i /**< Number of constraints' bound. */
|
||||
);
|
||||
|
||||
/** Returns status of constraints' bound.
|
||||
* \return Status of constraints' bound \n
|
||||
ST_UNDEFINED */
|
||||
static inline SubjectToStatus Constraints_getStatus( Constraints* _THIS,
|
||||
int i /**< Number of constraints' bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets type of constraints' bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline returnValue Constraints_setType( Constraints* _THIS,
|
||||
int i, /**< Number of constraints' bound. */
|
||||
SubjectToType value /**< Type of constraints' bound. */
|
||||
);
|
||||
|
||||
/** Sets status of constraints' bound.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS */
|
||||
static inline returnValue Constraints_setStatus( Constraints* _THIS,
|
||||
int i, /**< Number of constraints' bound. */
|
||||
SubjectToStatus value /**< Status of constraints' bound. */
|
||||
);
|
||||
|
||||
|
||||
/** Sets status of lower constraints' bounds. */
|
||||
static inline void Constraints_setNoLower( Constraints* _THIS,
|
||||
BooleanType _status /**< Status of lower constraints' bounds. */
|
||||
);
|
||||
|
||||
/** Sets status of upper constraints' bounds. */
|
||||
static inline void Constraints_setNoUpper( Constraints* _THIS,
|
||||
BooleanType _status /**< Status of upper constraints' bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns status of lower constraints' bounds.
|
||||
* \return BT_TRUE if there is no lower constraints' bound on any variable. */
|
||||
static inline BooleanType Constraints_hasNoLower( Constraints* _THIS
|
||||
);
|
||||
|
||||
/** Returns status of upper bounds.
|
||||
* \return BT_TRUE if there is no upper constraints' bound on any variable. */
|
||||
static inline BooleanType Constraints_hasNoUpper( Constraints* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Shifts forward type and status of all constraints by a given
|
||||
* offset. This offset has to lie within the range [0,n/2] and has to
|
||||
* be an integer divisor of the total number of constraints n.
|
||||
* Type and status of the first \<offset\> constraints is thrown away,
|
||||
* type and status of the last \<offset\> constraints is doubled,
|
||||
* e.g. for offset = 2: \n
|
||||
* shift( {c/b1,c/b2,c/b3,c/b4,c/b5,c/b6} ) = {c/b3,c/b4,c/b5,c/b6,c/b5,c/b6}
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_INVALID_ARGUMENTS \n
|
||||
RET_SHIFTING_FAILED */
|
||||
returnValue Constraints_shift( Constraints* _THIS,
|
||||
int offset /**< Shift offset within the range [0,n/2] and integer divisor of n. */
|
||||
);
|
||||
|
||||
/** Rotates forward type and status of all constraints by a given
|
||||
* offset. This offset has to lie within the range [0,n].
|
||||
* Example for offset = 2: \n
|
||||
* rotate( {c1,c2,c3,c4,c5,c6} ) = {c3,c4,c5,c6,c1,c2}
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEX_OUT_OF_BOUNDS \n
|
||||
RET_ROTATING_FAILED */
|
||||
returnValue Constraints_rotate( Constraints* _THIS,
|
||||
int offset /**< Rotation offset within the range [0,n]. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints information on constraints object
|
||||
* (in particular, lists of inactive and active constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue Constraints_print( Constraints* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
|
||||
* to the index set corresponding to the desired status;
|
||||
* the order depends on the SujectToType of each index.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SETUP_CONSTRAINT_FAILED */
|
||||
returnValue Constraints_setupAll( Constraints* _THIS,
|
||||
SubjectToStatus _status /**< Desired initial status for all bounds. */
|
||||
);
|
||||
|
||||
|
||||
/** Adds the index of a new constraint to index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_ADDINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Constraints_addIndex( Constraints* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list to which the new index shall be added. */
|
||||
int newnumber, /**< Number of new constraint. */
|
||||
SubjectToStatus newstatus /**< Status of new constraint. */
|
||||
);
|
||||
|
||||
/** Removes the index of a constraint from index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_REMOVEINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Constraints_removeIndex( Constraints* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */
|
||||
int removenumber /**< Number of constraint to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps the indices of two constraints or bounds within the index set.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_SWAPINDEX_FAILED \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Constraints_swapIndex( Constraints* _THIS,
|
||||
Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */
|
||||
int number1, /**< Number of first constraint. */
|
||||
int number2 /**< Number of second constraint. */
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N u m b e r O f T y p e
|
||||
*/
|
||||
static inline int Constraints_getNumberOfType( Constraints* _THIS, SubjectToType _type )
|
||||
{
|
||||
int i;
|
||||
int numberOfType = 0;
|
||||
|
||||
if ( _THIS->type != 0 )
|
||||
{
|
||||
for( i=0; i<_THIS->n; ++i )
|
||||
if ( _THIS->type[i] == _type )
|
||||
++numberOfType;
|
||||
}
|
||||
|
||||
return numberOfType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t T y p e
|
||||
*/
|
||||
static inline SubjectToType Constraints_getType( Constraints* _THIS, int i )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
return _THIS->type[i];
|
||||
|
||||
return ST_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S t a t u s
|
||||
*/
|
||||
static inline SubjectToStatus Constraints_getStatus( Constraints* _THIS, int i )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
return _THIS->status[i];
|
||||
|
||||
return ST_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t T y p e
|
||||
*/
|
||||
static inline returnValue Constraints_setType( Constraints* _THIS, int i, SubjectToType value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
{
|
||||
_THIS->type[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t S t a t u s
|
||||
*/
|
||||
static inline returnValue Constraints_setStatus( Constraints* _THIS, int i, SubjectToStatus value )
|
||||
{
|
||||
if ( ( i >= 0 ) && ( i < _THIS->n ) )
|
||||
{
|
||||
_THIS->status[i] = value;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o L o w e r
|
||||
*/
|
||||
static inline void Constraints_setNoLower( Constraints* _THIS, BooleanType _status )
|
||||
{
|
||||
_THIS->noLower = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t N o U p p e r
|
||||
*/
|
||||
static inline void Constraints_setNoUpper( Constraints* _THIS, BooleanType _status )
|
||||
{
|
||||
_THIS->noUpper = _status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* h a s N o L o w e r
|
||||
*/
|
||||
static inline BooleanType Constraints_hasNoLower( Constraints* _THIS )
|
||||
{
|
||||
return _THIS->noLower;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* h a s N o U p p p e r
|
||||
*/
|
||||
static inline BooleanType Constraints_hasNoUpper( Constraints* _THIS )
|
||||
{
|
||||
return _THIS->noUpper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N C
|
||||
*/
|
||||
static inline int Constraints_getNC( Constraints* _THIS )
|
||||
{
|
||||
return _THIS->n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N E C
|
||||
*/
|
||||
static inline int Constraints_getNEC( Constraints* _THIS )
|
||||
{
|
||||
return Constraints_getNumberOfType( _THIS,ST_EQUALITY );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I C
|
||||
*/
|
||||
static inline int Constraints_getNIC( Constraints* _THIS )
|
||||
{
|
||||
return Constraints_getNumberOfType( _THIS,ST_BOUNDED );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N U C
|
||||
*/
|
||||
static inline int Constraints_getNUC( Constraints* _THIS )
|
||||
{
|
||||
return Constraints_getNumberOfType( _THIS,ST_UNBOUNDED );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N A C
|
||||
*/
|
||||
static inline int Constraints_getNAC( Constraints* _THIS )
|
||||
{
|
||||
return Indexlist_getLength( _THIS->active );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t N I A C
|
||||
*/
|
||||
static inline int Constraints_getNIAC( Constraints* _THIS )
|
||||
{
|
||||
return Indexlist_getLength( _THIS->inactive );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t A c t i v e
|
||||
*/
|
||||
static inline Indexlist* Constraints_getActive( Constraints* _THIS )
|
||||
{
|
||||
return _THIS->active;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n a c t i v e
|
||||
*/
|
||||
static inline Indexlist* Constraints_getInactive( Constraints* _THIS )
|
||||
{
|
||||
return _THIS->inactive;
|
||||
}
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_CONSTRAINTS_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
129
third_party/acados/include/qpOASES_e/Flipper.h
vendored
Normal file
129
third_party/acados/include/qpOASES_e/Flipper.h
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Flipper.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the Options class designed to manage user-specified
|
||||
* options for solving a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_FLIPPER_H
|
||||
#define QPOASES_FLIPPER_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Bounds.h>
|
||||
#include <qpOASES_e/Constraints.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for storing a copy of the current matrix factorisations.
|
||||
*
|
||||
* This auxiliary class stores a copy of the current matrix factorisations. It
|
||||
* is used by the classe QProblemB and QProblem in case flipping bounds are enabled.
|
||||
*
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Bounds *bounds; /**< Data structure for problem's bounds. */
|
||||
Constraints *constraints; /**< Data structure for problem's constraints. */
|
||||
|
||||
real_t *R; /**< Cholesky factor of H (i.e. H = R^T*R). */
|
||||
real_t *Q; /**< Orthonormal quadratic matrix, A = [0 T]*Q'. */
|
||||
real_t *T; /**< Reverse triangular matrix, A = [0 T]*Q'. */
|
||||
|
||||
unsigned int nV; /**< Number of variables. */
|
||||
unsigned int nC; /**< Number of constraints. */
|
||||
} Flipper;
|
||||
|
||||
int Flipper_calculateMemorySize( unsigned int nV, unsigned int nC );
|
||||
|
||||
char *Flipper_assignMemory( unsigned int nV, unsigned int nC, Flipper **mem, void *raw_memory );
|
||||
|
||||
Flipper *Flipper_createMemory( unsigned int nV, unsigned int nC );
|
||||
|
||||
/** Constructor which takes the number of bounds and constraints. */
|
||||
void FlipperCON( Flipper* _THIS,
|
||||
unsigned int _nV, /**< Number of bounds. */
|
||||
unsigned int _nC /**< Number of constraints. */
|
||||
);
|
||||
|
||||
/** Copy constructor (deep copy). */
|
||||
void FlipperCPY( Flipper* FROM,
|
||||
Flipper* TO
|
||||
);
|
||||
|
||||
/** Initialises object with given number of bounds and constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Flipper_init( Flipper* _THIS,
|
||||
unsigned int _nV, /**< Number of bounds. */
|
||||
unsigned int _nC /**< Number of constraints. */
|
||||
);
|
||||
|
||||
|
||||
/** Copies current values to non-null arguments (assumed to be allocated with consistent size).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Flipper_get( Flipper* _THIS,
|
||||
Bounds* const _bounds, /**< Pointer to new bounds. */
|
||||
real_t* const R, /**< New matrix R. */
|
||||
Constraints* const _constraints, /**< Pointer to new constraints. */
|
||||
real_t* const _Q, /**< New matrix Q. */
|
||||
real_t* const _T /**< New matrix T. */
|
||||
);
|
||||
|
||||
/** Assigns new values to non-null arguments.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Flipper_set( Flipper* _THIS,
|
||||
const Bounds* const _bounds, /**< Pointer to new bounds. */
|
||||
const real_t* const _R, /**< New matrix R. */
|
||||
const Constraints* const _constraints, /**< Pointer to new constraints. */
|
||||
const real_t* const _Q, /**< New matrix Q. */
|
||||
const real_t* const _T /**< New matrix T. */
|
||||
);
|
||||
|
||||
/** Returns dimension of matrix T.
|
||||
* \return Dimension of matrix T. */
|
||||
unsigned int Flipper_getDimT( Flipper* _THIS );
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_FLIPPER_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
221
third_party/acados/include/qpOASES_e/Indexlist.h
vendored
Normal file
221
third_party/acados/include/qpOASES_e/Indexlist.h
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Indexlist.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the Indexlist class designed to manage index lists of
|
||||
* constraints and bounds within a SubjectTo object.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_INDEXLIST_H
|
||||
#define QPOASES_INDEXLIST_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Utils.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Stores and manages index lists.
|
||||
*
|
||||
* This class manages index lists of active/inactive bounds/constraints.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int *number; /**< Array to store numbers of constraints or bounds. */
|
||||
int *iSort; /**< Index list to sort vector \a number */
|
||||
|
||||
int length; /**< Length of index list. */
|
||||
int first; /**< Physical index of first element. */
|
||||
int last; /**< Physical index of last element. */
|
||||
int lastusedindex; /**< Physical index of last entry in index list. */
|
||||
int physicallength; /**< Physical length of index list. */
|
||||
} Indexlist;
|
||||
|
||||
int Indexlist_calculateMemorySize( int n);
|
||||
|
||||
char *Indexlist_assignMemory(int n, Indexlist **mem, void *raw_memory);
|
||||
|
||||
Indexlist *Indexlist_createMemory( int n );
|
||||
|
||||
/** Constructor which takes the desired physical length of the index list. */
|
||||
void IndexlistCON( Indexlist* _THIS,
|
||||
int n /**< Physical length of index list. */
|
||||
);
|
||||
|
||||
/** Copies all members from given rhs object.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
void IndexlistCPY( Indexlist* FROM,
|
||||
Indexlist* TO
|
||||
);
|
||||
|
||||
/** Initialises index list of desired physical length.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS */
|
||||
returnValue Indexlist_init( Indexlist* _THIS,
|
||||
int n /**< Physical length of index list. */
|
||||
);
|
||||
|
||||
/** Creates an array of all numbers within the index set in correct order.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue Indexlist_getNumberArray( Indexlist* _THIS,
|
||||
int** const numberarray /**< Output: Array of numbers (NULL on error). */
|
||||
);
|
||||
|
||||
/** Creates an array of all numbers within the index set in correct order.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_CORRUPTED */
|
||||
returnValue Indexlist_getISortArray( Indexlist* _THIS,
|
||||
int** const iSortArray /**< Output: iSort Array. */
|
||||
);
|
||||
|
||||
|
||||
/** Determines the index within the index list at which a given number is stored.
|
||||
* \return >= 0: Index of given number. \n
|
||||
-1: Number not found. */
|
||||
int Indexlist_getIndex( Indexlist* _THIS,
|
||||
int givennumber /**< Number whose index shall be determined. */
|
||||
);
|
||||
|
||||
/** Returns the number stored at a given physical index.
|
||||
* \return >= 0: Number stored at given physical index. \n
|
||||
-RET_INDEXLIST_OUTOFBOUNDS */
|
||||
static inline int Indexlist_getNumber( Indexlist* _THIS,
|
||||
int physicalindex /**< Physical index of the number to be returned. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the current length of the index list.
|
||||
* \return Current length of the index list. */
|
||||
static inline int Indexlist_getLength( Indexlist* _THIS
|
||||
);
|
||||
|
||||
/** Returns last number within the index list.
|
||||
* \return Last number within the index list. */
|
||||
static inline int Indexlist_getLastNumber( Indexlist* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Adds number to index list.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INDEXLIST_MUST_BE_REORDERD \n
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH */
|
||||
returnValue Indexlist_addNumber( Indexlist* _THIS,
|
||||
int addnumber /**< Number to be added. */
|
||||
);
|
||||
|
||||
/** Removes number from index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Indexlist_removeNumber( Indexlist* _THIS,
|
||||
int removenumber /**< Number to be removed. */
|
||||
);
|
||||
|
||||
/** Swaps two numbers within index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Indexlist_swapNumbers( Indexlist* _THIS,
|
||||
int number1, /**< First number for swapping. */
|
||||
int number2 /**< Second number for swapping. */
|
||||
);
|
||||
|
||||
/** Determines if a given number is contained in the index set.
|
||||
* \return BT_TRUE iff number is contain in the index set */
|
||||
static inline BooleanType Indexlist_isMember( Indexlist* _THIS,
|
||||
int _number /**< Number to be tested for membership. */
|
||||
);
|
||||
|
||||
|
||||
/** Find first index j between -1 and length in sorted list of indices
|
||||
* iSort such that numbers[iSort[j]] <= i < numbers[iSort[j+1]]. Uses
|
||||
* bisection.
|
||||
* \return j. */
|
||||
int Indexlist_findInsert( Indexlist* _THIS,
|
||||
int i
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t N u m b e r
|
||||
*/
|
||||
static inline int Indexlist_getNumber( Indexlist* _THIS, int physicalindex )
|
||||
{
|
||||
/* consistency check */
|
||||
if ( ( physicalindex < 0 ) || ( physicalindex > _THIS->length ) )
|
||||
return -RET_INDEXLIST_OUTOFBOUNDS;
|
||||
|
||||
return _THIS->number[physicalindex];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L e n g t h
|
||||
*/
|
||||
static inline int Indexlist_getLength( Indexlist* _THIS )
|
||||
{
|
||||
return _THIS->length;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
static inline int Indexlist_getLastNumber( Indexlist* _THIS )
|
||||
{
|
||||
return _THIS->number[_THIS->length-1];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t L a s t N u m b e r
|
||||
*/
|
||||
static inline BooleanType Indexlist_isMember( Indexlist* _THIS, int _number )
|
||||
{
|
||||
if ( Indexlist_getIndex( _THIS,_number ) >= 0 )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_INDEXLIST_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
287
third_party/acados/include/qpOASES_e/Matrices.h
vendored
Normal file
287
third_party/acados/include/qpOASES_e/Matrices.h
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Matrices.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2009-2015
|
||||
*
|
||||
* Various matrix classes: Abstract base matrix class, dense and sparse matrices,
|
||||
* including symmetry exploiting specializations.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef QPOASES_MATRICES_H
|
||||
#define QPOASES_MATRICES_H
|
||||
|
||||
#ifdef __USE_SINGLE_PRECISION__
|
||||
|
||||
// single precision
|
||||
#define GEMM sgemm_
|
||||
#define GEMV sgemv_
|
||||
// #define SYR ssyr_
|
||||
// #define SYR2 ssyr2_
|
||||
#define POTRF spotrf_
|
||||
|
||||
#else
|
||||
|
||||
// double precision
|
||||
#define GEMM dgemm_
|
||||
#define GEMV dgemv_
|
||||
// #define SYR dsyr_
|
||||
// #define SYR2 dsyr2_
|
||||
#define POTRF dpotrf_
|
||||
|
||||
#endif /* __USE_SINGLE_PRECISION__ */
|
||||
|
||||
|
||||
#ifdef EXTERNAL_BLAS
|
||||
// double precision
|
||||
void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int ldb, double *beta, double *C, int *ldc);
|
||||
void dgemv_(char *ta, int *m, int *n, double *alpha, double *A, int *lda, double *x, int *incx, double *beta, double *y, int *incy);
|
||||
void dpotrf_(char *uplo, int *m, double *A, int *lda, int *info);
|
||||
// single precision
|
||||
void sgemm_(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int ldb, float *beta, float *C, int *ldc);
|
||||
void sgemv_(char *ta, int *m, int *n, float *alpha, float *A, int *lda, float *x, int *incx, float *beta, float *y, int *incy);
|
||||
void spotrf_(char *uplo, int *m, float *A, int *lda, int *info);
|
||||
#else
|
||||
/** Performs one of the matrix-matrix operation in double precision. */
|
||||
void dgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*,
|
||||
const double*, const double*, const unsigned long*, const double*, const unsigned long*,
|
||||
const double*, double*, const unsigned long* );
|
||||
/** Performs one of the matrix-matrix operation in single precision. */
|
||||
void sgemm_ ( const char*, const char*, const unsigned long*, const unsigned long*, const unsigned long*,
|
||||
const float*, const float*, const unsigned long*, const float*, const unsigned long*,
|
||||
const float*, float*, const unsigned long* );
|
||||
|
||||
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in double precision. */
|
||||
void dpotrf_ ( const char *, const unsigned long *, double *, const unsigned long *, long * );
|
||||
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in single precision. */
|
||||
void spotrf_ ( const char *, const unsigned long *, float *, const unsigned long *, long * );
|
||||
|
||||
#endif
|
||||
|
||||
/** Performs a symmetric rank 1 operation in double precision. */
|
||||
// void dsyr_ ( const char *, const unsigned long *, const double *, const double *,
|
||||
// const unsigned long *, double *, const unsigned long *);
|
||||
/** Performs a symmetric rank 1 operation in single precision. */
|
||||
// void ssyr_ ( const char *, const unsigned long *, const float *, const float *,
|
||||
// const unsigned long *, float *, const unsigned long *);
|
||||
|
||||
/** Performs a symmetric rank 2 operation in double precision. */
|
||||
// void dsyr2_ ( const char *, const unsigned long *, const double *, const double *,
|
||||
// const unsigned long *, const double *, const unsigned long *, double *, const unsigned long *);
|
||||
/** Performs a symmetric rank 2 operation in single precision. */
|
||||
// void ssyr2_ ( const char *, const unsigned long *, const float *, const float *,
|
||||
// const unsigned long *, const float *, const unsigned long *, float *, const unsigned long *);
|
||||
|
||||
|
||||
#include <qpOASES_e/Indexlist.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Interfaces matrix-vector operations tailored to general dense matrices.
|
||||
*
|
||||
* Dense matrix class (row major format).
|
||||
*
|
||||
* \author Andreas Potschka, Christian Kirches, Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2011-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
real_t *val; /**< Vector of entries. */
|
||||
int nRows; /**< Number of rows. */
|
||||
int nCols; /**< Number of columns. */
|
||||
int leaDim; /**< Leading dimension. */
|
||||
} DenseMatrix;
|
||||
|
||||
int DenseMatrix_calculateMemorySize( int m, int n );
|
||||
|
||||
char *DenseMatrix_assignMemory( int m, int n, DenseMatrix **mem, void *raw_memory );
|
||||
|
||||
DenseMatrix *DenseMatrix_createMemory( int m, int n );
|
||||
|
||||
/** Constructor from vector of values.
|
||||
* Caution: Data pointer must be valid throughout lifetime
|
||||
*/
|
||||
void DenseMatrixCON( DenseMatrix* _THIS,
|
||||
int m, /**< Number of rows. */
|
||||
int n, /**< Number of columns. */
|
||||
int lD, /**< Leading dimension. */
|
||||
real_t *v /**< Values. */
|
||||
);
|
||||
|
||||
void DenseMatrixCPY( DenseMatrix* FROM,
|
||||
DenseMatrix* TO
|
||||
);
|
||||
|
||||
|
||||
/** Frees all internal memory. */
|
||||
void DenseMatrix_free( DenseMatrix* _THIS );
|
||||
|
||||
/** Constructor from vector of values.
|
||||
* Caution: Data pointer must be valid throughout lifetime
|
||||
*/
|
||||
returnValue DenseMatrix_init( DenseMatrix* _THIS,
|
||||
int m, /**< Number of rows. */
|
||||
int n, /**< Number of columns. */
|
||||
int lD, /**< Leading dimension. */
|
||||
real_t *v /**< Values. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns i-th diagonal entry.
|
||||
* \return i-th diagonal entry */
|
||||
real_t DenseMatrix_diag( DenseMatrix* _THIS,
|
||||
int i /**< Index. */
|
||||
);
|
||||
|
||||
/** Checks whether matrix is square and diagonal.
|
||||
* \return BT_TRUE iff matrix is square and diagonal; \n
|
||||
* BT_FALSE otherwise. */
|
||||
BooleanType DenseMatrix_isDiag( DenseMatrix* _THIS );
|
||||
|
||||
/** Get the N-norm of the matrix
|
||||
* \return N-norm of the matrix
|
||||
*/
|
||||
real_t DenseMatrix_getNorm( DenseMatrix* _THIS,
|
||||
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
|
||||
);
|
||||
|
||||
/** Get the N-norm of a row
|
||||
* \return N-norm of row \a rNum
|
||||
*/
|
||||
real_t DenseMatrix_getRowNorm( DenseMatrix* _THIS,
|
||||
int rNum, /**< Row number. */
|
||||
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
|
||||
);
|
||||
|
||||
/** Retrieve indexed entries of matrix row multiplied by alpha.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_getRow( DenseMatrix* _THIS,
|
||||
int rNum, /**< Row number. */
|
||||
const Indexlist* const icols, /**< Index list specifying columns. */
|
||||
real_t alpha, /**< Scalar factor. */
|
||||
real_t *row /**< Output row vector. */
|
||||
);
|
||||
|
||||
/** Retrieve indexed entries of matrix column multiplied by alpha.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_getCol( DenseMatrix* _THIS,
|
||||
int cNum, /**< Column number. */
|
||||
const Indexlist* const irows, /**< Index list specifying rows. */
|
||||
real_t alpha, /**< Scalar factor. */
|
||||
real_t *col /**< Output column vector. */
|
||||
);
|
||||
|
||||
/** Evaluate Y=alpha*A*X + beta*Y.
|
||||
* \return SUCCESSFUL_RETURN. */
|
||||
returnValue DenseMatrix_times( DenseMatrix* _THIS,
|
||||
int xN, /**< Number of vectors to multiply. */
|
||||
real_t alpha, /**< Scalar factor for matrix vector product. */
|
||||
const real_t *x, /**< Input vector to be multiplied. */
|
||||
int xLD, /**< Leading dimension of input x. */
|
||||
real_t beta, /**< Scalar factor for y. */
|
||||
real_t *y, /**< Output vector of results. */
|
||||
int yLD /**< Leading dimension of output y. */
|
||||
);
|
||||
|
||||
/** Evaluate Y=alpha*A'*X + beta*Y.
|
||||
* \return SUCCESSFUL_RETURN. */
|
||||
returnValue DenseMatrix_transTimes( DenseMatrix* _THIS,
|
||||
int xN, /**< Number of vectors to multiply. */
|
||||
real_t alpha, /**< Scalar factor for matrix vector product. */
|
||||
const real_t *x, /**< Input vector to be multiplied. */
|
||||
int xLD, /**< Leading dimension of input x. */
|
||||
real_t beta, /**< Scalar factor for y. */
|
||||
real_t *y, /**< Output vector of results. */
|
||||
int yLD /**< Leading dimension of output y. */
|
||||
);
|
||||
|
||||
/** Evaluate matrix vector product with submatrix given by Indexlist.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_subTimes( DenseMatrix* _THIS,
|
||||
const Indexlist* const irows, /**< Index list specifying rows. */
|
||||
const Indexlist* const icols, /**< Index list specifying columns. */
|
||||
int xN, /**< Number of vectors to multiply. */
|
||||
real_t alpha, /**< Scalar factor for matrix vector product. */
|
||||
const real_t *x, /**< Input vector to be multiplied. */
|
||||
int xLD, /**< Leading dimension of input x. */
|
||||
real_t beta, /**< Scalar factor for y. */
|
||||
real_t *y, /**< Output vector of results. */
|
||||
int yLD, /**< Leading dimension of output y. */
|
||||
BooleanType yCompr /**< Compressed storage for y. */
|
||||
);
|
||||
|
||||
/** Evaluate matrix transpose vector product.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_subTransTimes( DenseMatrix* _THIS,
|
||||
const Indexlist* const irows, /**< Index list specifying rows. */
|
||||
const Indexlist* const icols, /**< Index list specifying columns. */
|
||||
int xN, /**< Number of vectors to multiply. */
|
||||
real_t alpha, /**< Scalar factor for matrix vector product. */
|
||||
const real_t *x, /**< Input vector to be multiplied. */
|
||||
int xLD, /**< Leading dimension of input x. */
|
||||
real_t beta, /**< Scalar factor for y. */
|
||||
real_t *y, /**< Output vector of results. */
|
||||
int yLD /**< Leading dimension of output y. */
|
||||
);
|
||||
|
||||
/** Adds given offset to diagonal of matrix.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_NO_DIAGONAL_AVAILABLE */
|
||||
returnValue DenseMatrix_addToDiag( DenseMatrix* _THIS,
|
||||
real_t alpha /**< Diagonal offset. */
|
||||
);
|
||||
|
||||
/** Prints matrix to screen.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_print( DenseMatrix* _THIS
|
||||
);
|
||||
|
||||
static inline real_t* DenseMatrix_getVal( DenseMatrix* _THIS ) { return _THIS->val; }
|
||||
|
||||
/** Compute bilinear form y = x'*H*x using submatrix given by index list.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue DenseMatrix_bilinear( DenseMatrix* _THIS,
|
||||
const Indexlist* const icols, /**< Index list specifying columns of x. */
|
||||
int xN, /**< Number of vectors to multiply. */
|
||||
const real_t *x, /**< Input vector to be multiplied (uncompressed). */
|
||||
int xLD, /**< Leading dimension of input x. */
|
||||
real_t *y, /**< Output vector of results (compressed). */
|
||||
int yLD /**< Leading dimension of output y. */
|
||||
);
|
||||
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_MATRICES_H */
|
||||
544
third_party/acados/include/qpOASES_e/MessageHandling.h
vendored
Normal file
544
third_party/acados/include/qpOASES_e/MessageHandling.h
vendored
Normal file
@@ -0,0 +1,544 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/MessageHandling.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches (thanks to Leonard Wirsching)
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the MessageHandling class including global return values.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_MESSAGEHANDLING_H
|
||||
#define QPOASES_MESSAGEHANDLING_H
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <qpOASES_e/Constants.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/** Default file to display messages. */
|
||||
#define stdFile stderr
|
||||
|
||||
|
||||
/**
|
||||
* \brief Defines all symbols for global return values.
|
||||
*
|
||||
* The enumeration returnValueType defines all symbols for global return values.
|
||||
* Important: All return values are assumed to be nonnegative!
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
TERMINAL_LIST_ELEMENT = -1, /**< Terminal list element, internal usage only! */
|
||||
/* miscellaneous */
|
||||
SUCCESSFUL_RETURN = 0, /**< Successful return. */
|
||||
RET_DIV_BY_ZERO, /**< Division by zero. */
|
||||
RET_INDEX_OUT_OF_BOUNDS, /**< Index out of bounds. */
|
||||
RET_INVALID_ARGUMENTS, /**< At least one of the arguments is invalid. */
|
||||
RET_ERROR_UNDEFINED, /**< Error number undefined. */
|
||||
RET_WARNING_UNDEFINED, /**< Warning number undefined. */
|
||||
RET_INFO_UNDEFINED, /**< Info number undefined. */
|
||||
RET_EWI_UNDEFINED, /**< Error/warning/info number undefined. */
|
||||
RET_AVAILABLE_WITH_LINUX_ONLY, /**< This function is available under Linux only. */
|
||||
RET_UNKNOWN_BUG, /**< The error occurred is not yet known. */
|
||||
RET_PRINTLEVEL_CHANGED, /**< Print level changed. (10) */
|
||||
RET_NOT_YET_IMPLEMENTED, /**< Requested function is not yet implemented in this version of qpOASES. */
|
||||
/* Indexlist */
|
||||
RET_INDEXLIST_MUST_BE_REORDERD, /**< Index list has to be reordered. */
|
||||
RET_INDEXLIST_EXCEEDS_MAX_LENGTH, /**< Index list exceeds its maximal physical length. */
|
||||
RET_INDEXLIST_CORRUPTED, /**< Index list corrupted. */
|
||||
RET_INDEXLIST_OUTOFBOUNDS, /**< Physical index is out of bounds. */
|
||||
RET_INDEXLIST_ADD_FAILED, /**< Adding indices from another index set failed. */
|
||||
RET_INDEXLIST_INTERSECT_FAILED, /**< Intersection with another index set failed. */
|
||||
/* SubjectTo / Bounds / Constraints */
|
||||
RET_INDEX_ALREADY_OF_DESIRED_STATUS, /**< Index is already of desired status. (18) */
|
||||
RET_ADDINDEX_FAILED, /**< Adding index to index set failed. */
|
||||
RET_REMOVEINDEX_FAILED, /**< Removing index from index set failed. (20) */
|
||||
RET_SWAPINDEX_FAILED, /**< Cannot swap between different indexsets. */
|
||||
RET_NOTHING_TO_DO, /**< Nothing to do. */
|
||||
RET_SETUP_BOUND_FAILED, /**< Setting up bound index failed. */
|
||||
RET_SETUP_CONSTRAINT_FAILED, /**< Setting up constraint index failed. */
|
||||
RET_MOVING_BOUND_FAILED, /**< Moving bound between index sets failed. */
|
||||
RET_MOVING_CONSTRAINT_FAILED, /**< Moving constraint between index sets failed. */
|
||||
RET_SHIFTING_FAILED, /**< Shifting of bounds/constraints failed. */
|
||||
RET_ROTATING_FAILED, /**< Rotating of bounds/constraints failed. */
|
||||
/* QProblem */
|
||||
RET_QPOBJECT_NOT_SETUP, /**< The QP object has not been setup correctly, use another constructor. */
|
||||
RET_QP_ALREADY_INITIALISED, /**< QProblem has already been initialised. (30) */
|
||||
RET_NO_INIT_WITH_STANDARD_SOLVER, /**< Initialisation via extern QP solver is not yet implemented. */
|
||||
RET_RESET_FAILED, /**< Reset failed. */
|
||||
RET_INIT_FAILED, /**< Initialisation failed. */
|
||||
RET_INIT_FAILED_TQ, /**< Initialisation failed due to TQ factorisation. */
|
||||
RET_INIT_FAILED_CHOLESKY, /**< Initialisation failed due to Cholesky decomposition. */
|
||||
RET_INIT_FAILED_HOTSTART, /**< Initialisation failed! QP could not be solved! */
|
||||
RET_INIT_FAILED_INFEASIBILITY, /**< Initial QP could not be solved due to infeasibility! */
|
||||
RET_INIT_FAILED_UNBOUNDEDNESS, /**< Initial QP could not be solved due to unboundedness! */
|
||||
RET_INIT_FAILED_REGULARISATION, /**< Initialisation failed as Hessian matrix could not be regularised. */
|
||||
RET_INIT_SUCCESSFUL, /**< Initialisation done. (40) */
|
||||
RET_OBTAINING_WORKINGSET_FAILED, /**< Failed to obtain working set for auxiliary QP. */
|
||||
RET_SETUP_WORKINGSET_FAILED, /**< Failed to setup working set for auxiliary QP. */
|
||||
RET_SETUP_AUXILIARYQP_FAILED, /**< Failed to setup auxiliary QP for initialised homotopy. */
|
||||
RET_NO_CHOLESKY_WITH_INITIAL_GUESS, /**< Externally computed Cholesky factor cannot be combined with an initial guess. */
|
||||
RET_NO_EXTERN_SOLVER, /**< No extern QP solver available. */
|
||||
RET_QP_UNBOUNDED, /**< QP is unbounded. */
|
||||
RET_QP_INFEASIBLE, /**< QP is infeasible. */
|
||||
RET_QP_NOT_SOLVED, /**< Problems occurred while solving QP with standard solver. */
|
||||
RET_QP_SOLVED, /**< QP successfully solved. */
|
||||
RET_UNABLE_TO_SOLVE_QP, /**< Problems occurred while solving QP. (50) */
|
||||
RET_INITIALISATION_STARTED, /**< Starting problem initialisation... */
|
||||
RET_HOTSTART_FAILED, /**< Unable to perform homotopy due to internal error. */
|
||||
RET_HOTSTART_FAILED_TO_INIT, /**< Unable to initialise problem. */
|
||||
RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, /**< Unable to perform homotopy as previous QP is not solved. */
|
||||
RET_ITERATION_STARTED, /**< Iteration... */
|
||||
RET_SHIFT_DETERMINATION_FAILED, /**< Determination of shift of the QP data failed. */
|
||||
RET_STEPDIRECTION_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_STEPLENGTH_DETERMINATION_FAILED, /**< Determination of step direction failed. */
|
||||
RET_OPTIMAL_SOLUTION_FOUND, /**< Optimal solution of neighbouring QP found. */
|
||||
RET_HOMOTOPY_STEP_FAILED, /**< Unable to perform homotopy step. (60) */
|
||||
RET_HOTSTART_STOPPED_INFEASIBILITY, /**< Premature homotopy termination because QP is infeasible. */
|
||||
RET_HOTSTART_STOPPED_UNBOUNDEDNESS, /**< Premature homotopy termination because QP is unbounded. */
|
||||
RET_WORKINGSET_UPDATE_FAILED, /**< Unable to update working sets according to initial guesses. */
|
||||
RET_MAX_NWSR_REACHED, /**< Maximum number of working set recalculations performed. */
|
||||
RET_CONSTRAINTS_NOT_SPECIFIED, /**< Problem does comprise constraints! You also have to specify new constraints' bounds. */
|
||||
RET_INVALID_FACTORISATION_FLAG, /**< Invalid factorisation flag. */
|
||||
RET_UNABLE_TO_SAVE_QPDATA, /**< Unable to save QP data. */
|
||||
RET_STEPDIRECTION_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_STEPDIRECTION_FAILED_CHOLESKY, /**< Abnormal termination due to Cholesky factorisation. */
|
||||
RET_CYCLING_DETECTED, /**< Cycling detected. (70) */
|
||||
RET_CYCLING_NOT_RESOLVED, /**< Cycling cannot be resolved, QP probably infeasible. */
|
||||
RET_CYCLING_RESOLVED, /**< Cycling probably resolved. */
|
||||
RET_STEPSIZE, /**< For displaying performed stepsize. */
|
||||
RET_STEPSIZE_NONPOSITIVE, /**< For displaying non-positive stepsize. */
|
||||
RET_SETUPSUBJECTTOTYPE_FAILED, /**< Setup of SubjectToTypes failed. */
|
||||
RET_ADDCONSTRAINT_FAILED, /**< Addition of constraint to working set failed. */
|
||||
RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, /**< Addition of constraint to working set failed (due to QP infeasibility). */
|
||||
RET_ADDBOUND_FAILED, /**< Addition of bound to working set failed. */
|
||||
RET_ADDBOUND_FAILED_INFEASIBILITY, /**< Addition of bound to working set failed (due to QP infeasibility). */
|
||||
RET_REMOVECONSTRAINT_FAILED, /**< Removal of constraint from working set failed. (80) */
|
||||
RET_REMOVEBOUND_FAILED, /**< Removal of bound from working set failed. */
|
||||
RET_REMOVE_FROM_ACTIVESET, /**< Removing from active set... */
|
||||
RET_ADD_TO_ACTIVESET, /**< Adding to active set... */
|
||||
RET_REMOVE_FROM_ACTIVESET_FAILED, /**< Removing from active set failed. */
|
||||
RET_ADD_TO_ACTIVESET_FAILED, /**< Adding to active set failed. */
|
||||
RET_CONSTRAINT_ALREADY_ACTIVE, /**< Constraint is already active. */
|
||||
RET_ALL_CONSTRAINTS_ACTIVE, /**< All constraints are active, no further constraint can be added. */
|
||||
RET_LINEARLY_DEPENDENT, /**< New bound/constraint is linearly dependent. */
|
||||
RET_LINEARLY_INDEPENDENT, /**< New bound/constraint is linearly independent. */
|
||||
RET_LI_RESOLVED, /**< Linear independence of active constraint matrix successfully resolved. (90) */
|
||||
RET_ENSURELI_FAILED, /**< Failed to ensure linear independence of active constraint matrix. */
|
||||
RET_ENSURELI_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */
|
||||
RET_ENSURELI_FAILED_NOINDEX, /**< QP is infeasible. */
|
||||
RET_ENSURELI_FAILED_CYCLING, /**< QP is infeasible. */
|
||||
RET_BOUND_ALREADY_ACTIVE, /**< Bound is already active. */
|
||||
RET_ALL_BOUNDS_ACTIVE, /**< All bounds are active, no further bound can be added. */
|
||||
RET_CONSTRAINT_NOT_ACTIVE, /**< Constraint is not active. */
|
||||
RET_BOUND_NOT_ACTIVE, /**< Bound is not active. */
|
||||
RET_HESSIAN_NOT_SPD, /**< Projected Hessian matrix not positive definite. */
|
||||
RET_HESSIAN_INDEFINITE, /**< Hessian matrix is indefinite. (100) */
|
||||
RET_MATRIX_SHIFT_FAILED, /**< Unable to update matrices or to transform vectors. */
|
||||
RET_MATRIX_FACTORISATION_FAILED, /**< Unable to calculate new matrix factorisations. */
|
||||
RET_PRINT_ITERATION_FAILED, /**< Unable to print information on current iteration. */
|
||||
RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, /**< No global message output file initialised. */
|
||||
RET_DISABLECONSTRAINTS_FAILED, /**< Unable to disbable constraints. */
|
||||
RET_ENABLECONSTRAINTS_FAILED, /**< Unable to enbable constraints. */
|
||||
RET_ALREADY_ENABLED, /**< Bound or constraint is already enabled. */
|
||||
RET_ALREADY_DISABLED, /**< Bound or constraint is already disabled. */
|
||||
RET_NO_HESSIAN_SPECIFIED, /**< No Hessian matrix has been specified. */
|
||||
RET_USING_REGULARISATION, /**< Using regularisation as Hessian matrix is not positive definite. (110) */
|
||||
RET_EPS_MUST_BE_POSITVE, /**< Eps for regularisation must be sufficiently positive. */
|
||||
RET_REGSTEPS_MUST_BE_POSITVE, /**< Maximum number of regularisation steps must be non-negative. */
|
||||
RET_HESSIAN_ALREADY_REGULARISED, /**< Hessian has been already regularised. */
|
||||
RET_CANNOT_REGULARISE_IDENTITY, /**< Identity Hessian matrix cannot be regularised. */
|
||||
RET_CANNOT_REGULARISE_SPARSE, /**< Sparse matrix cannot be regularised as diagonal entry is missing. */
|
||||
RET_NO_REGSTEP_NWSR, /**< No additional regularisation step could be performed due to limits. */
|
||||
RET_FEWER_REGSTEPS_NWSR, /**< Fewer additional regularisation steps have been performed due to limits. */
|
||||
RET_CHOLESKY_OF_ZERO_HESSIAN, /**< Cholesky decomposition of (unregularised) zero Hessian matrix. */
|
||||
RET_ZERO_HESSIAN_ASSUMED, /**< Zero Hessian matrix assumed as null pointer passed without specifying hessianType. */
|
||||
RET_CONSTRAINTS_ARE_NOT_SCALED, /**< (no longer in use) (120) */
|
||||
RET_INITIAL_BOUNDS_STATUS_NYI, /**< (no longer in use) */
|
||||
RET_ERROR_IN_CONSTRAINTPRODUCT, /**< Error in user-defined constraint product function. */
|
||||
RET_FIX_BOUNDS_FOR_LP, /**< All initial bounds must be fixed when solving an (unregularised) LP. */
|
||||
RET_USE_REGULARISATION_FOR_LP, /**< Set options.enableRegularisation=BT_TRUE for solving LPs. */
|
||||
/* SQProblem */
|
||||
RET_UPDATEMATRICES_FAILED, /**< Unable to update QP matrices. */
|
||||
RET_UPDATEMATRICES_FAILED_AS_QP_NOT_SOLVED, /**< Unable to update matrices as previous QP is not solved. */
|
||||
/* Utils */
|
||||
RET_UNABLE_TO_OPEN_FILE, /**< Unable to open file. */
|
||||
RET_UNABLE_TO_WRITE_FILE, /**< Unable to write into file. */
|
||||
RET_UNABLE_TO_READ_FILE, /**< Unable to read from file. */
|
||||
RET_FILEDATA_INCONSISTENT, /**< File contains inconsistent data. (130) */
|
||||
/* Options */
|
||||
RET_OPTIONS_ADJUSTED, /**< Options needed to be adjusted for consistency reasons. */
|
||||
/* SolutionAnalysis */
|
||||
RET_UNABLE_TO_ANALYSE_QPROBLEM, /**< Unable to analyse (S)QProblem(B) object. */
|
||||
/* Benchmark */
|
||||
RET_NWSR_SET_TO_ONE, /**< Maximum number of working set changes was set to 1. */
|
||||
RET_UNABLE_TO_READ_BENCHMARK, /**< Unable to read benchmark data. */
|
||||
RET_BENCHMARK_ABORTED, /**< Benchmark aborted. */
|
||||
RET_INITIAL_QP_SOLVED, /**< Initial QP solved. */
|
||||
RET_QP_SOLUTION_STARTED, /**< Solving QP... */
|
||||
RET_BENCHMARK_SUCCESSFUL, /**< Benchmark terminated successfully. */
|
||||
/* Sparse matrices */
|
||||
RET_NO_DIAGONAL_AVAILABLE, /**< Sparse matrix does not have entries on full diagonal. */
|
||||
RET_DIAGONAL_NOT_INITIALISED, /**< Diagonal data of sparse matrix has not been initialised. (140) */
|
||||
/* Dropping of infeasible constraints */
|
||||
RET_ENSURELI_DROPPED, /**< Linear independence resolved by dropping blocking constraint. */
|
||||
/* Simple exitflags */
|
||||
RET_SIMPLE_STATUS_P1, /**< QP problem could not be solved within given number of iterations. */
|
||||
RET_SIMPLE_STATUS_P0, /**< QP problem solved. */
|
||||
RET_SIMPLE_STATUS_M1, /**< QP problem could not be solved due to an internal error. */
|
||||
RET_SIMPLE_STATUS_M2, /**< QP problem is infeasible (and thus could not be solved). */
|
||||
RET_SIMPLE_STATUS_M3 /**< QP problem is unbounded (and thus could not be solved). (146) */
|
||||
} returnValue;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Data structure for entries in global message list.
|
||||
*
|
||||
* Data structure for entries in global message list.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
returnValue key; /**< Global return value. */
|
||||
const char* data; /**< Corresponding message. */
|
||||
VisibilityStatus globalVisibilityStatus; /**< Determines if message can be printed.
|
||||
* If this value is set to VS_HIDDEN, no message is printed! */
|
||||
} ReturnValueList;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Handles all kind of error messages, warnings and other information.
|
||||
*
|
||||
* This class handles all kinds of messages (errors, warnings, infos) initiated
|
||||
* by qpOASES modules and stores the corresponding global preferences.
|
||||
*
|
||||
* \author Hans Joachim Ferreau (thanks to Leonard Wirsching)
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
VisibilityStatus errorVisibility; /**< Error messages visible? */
|
||||
VisibilityStatus warningVisibility; /**< Warning messages visible? */
|
||||
VisibilityStatus infoVisibility; /**< Info messages visible? */
|
||||
|
||||
FILE* outputFile; /**< Output file for messages. */
|
||||
|
||||
int errorCount; /**< Counts number of errors (for nicer output only). */
|
||||
} MessageHandling;
|
||||
|
||||
|
||||
|
||||
/** Constructor which takes the desired output file and desired visibility states. */
|
||||
void MessageHandlingCON( MessageHandling* _THIS,
|
||||
FILE* _outputFile, /**< Output file. */
|
||||
VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */
|
||||
VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */
|
||||
VisibilityStatus _infoVisibility /**< Visibility status for info messages. */
|
||||
);
|
||||
|
||||
void MessageHandlingCPY( MessageHandling* FROM,
|
||||
MessageHandling* TO
|
||||
);
|
||||
|
||||
|
||||
/** Prints an error message(a simplified macro THROWERROR is also provided). \n
|
||||
* Errors are definied as abnormal events which cause an immediate termination of the current (sub) function.
|
||||
* Errors of a sub function should be commented by the calling function by means of a warning message
|
||||
* (if this error does not cause an error of the calling function, either)!
|
||||
* \return Error number returned by sub function call
|
||||
*/
|
||||
returnValue MessageHandling_throwError( MessageHandling* _THIS,
|
||||
returnValue Enumber, /**< Error number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional error text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error. */
|
||||
const char* filename, /**< Name of file which caused the error. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error.incompatible binary file */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if error message can be printed to stderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a warning message (a simplified macro THROWWARNING is also provided).
|
||||
* Warnings are definied as abnormal events which does NOT cause an immediate termination of the current (sub) function.
|
||||
* \return Warning number returned by sub function call
|
||||
*/
|
||||
returnValue MessageHandling_throwWarning( MessageHandling* _THIS,
|
||||
returnValue Wnumber, /**< Warning number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the warning. */
|
||||
const char* filename, /**< Name of file which caused the warning. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the warning. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if warning message can be printed to stderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
/** Prints a info message (a simplified macro THROWINFO is also provided).
|
||||
* \return Info number returned by sub function call
|
||||
*/
|
||||
returnValue MessageHandling_throwInfo( MessageHandling* _THIS,
|
||||
returnValue Inumber, /**< Info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which submitted the info. */
|
||||
const char* filename, /**< Name of file which submitted the info. */
|
||||
const unsigned long linenumber, /**< Number of line which submitted the info. */
|
||||
VisibilityStatus localVisibilityStatus /**< Determines (locally) if info message can be printed to stderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
);
|
||||
|
||||
|
||||
/** Resets all preferences to default values.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue MessageHandling_reset( MessageHandling* _THIS );
|
||||
|
||||
|
||||
/** Prints a complete list of all messages to output file.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue MessageHandling_listAllMessages( MessageHandling* _THIS );
|
||||
|
||||
|
||||
/** Returns visibility status for error messages.
|
||||
* \return Visibility status for error messages. */
|
||||
static inline VisibilityStatus MessageHandling_getErrorVisibilityStatus( MessageHandling* _THIS );
|
||||
|
||||
/** Returns visibility status for warning messages.
|
||||
* \return Visibility status for warning messages. */
|
||||
static inline VisibilityStatus MessageHandling_getWarningVisibilityStatus( MessageHandling* _THIS );
|
||||
|
||||
/** Returns visibility status for info messages.
|
||||
* \return Visibility status for info messages. */
|
||||
static inline VisibilityStatus MessageHandling_getInfoVisibilityStatus( MessageHandling* _THIS );
|
||||
|
||||
/** Returns pointer to output file.
|
||||
* \return Pointer to output file. */
|
||||
static inline FILE* MessageHandling_getOutputFile( MessageHandling* _THIS );
|
||||
|
||||
/** Returns error count value.
|
||||
* \return Error count value. */
|
||||
static inline int MessageHandling_getErrorCount( MessageHandling* _THIS );
|
||||
|
||||
|
||||
/** Changes visibility status for error messages. */
|
||||
static inline void MessageHandling_setErrorVisibilityStatus( MessageHandling* _THIS,
|
||||
VisibilityStatus _errorVisibility /**< New visibility status for error messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for warning messages. */
|
||||
static inline void MessageHandling_setWarningVisibilityStatus( MessageHandling* _THIS,
|
||||
VisibilityStatus _warningVisibility /**< New visibility status for warning messages. */
|
||||
);
|
||||
|
||||
/** Changes visibility status for info messages. */
|
||||
static inline void MessageHandling_setInfoVisibilityStatus( MessageHandling* _THIS,
|
||||
VisibilityStatus _infoVisibility /**< New visibility status for info messages. */
|
||||
);
|
||||
|
||||
/** Changes output file for messages. */
|
||||
static inline void MessageHandling_setOutputFile( MessageHandling* _THIS,
|
||||
FILE* _outputFile /**< New output file for messages. */
|
||||
);
|
||||
|
||||
/** Changes error count.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
* RET_INVALID_ARGUMENT */
|
||||
static inline returnValue MessageHandling_setErrorCount( MessageHandling* _THIS,
|
||||
int _errorCount /**< New error count value. */
|
||||
);
|
||||
|
||||
/** Provides message text corresponding to given \a returnValue.
|
||||
* \return String containing message text. */
|
||||
const char* MessageHandling_getErrorCodeMessage( MessageHandling* _THIS,
|
||||
const returnValue _returnValue
|
||||
);
|
||||
|
||||
|
||||
returnValue MessageHandling_throwMessage( MessageHandling* _THIS,
|
||||
returnValue RETnumber, /**< Error/warning/info number returned by sub function call. */
|
||||
const char* additionaltext, /**< Additional warning text (0, if none). */
|
||||
const char* functionname, /**< Name of function which caused the error/warning/info. */
|
||||
const char* filename, /**< Name of file which caused the error/warning/info. */
|
||||
const unsigned long linenumber, /**< Number of line which caused the error/warning/info. */
|
||||
VisibilityStatus localVisibilityStatus, /**< Determines (locally) if info message can be printed to stderr.
|
||||
* If GLOBAL visibility status of the message is set to VS_HIDDEN,
|
||||
* no message is printed, anyway! */
|
||||
const char* RETstring /**< Leading string of error/warning/info message. */
|
||||
);
|
||||
|
||||
|
||||
#ifndef __FILE__
|
||||
/** Ensures that __FILE__ macro is defined. */
|
||||
#define __FILE__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __LINE__
|
||||
/** Ensures that __LINE__ macro is defined. */
|
||||
#define __LINE__ 0
|
||||
#endif
|
||||
|
||||
/** Define __FUNC__ macro providing current function for debugging. */
|
||||
/*#define __FUNC__ 0*/
|
||||
#define __FUNC__ ("(no function name provided)")
|
||||
/*#define __FUNC__ __func__*/
|
||||
/*#define __FUNC__ __FUNCTION__*/
|
||||
|
||||
|
||||
/** Short version of throwError with default values, only returnValue is needed */
|
||||
#define THROWERROR(retval) ( MessageHandling_throwError( qpOASES_getGlobalMessageHandler(),(retval),0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwWarning with default values, only returnValue is needed */
|
||||
#define THROWWARNING(retval) ( MessageHandling_throwWarning( qpOASES_getGlobalMessageHandler(),(retval),0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
/** Short version of throwInfo with default values, only returnValue is needed */
|
||||
#define THROWINFO(retval) ( MessageHandling_throwInfo( qpOASES_getGlobalMessageHandler(),(retval),0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE) )
|
||||
|
||||
|
||||
/** Returns a pointer to global message handler.
|
||||
* \return Pointer to global message handler.
|
||||
*/
|
||||
MessageHandling* qpOASES_getGlobalMessageHandler( );
|
||||
|
||||
|
||||
/*
|
||||
* g e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline VisibilityStatus MessageHandling_getErrorVisibilityStatus( MessageHandling* _THIS )
|
||||
{
|
||||
return _THIS->errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline VisibilityStatus MessageHandling_getWarningVisibilityStatus( MessageHandling* _THIS )
|
||||
{
|
||||
return _THIS->warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline VisibilityStatus MessageHandling_getInfoVisibilityStatus( MessageHandling* _THIS )
|
||||
{
|
||||
return _THIS->infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t O u t p u t F i l e
|
||||
*/
|
||||
static inline FILE* MessageHandling_getOutputFile( MessageHandling* _THIS )
|
||||
{
|
||||
return _THIS->outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t E r r o r C o u n t
|
||||
*/
|
||||
static inline int MessageHandling_getErrorCount( MessageHandling* _THIS )
|
||||
{
|
||||
return _THIS->errorCount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline void MessageHandling_setErrorVisibilityStatus( MessageHandling* _THIS, VisibilityStatus _errorVisibility )
|
||||
{
|
||||
_THIS->errorVisibility = _errorVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t W a r n i n g V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline void MessageHandling_setWarningVisibilityStatus( MessageHandling* _THIS, VisibilityStatus _warningVisibility )
|
||||
{
|
||||
_THIS->warningVisibility = _warningVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t I n f o V i s i b i l i t y S t a t u s
|
||||
*/
|
||||
static inline void MessageHandling_setInfoVisibilityStatus( MessageHandling* _THIS, VisibilityStatus _infoVisibility )
|
||||
{
|
||||
_THIS->infoVisibility = _infoVisibility;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t O u t p u t F i l e
|
||||
*/
|
||||
static inline void MessageHandling_setOutputFile( MessageHandling* _THIS, FILE* _outputFile )
|
||||
{
|
||||
_THIS->outputFile = _outputFile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* s e t E r r o r C o u n t
|
||||
*/
|
||||
static inline returnValue MessageHandling_setErrorCount( MessageHandling* _THIS, int _errorCount )
|
||||
{
|
||||
if ( _errorCount >= 0 )
|
||||
{
|
||||
_THIS->errorCount = _errorCount;
|
||||
return SUCCESSFUL_RETURN;
|
||||
}
|
||||
else
|
||||
return RET_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_MESSAGEHANDLING_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
153
third_party/acados/include/qpOASES_e/Options.h
vendored
Normal file
153
third_party/acados/include/qpOASES_e/Options.h
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Options.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of the Options class designed to manage user-specified
|
||||
* options for solving a QProblem.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_OPTIONS_H
|
||||
#define QPOASES_OPTIONS_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Utils.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/**
|
||||
* \brief Manages all user-specified options for solving QPs.
|
||||
*
|
||||
* This class manages all user-specified options used for solving
|
||||
* quadratic programs.
|
||||
*
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
PrintLevel printLevel; /**< Print level. */
|
||||
|
||||
BooleanType enableRamping; /**< Specifies whether ramping shall be enabled or not. */
|
||||
BooleanType enableFarBounds; /**< Specifies whether far bounds shall be used or not. */
|
||||
BooleanType enableFlippingBounds; /**< Specifies whether flipping bounds shall be used or not. */
|
||||
BooleanType enableRegularisation; /**< Specifies whether Hessian matrix shall be regularised in case semi-definiteness is detected. */
|
||||
BooleanType enableFullLITests; /**< Specifies whether condition-hardened LI test shall be used or not. */
|
||||
BooleanType enableNZCTests; /**< Specifies whether nonzero curvature tests shall be used. */
|
||||
int enableDriftCorrection; /**< Specifies the frequency of drift corrections (0 = off). */
|
||||
int enableCholeskyRefactorisation; /**< Specifies the frequency of full refactorisation of proj. Hessian (otherwise updates). */
|
||||
BooleanType enableEqualities; /**< Specifies whether equalities shall be always treated as active constraints. */
|
||||
|
||||
real_t terminationTolerance; /**< Termination tolerance. */
|
||||
real_t boundTolerance; /**< Lower/upper (constraints') bound tolerance (an inequality constraint whose lower and upper bounds differ by less is regarded to be an equality constraint). */
|
||||
real_t boundRelaxation; /**< Offset for relaxing (constraints') bounds at beginning of an initial homotopy. It is also as initial value for far bounds. */
|
||||
real_t epsNum; /**< Numerator tolerance for ratio tests. */
|
||||
real_t epsDen; /**< Denominator tolerance for ratio tests. */
|
||||
real_t maxPrimalJump; /**< Maximum allowed jump in primal variables in nonzero curvature tests. */
|
||||
real_t maxDualJump; /**< Maximum allowed jump in dual variables in linear independence tests. */
|
||||
|
||||
real_t initialRamping; /**< Start value for Ramping Strategy. */
|
||||
real_t finalRamping; /**< Final value for Ramping Strategy. */
|
||||
real_t initialFarBounds; /**< Initial size of Far Bounds. */
|
||||
real_t growFarBounds; /**< Factor to grow Far Bounds. */
|
||||
SubjectToStatus initialStatusBounds; /**< Initial status of bounds at first iteration. */
|
||||
real_t epsFlipping; /**< Tolerance of squared Cholesky diagonal factor which triggers flipping bound. */
|
||||
int numRegularisationSteps; /**< Maximum number of successive regularisation steps. */
|
||||
real_t epsRegularisation; /**< Scaling factor of identity matrix used for Hessian regularisation. */
|
||||
int numRefinementSteps; /**< Maximum number of iterative refinement steps. */
|
||||
real_t epsIterRef; /**< Early termination tolerance for iterative refinement. */
|
||||
real_t epsLITests; /**< Tolerance for linear independence tests. */
|
||||
real_t epsNZCTests; /**< Tolerance for nonzero curvature tests. */
|
||||
|
||||
BooleanType enableDropInfeasibles; /**< ... */
|
||||
int dropBoundPriority; /**< ... */
|
||||
int dropEqConPriority; /**< ... */
|
||||
int dropIneqConPriority; /**< ... */
|
||||
} Options;
|
||||
|
||||
|
||||
void OptionsCON( Options* _THIS
|
||||
);
|
||||
|
||||
/** Copies all members from given rhs object.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
void OptionsCPY( Options* FROM,
|
||||
Options* TO
|
||||
);
|
||||
|
||||
|
||||
/** Sets all options to default values.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Options_setToDefault( Options* _THIS
|
||||
);
|
||||
|
||||
/** Sets all options to values resulting in maximum reliabilty.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Options_setToReliable( Options* _THIS
|
||||
);
|
||||
|
||||
/** Sets all options to values resulting in minimum solution time.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Options_setToMPC( Options* _THIS
|
||||
);
|
||||
|
||||
/** Same as setToMPC( ), for ensuring backwards compatibility.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Options_setToFast( Options* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Ensures that all options have consistent values by automatically
|
||||
* adjusting inconsistent ones.
|
||||
* Note: This routine cannot (and does not try to) ensure that values
|
||||
* are set to reasonable values that make the QP solution work!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
* RET_OPTIONS_ADJUSTED */
|
||||
returnValue Options_ensureConsistency( Options* _THIS
|
||||
);
|
||||
|
||||
|
||||
/** Prints values of all options.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue Options_print( Options* _THIS
|
||||
);
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_OPTIONS_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
2369
third_party/acados/include/qpOASES_e/QProblem.h
vendored
Normal file
2369
third_party/acados/include/qpOASES_e/QProblem.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1641
third_party/acados/include/qpOASES_e/QProblemB.h
vendored
Normal file
1641
third_party/acados/include/qpOASES_e/QProblemB.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
310
third_party/acados/include/qpOASES_e/Types.h
vendored
Normal file
310
third_party/acados/include/qpOASES_e/Types.h
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Types.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of all non-built-in types (except for classes).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_TYPES_H
|
||||
#define QPOASES_TYPES_H
|
||||
|
||||
#ifdef USE_ACADOS_TYPES
|
||||
#include "acados/utils/types.h"
|
||||
#endif
|
||||
|
||||
/* If your compiler does not support the snprintf() function,
|
||||
* uncomment the following line and try to compile again. */
|
||||
/* #define __NO_SNPRINTF__ */
|
||||
|
||||
|
||||
/* Uncomment the following line for setting the __DSPACE__ flag. */
|
||||
/* #define __DSPACE__ */
|
||||
|
||||
/* Uncomment the following line for setting the __XPCTARGET__ flag. */
|
||||
/* #define __XPCTARGET__ */
|
||||
|
||||
|
||||
/* Uncomment the following line for setting the __NO_FMATH__ flag. */
|
||||
/* #define __NO_FMATH__ */
|
||||
|
||||
/* Uncomment the following line to enable debug information. */
|
||||
/* #define __DEBUG__ */
|
||||
|
||||
/* Uncomment the following line to enable suppress any kind of console output. */
|
||||
/* #define __SUPPRESSANYOUTPUT__ */
|
||||
|
||||
|
||||
/** Forces to always include all implicitly fixed bounds and all equality constraints
|
||||
* into the initial working set when setting up an auxiliary QP. */
|
||||
#define __ALWAYS_INITIALISE_WITH_ALL_EQUALITIES__
|
||||
|
||||
/* Uncomment the following line to activate the use of an alternative Givens
|
||||
* plane rotation requiring only three multiplications. */
|
||||
/* #define __USE_THREE_MULTS_GIVENS__ */
|
||||
|
||||
/* Uncomment the following line to activate the use of single precision arithmetic. */
|
||||
/* #define __USE_SINGLE_PRECISION__ */
|
||||
|
||||
/* The inline keyword is skipped by default as it is not part of the C90 standard.
|
||||
* However, by uncommenting the following line, use of the inline keyword can be enforced. */
|
||||
/* #define __USE_INLINE__ */
|
||||
|
||||
|
||||
/* Work-around for Borland BCC 5.5 compiler. */
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ < 0x0561
|
||||
#define __STDC__ 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Work-around for Microsoft compilers. */
|
||||
#ifdef _MSC_VER
|
||||
#define __NO_SNPRINTF__
|
||||
#pragma warning( disable : 4061 4100 4250 4514 4996 )
|
||||
#endif
|
||||
|
||||
|
||||
/* Apply pre-processor settings when using qpOASES within auto-generated code. */
|
||||
#ifdef __CODE_GENERATION__
|
||||
#define __NO_COPYRIGHT__
|
||||
#define __EXTERNAL_DIMENSIONS__
|
||||
#endif /* __CODE_GENERATION__ */
|
||||
|
||||
|
||||
/* Avoid using static variables declaration within functions. */
|
||||
#ifdef __NO_STATIC__
|
||||
#define myStatic
|
||||
#else
|
||||
#define myStatic static
|
||||
#endif /* __NO_STATIC__ */
|
||||
|
||||
|
||||
/* Skip inline keyword if not specified otherwise. */
|
||||
#ifndef __USE_INLINE__
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
|
||||
/* Avoid any printing on embedded platforms. */
|
||||
#if defined(__DSPACE__) || defined(__XPCTARGET__)
|
||||
#define __SUPPRESSANYOUTPUT__
|
||||
#define __NO_SNPRINTF__
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __NO_SNPRINTF__
|
||||
#if (!defined(_MSC_VER)) || defined(__DSPACE__) || defined(__XPCTARGET__)
|
||||
/* If snprintf is not available, provide an empty implementation... */
|
||||
int snprintf( char* s, size_t n, const char* format, ... );
|
||||
#else
|
||||
/* ... or substitute snprintf by _snprintf for Microsoft compilers. */
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#endif /* __NO_SNPRINTF__ */
|
||||
|
||||
|
||||
/** Macro for switching on/off the beginning of the qpOASES namespace definition. */
|
||||
#define BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
/** Macro for switching on/off the end of the qpOASES namespace definition. */
|
||||
#define END_NAMESPACE_QPOASES
|
||||
|
||||
/** Macro for switching on/off the use of the qpOASES namespace. */
|
||||
#define USING_NAMESPACE_QPOASES
|
||||
|
||||
/** Macro for switching on/off references to the qpOASES namespace. */
|
||||
#define REFER_NAMESPACE_QPOASES /*::*/
|
||||
|
||||
|
||||
/** Macro for accessing the Cholesky factor R. */
|
||||
#define RR( I,J ) _THIS->R[(I)+nV*(J)]
|
||||
|
||||
/** Macro for accessing the orthonormal matrix Q of the QT factorisation. */
|
||||
#define QQ( I,J ) _THIS->Q[(I)+nV*(J)]
|
||||
|
||||
/** Macro for accessing the triangular matrix T of the QT factorisation. */
|
||||
#define TT( I,J ) _THIS->T[(I)*nVC_min+(J)]
|
||||
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/** Defines real_t for facilitating switching between double and float. */
|
||||
|
||||
#ifndef USE_ACADOS_TYPES
|
||||
#ifndef __CODE_GENERATION__
|
||||
|
||||
#ifdef __USE_SINGLE_PRECISION__
|
||||
typedef float real_t;
|
||||
#else
|
||||
typedef double real_t;
|
||||
#endif /* __USE_SINGLE_PRECISION__ */
|
||||
|
||||
#endif /* __CODE_GENERATION__ */
|
||||
#endif /* USE_ACADOS_TYPES */
|
||||
|
||||
/** Summarises all possible logical values. */
|
||||
typedef enum
|
||||
{
|
||||
BT_FALSE = 0, /**< Logical value for "false". */
|
||||
BT_TRUE /**< Logical value for "true". */
|
||||
} BooleanType;
|
||||
|
||||
|
||||
/** Summarises all possible print levels. Print levels are used to describe
|
||||
* the desired amount of output during runtime of qpOASES. */
|
||||
typedef enum
|
||||
{
|
||||
PL_DEBUG_ITER = -2, /**< Full tabular debugging output. */
|
||||
PL_TABULAR, /**< Tabular output. */
|
||||
PL_NONE, /**< No output. */
|
||||
PL_LOW, /**< Print error messages only. */
|
||||
PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */
|
||||
PL_HIGH /**< Print all messages with full details. */
|
||||
} PrintLevel;
|
||||
|
||||
|
||||
/** Defines visibility status of a message. */
|
||||
typedef enum
|
||||
{
|
||||
VS_HIDDEN, /**< Message not visible. */
|
||||
VS_VISIBLE /**< Message visible. */
|
||||
} VisibilityStatus;
|
||||
|
||||
|
||||
/** Summarises all possible states of the (S)QProblem(B) object during the
|
||||
solution process of a QP sequence. */
|
||||
typedef enum
|
||||
{
|
||||
QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */
|
||||
QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning
|
||||
* via an initial homotopy or after changing the QP matrices. */
|
||||
QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active
|
||||
* set strategy is performed. */
|
||||
QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */
|
||||
QPS_SOLVED /**< The solution of the actual QP was found. */
|
||||
} QProblemStatus;
|
||||
|
||||
|
||||
/** Summarises all possible types of the QP's Hessian matrix. */
|
||||
typedef enum
|
||||
{
|
||||
HST_ZERO, /**< Hessian is zero matrix (i.e. LP formulation). */
|
||||
HST_IDENTITY, /**< Hessian is identity matrix. */
|
||||
HST_POSDEF, /**< Hessian is (strictly) positive definite. */
|
||||
HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */
|
||||
HST_SEMIDEF, /**< Hessian is positive semi-definite. */
|
||||
HST_INDEF, /**< Hessian is indefinite. */
|
||||
HST_UNKNOWN /**< Hessian type is unknown. */
|
||||
} HessianType;
|
||||
|
||||
|
||||
/** Summarises all possible types of bounds and constraints. */
|
||||
typedef enum
|
||||
{
|
||||
ST_UNBOUNDED, /**< Bound/constraint is unbounded. */
|
||||
ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */
|
||||
ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */
|
||||
ST_DISABLED, /**< Bound/constraint is disabled (i.e. ignored when solving QP). */
|
||||
ST_UNKNOWN /**< Type of bound/constraint unknown. */
|
||||
} SubjectToType;
|
||||
|
||||
|
||||
/** Summarises all possible states of bounds and constraints. */
|
||||
typedef enum
|
||||
{
|
||||
ST_LOWER = -1, /**< Bound/constraint is at its lower bound. */
|
||||
ST_INACTIVE, /**< Bound/constraint is inactive. */
|
||||
ST_UPPER, /**< Bound/constraint is at its upper bound. */
|
||||
ST_INFEASIBLE_LOWER, /**< (to be documented) */
|
||||
ST_INFEASIBLE_UPPER, /**< (to be documented) */
|
||||
ST_UNDEFINED /**< Status of bound/constraint undefined. */
|
||||
} SubjectToStatus;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Stores internal information for tabular (debugging) output.
|
||||
*
|
||||
* Struct storing internal information for tabular (debugging) output
|
||||
* when using the (S)QProblem(B) objects.
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2013-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int idxAddB; /**< Index of bound that has been added to working set. */
|
||||
int idxRemB; /**< Index of bound that has been removed from working set. */
|
||||
int idxAddC; /**< Index of constraint that has been added to working set. */
|
||||
int idxRemC; /**< Index of constraint that has been removed from working set. */
|
||||
int excAddB; /**< Flag indicating whether a bound has been added to working set to keep a regular projected Hessian. */
|
||||
int excRemB; /**< Flag indicating whether a bound has been removed from working set to keep a regular projected Hessian. */
|
||||
int excAddC; /**< Flag indicating whether a constraint has been added to working set to keep a regular projected Hessian. */
|
||||
int excRemC; /**< Flag indicating whether a constraint has been removed from working set to keep a regular projected Hessian. */
|
||||
} TabularOutput;
|
||||
|
||||
/**
|
||||
* \brief Struct containing the variable header for mat file.
|
||||
*
|
||||
* Struct storing the header of a variable to be stored in
|
||||
* Matlab's binary format (using the outdated Level 4 variant
|
||||
* for simplictiy).
|
||||
*
|
||||
* Note, this code snippet has been inspired from the document
|
||||
* "Matlab(R) MAT-file Format, R2013b" by MathWorks
|
||||
*
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2013-2015
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
long numericFormat; /**< Flag indicating numerical format. */
|
||||
long nRows; /**< Number of rows. */
|
||||
long nCols; /**< Number of rows. */
|
||||
long imaginaryPart; /**< (to be documented) */
|
||||
long nCharName; /**< Number of character in name. */
|
||||
} MatMatrixHeader;
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_TYPES_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
79
third_party/acados/include/qpOASES_e/UnitTesting.h
vendored
Normal file
79
third_party/acados/include/qpOASES_e/UnitTesting.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/UnitTesting.h
|
||||
* \author Hans Joachim Ferreau
|
||||
* \version 3.1embedded
|
||||
* \date 2014-2015
|
||||
*
|
||||
* Definition of auxiliary functions/macros for unit testing.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_UNIT_TESTING_H
|
||||
#define QPOASES_UNIT_TESTING_H
|
||||
|
||||
|
||||
#ifndef TEST_TOL_FACTOR
|
||||
#define TEST_TOL_FACTOR 1
|
||||
#endif
|
||||
|
||||
|
||||
/** Return value for tests that passed. */
|
||||
#define TEST_PASSED 0
|
||||
|
||||
/** Return value for tests that failed. */
|
||||
#define TEST_FAILED 1
|
||||
|
||||
/** Return value for tests that could not run due to missing external data. */
|
||||
#define TEST_DATA_NOT_FOUND 99
|
||||
|
||||
|
||||
/** Macro verifying that two numerical values are equal in order to pass unit test. */
|
||||
#define QPOASES_TEST_FOR_EQUAL( x,y ) if ( REFER_NAMESPACE_QPOASES isEqual( (x),(y) ) == BT_FALSE ) { return TEST_FAILED; }
|
||||
|
||||
/** Macro verifying that two numerical values are close to each other in order to pass unit test. */
|
||||
#define QPOASES_TEST_FOR_NEAR( x,y ) if ( REFER_NAMESPACE_QPOASES getAbs((x)-(y)) / REFER_NAMESPACE_QPOASES getMax( 1.0,REFER_NAMESPACE_QPOASES getAbs(x) ) >= 1e-10 ) { return TEST_FAILED; }
|
||||
|
||||
/** Macro verifying that first quantity is lower or equal than second one in order to pass unit test. */
|
||||
#define QPOASES_TEST_FOR_TOL( x,tol ) if ( (x) > (tol)*(TEST_TOL_FACTOR) ) { return TEST_FAILED; }
|
||||
|
||||
/** Macro verifying that a logical expression holds in order to pass unit test. */
|
||||
#define QPOASES_TEST_FOR_TRUE( x ) if ( (x) == 0 ) { return TEST_FAILED; }
|
||||
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_UNIT_TESTING_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
500
third_party/acados/include/qpOASES_e/Utils.h
vendored
Normal file
500
third_party/acados/include/qpOASES_e/Utils.h
vendored
Normal file
@@ -0,0 +1,500 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/Utils.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of some utilities for working with the different QProblem classes.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_UTILS_H
|
||||
#define QPOASES_UTILS_H
|
||||
|
||||
#include <qpOASES_e/MessageHandling.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
/** Prints a vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printV( const real_t* const v, /**< Vector to be printed. */
|
||||
int n /**< Length of vector. */
|
||||
);
|
||||
|
||||
/** Prints a permuted vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printPV( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const int* const V_idx /**< Pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named vector.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printNV( const real_t* const v, /**< Vector to be printed. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* name /** Name of vector. */
|
||||
);
|
||||
|
||||
/** Prints a matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printM( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol /**< Column number of matrix. */
|
||||
);
|
||||
|
||||
/** Prints a permuted matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printPM( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol , /**< Column number of matrix. */
|
||||
const int* const ROW_idx, /**< Row pemutation vector. */
|
||||
const int* const COL_idx /**< Column pemutation vector. */
|
||||
);
|
||||
|
||||
/** Prints a named matrix.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printNM( const real_t* const M, /**< Matrix to be printed. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* name /** Name of matrix. */
|
||||
);
|
||||
|
||||
/** Prints an index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printI( const int* const _index, /**< Index array to be printed. */
|
||||
int n /**< Length of index array. */
|
||||
);
|
||||
|
||||
/** Prints a named index array.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printNI( const int* const _index, /**< Index array to be printed. */
|
||||
int n, /**< Length of index array. */
|
||||
const char* name /**< Name of index array. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints a string to desired output target (useful also for MATLAB output!).
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_myPrintf( const char* s /**< String to be written. */
|
||||
);
|
||||
|
||||
|
||||
/** Prints qpOASES copyright notice.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_printCopyrightNotice( );
|
||||
|
||||
|
||||
/** Reads a real_t matrix from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue qpOASES_readFromFileM( real_t* data, /**< Matrix to be read from file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads a real_t vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue qpOASES_readFromFileV( real_t* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
/** Reads an integer (column) vector from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE \n
|
||||
RET_UNABLE_TO_READ_FILE */
|
||||
returnValue qpOASES_readFromFileI( int* data, /**< Vector to be read from file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename /**< Data file name. */
|
||||
);
|
||||
|
||||
|
||||
/** Writes a real_t matrix into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue qpOASES_writeIntoFileM( const real_t* const data, /**< Matrix to be written into file. */
|
||||
int nrow, /**< Row number of matrix. */
|
||||
int ncol, /**< Column number of matrix. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes a real_t vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue qpOASES_writeIntoFileV( const real_t* const data, /**< Vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes an integer (column) vector into a file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_OPEN_FILE */
|
||||
returnValue qpOASES_writeIntoFileI( const int* const integer, /**< Integer vector to be written into file. */
|
||||
int n, /**< Length of vector. */
|
||||
const char* datafilename, /**< Data file name. */
|
||||
BooleanType append /**< Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). */
|
||||
);
|
||||
|
||||
/** Writes a real_t matrix/vector into a Matlab binary file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS
|
||||
RET_UNABLE_TO_WRITE_FILE */
|
||||
returnValue qpOASES_writeIntoMatFile( FILE* const matFile, /**< Pointer to Matlab binary file. */
|
||||
const real_t* const data, /**< Data to be written into file. */
|
||||
int nRows, /**< Row number of matrix. */
|
||||
int nCols, /**< Column number of matrix. */
|
||||
const char* name /**< Matlab name of matrix/vector to be stored. */
|
||||
);
|
||||
|
||||
/** Writes in integer matrix/vector into a Matlab binary file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS
|
||||
RET_UNABLE_TO_WRITE_FILE */
|
||||
returnValue qpOASES_writeIntoMatFileI( FILE* const matFile, /**< Pointer to Matlab binary file. */
|
||||
const int* const data, /**< Data to be written into file. */
|
||||
int nRows, /**< Row number of matrix. */
|
||||
int nCols, /**< Column number of matrix. */
|
||||
const char* name /**< Matlab name of matrix/vector to be stored. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the current system time.
|
||||
* \return current system time */
|
||||
real_t qpOASES_getCPUtime( );
|
||||
|
||||
|
||||
/** Returns the N-norm of a vector.
|
||||
* \return >= 0.0: successful */
|
||||
real_t qpOASES_getNorm( const real_t* const v, /**< Vector. */
|
||||
int n, /**< Vector's dimension. */
|
||||
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
|
||||
);
|
||||
|
||||
/** Tests whether two real-valued arguments are (numerically) equal.
|
||||
* \return BT_TRUE: arguments differ not more than TOL \n
|
||||
BT_FALSE: arguments differ more than TOL */
|
||||
static inline BooleanType qpOASES_isEqual( real_t x, /**< First real number. */
|
||||
real_t y, /**< Second real number. */
|
||||
real_t TOL /**< Tolerance for comparison. */
|
||||
);
|
||||
|
||||
|
||||
/** Tests whether a real-valued argument is (numerically) zero.
|
||||
* \return BT_TRUE: argument differs from 0.0 not more than TOL \n
|
||||
BT_FALSE: argument differs from 0.0 more than TOL */
|
||||
static inline BooleanType qpOASES_isZero( real_t x, /**< Real number. */
|
||||
real_t TOL /**< Tolerance for comparison. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns sign of a real-valued argument.
|
||||
* \return 1.0: argument is non-negative \n
|
||||
-1.0: argument is negative */
|
||||
static inline real_t qpOASES_getSign( real_t arg /**< real-valued argument whose sign is to be determined. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns maximum of two integers.
|
||||
* \return Maximum of two integers */
|
||||
static inline int qpOASES_getMaxI( int x, /**< First integer. */
|
||||
int y /**< Second integer. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns minimum of two integers.
|
||||
* \return Minimum of two integers */
|
||||
static inline int qpOASES_getMinI( int x, /**< First integer. */
|
||||
int y /**< Second integer. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns maximum of two reals.
|
||||
* \return Maximum of two reals */
|
||||
static inline real_t qpOASES_getMax( real_t x, /**< First real number. */
|
||||
real_t y /**< Second real number. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns minimum of two reals.
|
||||
* \return Minimum of two reals */
|
||||
static inline real_t qpOASES_getMin( real_t x, /**< First real number. */
|
||||
real_t y /**< Second real number. */
|
||||
);
|
||||
|
||||
|
||||
/** Returns the absolute value of a real_t-valued argument.
|
||||
* \return Absolute value of a real_t-valued argument */
|
||||
static inline real_t qpOASES_getAbs( real_t x /**< real_t-valued argument. */
|
||||
);
|
||||
|
||||
/** Returns the square-root of a real number.
|
||||
* \return Square-root of a real number */
|
||||
static inline real_t qpOASES_getSqrt( real_t x /**< Non-negative real number. */
|
||||
);
|
||||
|
||||
|
||||
/** Computes the maximum violation of the KKT optimality conditions
|
||||
* of given iterate for given QP data. */
|
||||
returnValue qpOASES_getKktViolation( int nV, /**< Number of variables. */
|
||||
int nC, /**< Number of constraints. */
|
||||
const real_t* const H, /**< Hessian matrix (may be NULL if Hessian is zero or identity matrix). */
|
||||
const real_t* const g, /**< Gradient vector. */
|
||||
const real_t* const A, /**< Constraint matrix. */
|
||||
const real_t* const lb, /**< Lower bound vector (on variables). */
|
||||
const real_t* const ub, /**< Upper bound vector (on variables). */
|
||||
const real_t* const lbA, /**< Lower constraints' bound vector. */
|
||||
const real_t* const ubA, /**< Upper constraints' bound vector. */
|
||||
const real_t* const x, /**< Primal trial vector. */
|
||||
const real_t* const y, /**< Dual trial vector. */
|
||||
real_t* const _stat, /**< Output: maximum value of stationarity condition residual. */
|
||||
real_t* const feas, /**< Output: maximum value of primal feasibility violation. */
|
||||
real_t* const cmpl /**< Output: maximum value of complementarity residual. */
|
||||
);
|
||||
|
||||
/** Computes the maximum violation of the KKT optimality conditions
|
||||
* of given iterate for given QP data. */
|
||||
returnValue qpOASES_getKktViolationSB( int nV, /**< Number of variables. */
|
||||
const real_t* const H, /**< Hessian matrix (may be NULL if Hessian is zero or identity matrix). */
|
||||
const real_t* const g, /**< Gradient vector. */
|
||||
const real_t* const lb, /**< Lower bound vector (on variables). */
|
||||
const real_t* const ub, /**< Upper bound vector (on variables). */
|
||||
const real_t* const x, /**< Primal trial vector. */
|
||||
const real_t* const y, /**< Dual trial vector. */
|
||||
real_t* const _stat, /**< Output: maximum value of stationarity condition residual. */
|
||||
real_t* const feas, /**< Output: maximum value of primal feasibility violation. */
|
||||
real_t* const cmpl /**< Output: maximum value of complementarity residual. */
|
||||
);
|
||||
|
||||
|
||||
/** Writes a value of BooleanType into a string.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_convertBooleanTypeToString( BooleanType value, /**< Value to be written. */
|
||||
char* const string /**< Input: String of sufficient size, \n
|
||||
Output: String containing value. */
|
||||
);
|
||||
|
||||
/** Writes a value of SubjectToStatus into a string.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_convertSubjectToStatusToString( SubjectToStatus value, /**< Value to be written. */
|
||||
char* const string /**< Input: String of sufficient size, \n
|
||||
Output: String containing value. */
|
||||
);
|
||||
|
||||
/** Writes a value of PrintLevel into a string.
|
||||
* \return SUCCESSFUL_RETURN */
|
||||
returnValue qpOASES_convertPrintLevelToString( PrintLevel value, /**< Value to be written. */
|
||||
char* const string /**< Input: String of sufficient size, \n
|
||||
Output: String containing value. */
|
||||
);
|
||||
|
||||
|
||||
/** Converts a returnValue from an QProblem(B) object into a more
|
||||
* simple status flag.
|
||||
*
|
||||
* \return 0: QP problem solved
|
||||
* 1: QP could not be solved within given number of iterations
|
||||
* -1: QP could not be solved due to an internal error
|
||||
* -2: QP is infeasible (and thus could not be solved)
|
||||
* -3: QP is unbounded (and thus could not be solved)
|
||||
*/
|
||||
int qpOASES_getSimpleStatus( returnValue returnvalue, /**< ReturnValue to be analysed. */
|
||||
BooleanType doPrintStatus /**< Flag indicating whether simple status shall be printed to screen. */
|
||||
);
|
||||
|
||||
/** Normalises QP constraints.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
* RET_INVALID_ARGUMENTS */
|
||||
returnValue qpOASES_normaliseConstraints( int nV, /**< Number of variables. */
|
||||
int nC, /**< Number of constraints. */
|
||||
real_t* A, /**< Input: Constraint matrix, \n
|
||||
Output: Normalised constraint matrix. */
|
||||
real_t* lbA, /**< Input: Constraints' lower bound vector, \n
|
||||
Output: Normalised constraints' lower bound vector. */
|
||||
real_t* ubA, /**< Input: Constraints' upper bound vector, \n
|
||||
Output: Normalised constraints' upper bound vector. */
|
||||
int type /**< Norm type, 1: one-norm, 2: Euclidean norm. */
|
||||
);
|
||||
|
||||
|
||||
#ifdef __DEBUG__
|
||||
/** Writes matrix with given dimension into specified file. */
|
||||
void gdb_printmat( const char *fname, /**< File name. */
|
||||
real_t *M, /**< Matrix to be written. */
|
||||
int n, /**< Number of rows. */
|
||||
int m, /**< Number of columns. */
|
||||
int ldim /**< Leading dimension. */
|
||||
);
|
||||
#endif /* __DEBUG__ */
|
||||
|
||||
|
||||
#if defined(__DSPACE__) || defined(__XPCTARGET__)
|
||||
void __cxa_pure_virtual( void );
|
||||
#endif /* __DSPACE__ || __XPCTARGET__*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* i s E q u a l
|
||||
*/
|
||||
static inline BooleanType qpOASES_isEqual( real_t x,
|
||||
real_t y,
|
||||
real_t TOL
|
||||
)
|
||||
{
|
||||
if ( qpOASES_getAbs(x-y) <= TOL )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* i s Z e r o
|
||||
*/
|
||||
static inline BooleanType qpOASES_isZero( real_t x,
|
||||
real_t TOL
|
||||
)
|
||||
{
|
||||
if ( qpOASES_getAbs(x) <= TOL )
|
||||
return BT_TRUE;
|
||||
else
|
||||
return BT_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t S i g n
|
||||
*/
|
||||
static inline real_t qpOASES_getSign( real_t arg
|
||||
)
|
||||
{
|
||||
if ( arg >= 0.0 )
|
||||
return 1.0;
|
||||
else
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* g e t M a x
|
||||
*/
|
||||
static inline int qpOASES_getMaxI( int x,
|
||||
int y
|
||||
)
|
||||
{
|
||||
return (y<x) ? x : y;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t M i n
|
||||
*/
|
||||
static inline int qpOASES_getMinI( int x,
|
||||
int y
|
||||
)
|
||||
{
|
||||
return (y>x) ? x : y;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t M a x
|
||||
*/
|
||||
static inline real_t qpOASES_getMax( real_t x,
|
||||
real_t y
|
||||
)
|
||||
{
|
||||
#ifdef __NO_FMATH__
|
||||
return (y<x) ? x : y;
|
||||
#else
|
||||
return (y<x) ? x : y;
|
||||
/*return fmax(x,y); seems to be slower */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t M i n
|
||||
*/
|
||||
static inline real_t qpOASES_getMin( real_t x,
|
||||
real_t y
|
||||
)
|
||||
{
|
||||
#ifdef __NO_FMATH__
|
||||
return (y>x) ? x : y;
|
||||
#else
|
||||
return (y>x) ? x : y;
|
||||
/*return fmin(x,y); seems to be slower */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* g e t A b s
|
||||
*/
|
||||
static inline real_t qpOASES_getAbs( real_t x
|
||||
)
|
||||
{
|
||||
#ifdef __NO_FMATH__
|
||||
return (x>=0.0) ? x : -x;
|
||||
#else
|
||||
return fabs(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* g e t S q r t
|
||||
*/
|
||||
static inline real_t qpOASES_getSqrt( real_t x
|
||||
)
|
||||
{
|
||||
#ifdef __NO_FMATH__
|
||||
return sqrt(x); /* put your custom sqrt-replacement here */
|
||||
#else
|
||||
return sqrt(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_UTILS_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
227
third_party/acados/include/qpOASES_e/extras/OQPinterface.h
vendored
Normal file
227
third_party/acados/include/qpOASES_e/extras/OQPinterface.h
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* This file is part of qpOASES.
|
||||
*
|
||||
* qpOASES -- An Implementation of the Online Active Set Strategy.
|
||||
* Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
|
||||
* Christian Kirches et al. All rights reserved.
|
||||
*
|
||||
* qpOASES 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* qpOASES 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 qpOASES; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file include/qpOASES_e/extras/OQPinterface.h
|
||||
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
|
||||
* \version 3.1embedded
|
||||
* \date 2007-2015
|
||||
*
|
||||
* Declaration of an interface comprising several utility functions
|
||||
* for solving test problems from the Online QP Benchmark Collection
|
||||
* (This collection is no longer maintained, see
|
||||
* http://www.qpOASES.org/onlineQP for a backup).
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QPOASES_OQPINTERFACE_H
|
||||
#define QPOASES_OQPINTERFACE_H
|
||||
|
||||
|
||||
#include <qpOASES_e/Utils.h>
|
||||
#include <qpOASES_e/Options.h>
|
||||
|
||||
#include <qpOASES_e/QProblemB.h>
|
||||
#include <qpOASES_e/QProblem.h>
|
||||
|
||||
|
||||
BEGIN_NAMESPACE_QPOASES
|
||||
|
||||
typedef struct {
|
||||
QProblem *qp;
|
||||
|
||||
DenseMatrix *H;
|
||||
DenseMatrix *A;
|
||||
|
||||
real_t *x;
|
||||
real_t *y;
|
||||
} OQPbenchmark_ws;
|
||||
|
||||
int OQPbenchmark_ws_calculateMemorySize( unsigned int nV, unsigned int nC );
|
||||
|
||||
char *OQPbenchmark_ws_assignMemory( unsigned int nV, unsigned int nC, OQPbenchmark_ws **mem, void *raw_memory );
|
||||
|
||||
OQPbenchmark_ws *OQPbenchmark_ws_createMemory( unsigned int nV, unsigned int nC );
|
||||
|
||||
typedef struct {
|
||||
QProblemB *qp;
|
||||
|
||||
DenseMatrix *H;
|
||||
|
||||
real_t *x;
|
||||
real_t *y;
|
||||
} OQPbenchmarkB_ws;
|
||||
|
||||
int OQPbenchmarkB_ws_calculateMemorySize( unsigned int nV );
|
||||
|
||||
char *OQPbenchmarkB_ws_assignMemory( unsigned int nV, OQPbenchmarkB_ws **mem, void *raw_memory );
|
||||
|
||||
OQPbenchmarkB_ws *OQPbenchmarkB_ws_createMemory( unsigned int nV );
|
||||
|
||||
typedef struct {
|
||||
OQPbenchmark_ws *qp_ws;
|
||||
OQPbenchmarkB_ws *qpB_ws;
|
||||
|
||||
real_t *H;
|
||||
real_t *g;
|
||||
real_t *A;
|
||||
real_t *lb;
|
||||
real_t *ub;
|
||||
real_t *lbA;
|
||||
real_t *ubA;
|
||||
} OQPinterface_ws;
|
||||
|
||||
int OQPinterface_ws_calculateMemorySize( unsigned int nV, unsigned int nC, unsigned int nQP );
|
||||
|
||||
char *OQPinterface_ws_assignMemory( unsigned int nV, unsigned int nC, unsigned int nQP, OQPinterface_ws **mem, void *raw_memory );
|
||||
|
||||
OQPinterface_ws *OQPinterface_ws_createMemory( unsigned int nV, unsigned int nC, unsigned int nQP );
|
||||
|
||||
/** Reads dimensions of an Online QP Benchmark problem from file.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_READ_FILE \n
|
||||
RET_FILEDATA_INCONSISTENT */
|
||||
returnValue readOQPdimensions( const char* path, /**< Full path of the data files (without trailing slash!). */
|
||||
int* nQP, /**< Output: Number of QPs. */
|
||||
int* nV, /**< Output: Number of variables. */
|
||||
int* nC, /**< Output: Number of constraints. */
|
||||
int* nEC /**< Output: Number of equality constraints. */
|
||||
);
|
||||
|
||||
/** Reads data of an Online QP Benchmark problem from file.
|
||||
* This function allocates the required memory for all data; after successfully calling it,
|
||||
* you have to free this memory yourself!
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_INVALID_ARGUMENTS \n
|
||||
RET_UNABLE_TO_READ_FILE \n
|
||||
RET_FILEDATA_INCONSISTENT */
|
||||
returnValue readOQPdata( const char* path, /**< Full path of the data files (without trailing slash!). */
|
||||
int* nQP, /**< Output: Number of QPs. */
|
||||
int* nV, /**< Output: Number of variables. */
|
||||
int* nC, /**< Output: Number of constraints. */
|
||||
int* nEC, /**< Output: Number of equality constraints. */
|
||||
real_t* H, /**< Output: Hessian matrix. */
|
||||
real_t* g, /**< Output: Sequence of gradient vectors. */
|
||||
real_t* A, /**< Output: Constraint matrix. */
|
||||
real_t* lb, /**< Output: Sequence of lower bound vectors (on variables). */
|
||||
real_t* ub, /**< Output: Sequence of upper bound vectors (on variables). */
|
||||
real_t* lbA, /**< Output: Sequence of lower constraints' bound vectors. */
|
||||
real_t* ubA, /**< Output: Sequence of upper constraints' bound vectors. */
|
||||
real_t* xOpt, /**< Output: Sequence of primal solution vectors
|
||||
* (not read if a null pointer is passed). */
|
||||
real_t* yOpt, /**< Output: Sequence of dual solution vectors
|
||||
* (not read if a null pointer is passed). */
|
||||
real_t* objOpt /**< Output: Sequence of optimal objective function values
|
||||
* (not read if a null pointer is passed). */
|
||||
);
|
||||
|
||||
|
||||
/** Solves an Online QP Benchmark problem as specified by the arguments.
|
||||
* The maximum deviations from the given optimal solution as well as the
|
||||
* maximum CPU time to solve each QP are determined.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_BENCHMARK_ABORTED */
|
||||
returnValue solveOQPbenchmark( int nQP, /**< Number of QPs. */
|
||||
int nV, /**< Number of variables. */
|
||||
int nC, /**< Number of constraints. */
|
||||
int nEC, /**< Number of equality constraints. */
|
||||
real_t* _H, /**< Hessian matrix. */
|
||||
const real_t* const g, /**< Sequence of gradient vectors. */
|
||||
real_t* _A, /**< Constraint matrix. */
|
||||
const real_t* const lb, /**< Sequence of lower bound vectors (on variables). */
|
||||
const real_t* const ub, /**< Sequence of upper bound vectors (on variables). */
|
||||
const real_t* const lbA, /**< Sequence of lower constraints' bound vectors. */
|
||||
const real_t* const ubA, /**< Sequence of upper constraints' bound vectors. */
|
||||
BooleanType isSparse, /**< Shall convert matrices to sparse format before solution? */
|
||||
BooleanType useHotstarts, /**< Shall QP solution be hotstarted? */
|
||||
const Options* options, /**< QP solver options to be used while solving benchmark problems. */
|
||||
int maxAllowedNWSR, /**< Maximum number of working set recalculations to be performed. */
|
||||
real_t* maxNWSR, /**< Output: Maximum number of performed working set recalculations. */
|
||||
real_t* avgNWSR, /**< Output: Average number of performed working set recalculations. */
|
||||
real_t* maxCPUtime, /**< Output: Maximum CPU time required for solving each QP. */
|
||||
real_t* avgCPUtime, /**< Output: Average CPU time required for solving each QP. */
|
||||
real_t* maxStationarity, /**< Output: Maximum residual of stationarity condition. */
|
||||
real_t* maxFeasibility, /**< Output: Maximum residual of primal feasibility condition. */
|
||||
real_t* maxComplementarity, /**< Output: Maximum residual of complementarity condition. */
|
||||
OQPbenchmark_ws *work /**< Workspace. */
|
||||
);
|
||||
|
||||
/** Solves an Online QP Benchmark problem (without constraints) as specified
|
||||
* by the arguments. The maximum deviations from the given optimal solution
|
||||
* as well as the maximum CPU time to solve each QP are determined.
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_BENCHMARK_ABORTED */
|
||||
returnValue solveOQPbenchmarkB( int nQP, /**< Number of QPs. */
|
||||
int nV, /**< Number of variables. */
|
||||
real_t* _H, /**< Hessian matrix. */
|
||||
const real_t* const g, /**< Sequence of gradient vectors. */
|
||||
const real_t* const lb, /**< Sequence of lower bound vectors (on variables). */
|
||||
const real_t* const ub, /**< Sequence of upper bound vectors (on variables). */
|
||||
BooleanType isSparse, /**< Shall convert matrices to sparse format before solution? */
|
||||
BooleanType useHotstarts, /**< Shall QP solution be hotstarted? */
|
||||
const Options* options, /**< QP solver options to be used while solving benchmark problems. */
|
||||
int maxAllowedNWSR, /**< Maximum number of working set recalculations to be performed. */
|
||||
real_t* maxNWSR, /**< Output: Maximum number of performed working set recalculations. */
|
||||
real_t* avgNWSR, /**< Output: Average number of performed working set recalculations. */
|
||||
real_t* maxCPUtime, /**< Output: Maximum CPU time required for solving each QP. */
|
||||
real_t* avgCPUtime, /**< Output: Average CPU time required for solving each QP. */
|
||||
real_t* maxStationarity, /**< Output: Maximum residual of stationarity condition. */
|
||||
real_t* maxFeasibility, /**< Output: Maximum residual of primal feasibility condition. */
|
||||
real_t* maxComplementarity, /**< Output: Maximum residual of complementarity condition. */
|
||||
OQPbenchmarkB_ws *work /**< Workspace. */
|
||||
);
|
||||
|
||||
|
||||
/** Runs an Online QP Benchmark problem and determines the maximum
|
||||
* violation of the KKT optimality conditions as well as the
|
||||
* maximum and average number of iterations and CPU time to solve
|
||||
* each QP.
|
||||
*
|
||||
* \return SUCCESSFUL_RETURN \n
|
||||
RET_UNABLE_TO_READ_BENCHMARK \n
|
||||
RET_BENCHMARK_ABORTED */
|
||||
returnValue runOQPbenchmark( const char* path, /**< Full path of the benchmark files (without trailing slash!). */
|
||||
BooleanType isSparse, /**< Shall convert matrices to sparse format before solution? */
|
||||
BooleanType useHotstarts, /**< Shall QP solution be hotstarted? */
|
||||
const Options* options, /**< QP solver options to be used while solving benchmark problems. */
|
||||
int maxAllowedNWSR, /**< Maximum number of working set recalculations to be performed. */
|
||||
real_t* maxNWSR, /**< Output: Maximum number of performed working set recalculations. */
|
||||
real_t* avgNWSR, /**< Output: Average number of performed working set recalculations. */
|
||||
real_t* maxCPUtime, /**< Output: Maximum CPU time required for solving each QP. */
|
||||
real_t* avgCPUtime, /**< Output: Average CPU time required for solving each QP. */
|
||||
real_t* maxStationarity, /**< Output: Maximum residual of stationarity condition. */
|
||||
real_t* maxFeasibility, /**< Output: Maximum residual of primal feasibility condition. */
|
||||
real_t* maxComplementarity, /**< Output: Maximum residual of complementarity condition. */
|
||||
OQPinterface_ws* work /**< Workspace. */
|
||||
);
|
||||
|
||||
END_NAMESPACE_QPOASES
|
||||
|
||||
|
||||
#endif /* QPOASES_OQPINTERFACE_H */
|
||||
|
||||
|
||||
/*
|
||||
* end of file
|
||||
*/
|
||||
Reference in New Issue
Block a user