mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-30 19:33:42 +08:00
dragonpilot beta3
date: 2023-10-09T10:55:55 commit: 91b6e3aecd7170f24bccacb10c515ec281c30295
This commit is contained in:
+134
-134
@@ -1,134 +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
|
||||
*/
|
||||
/*
|
||||
* 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
-62
@@ -1,62 +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 */
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
+221
-221
@@ -1,221 +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
|
||||
*/
|
||||
/*
|
||||
* 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
-287
@@ -1,287 +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 */
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
+153
-153
@@ -1,153 +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
|
||||
*/
|
||||
/*
|
||||
* 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
-2369
File diff suppressed because it is too large
Load Diff
+310
-310
@@ -1,310 +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
|
||||
*/
|
||||
/*
|
||||
* 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
-79
@@ -1,79 +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
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user