提交 93cc709d 编写于 作者: L Lei Wang 提交者: Dong Li

Add qpoases lib. (#56)

上级 e5c30555
......@@ -31,15 +31,6 @@ new_http_archive(
url = "https://github.com/google/glog/archive/v0.3.5.tar.gz",
)
# qpOASES
new_http_archive(
name = "qp_oases",
build_file = "third_party/qp_oases.BUILD",
sha256 = "ae15eee80455c26d0c26078498893582b67b1d71df18f14f12591023561e5f88",
strip_prefix = "qpOASES-3.2.1",
url = "https://www.coin-or.org/download/source/qpOASES/qpOASES-3.2.1.zip",
)
# Google Benchmark
new_http_archive(
name = "benchmark",
......
......@@ -27,7 +27,7 @@ cc_library(
":qp_solver",
"//modules/planning/common:planning_gflags",
"@eigen//:eigen",
"@qp_oases//:qp_oases",
"//third_party/qp_oases",
],
)
......
......@@ -22,7 +22,6 @@
#include <algorithm>
#include <climits>
#include <vector>
#include "include/qpOASES.hpp"
#include "modules/planning/common/planning_gflags.h"
......
......@@ -21,7 +21,7 @@
#ifndef MODULES_PLANNING_MATH_QP_SOLVER_ACTIVE_SET_QP_SOLVER_H_
#define MODULES_PLANNING_MATH_QP_SOLVER_ACTIVE_SET_QP_SOLVER_H_
#include "include/qpOASES.hpp"
#include "qpOASES/include/qpOASES.hpp"
#include "modules/planning/math/qp_solver/qp_solver.h"
......
licenses(["notice"])
exports_files(["googletest/LICENSE"])
cc_library(
name = "qp_oases",
includes = [
".",
"include",
"src",
],
srcs = [
"src/BLASReplacement.cpp",
"src/Bounds.cpp",
"src/Constraints.cpp",
"src/Flipper.cpp",
"src/Indexlist.cpp",
"src/LAPACKReplacement.cpp",
"src/Matrices.cpp",
"src/MessageHandling.cpp",
"src/Options.cpp",
"src/OQPinterface.cpp",
"src/QProblemB.cpp",
"src/QProblem.cpp",
"src/SolutionAnalysis.cpp",
"src/SparseSolver.cpp",
"src/SQProblem.cpp",
"src/SQProblemSchur.cpp",
"src/SubjectTo.cpp",
"src/Utils.cpp",
],
hdrs = [
"include/qpOASES/Types.hpp",
"include/qpOASES/SQProblemSchur.ipp",
"include/qpOASES/Matrices.hpp",
"include/qpOASES/Constraints.ipp",
"include/qpOASES/MessageHandling.ipp",
"include/qpOASES/QProblem.ipp",
"include/qpOASES/Utils.hpp",
"include/qpOASES/Constraints.hpp",
"include/qpOASES/Indexlist.hpp",
"include/qpOASES/Options.hpp",
"include/qpOASES/SparseSolver.hpp",
"include/qpOASES/QProblemB.ipp",
"include/qpOASES/UnitTesting.hpp",
"include/qpOASES/ConstraintProduct.hpp",
"include/qpOASES/Indexlist.ipp",
"include/qpOASES/LapackBlasReplacement.hpp",
"include/qpOASES/Flipper.hpp",
"include/qpOASES/QProblem.hpp",
"include/qpOASES/Constants.hpp",
"include/qpOASES/SQProblem.ipp",
"include/qpOASES/Utils.ipp",
"include/qpOASES/Bounds.ipp",
"include/qpOASES/Bounds.hpp",
"include/qpOASES/SQProblem.hpp",
"include/qpOASES/SQProblemSchur.hpp",
"include/qpOASES/SubjectTo.ipp",
"include/qpOASES/SubjectTo.hpp",
"include/qpOASES/extras/OQPinterface.hpp",
"include/qpOASES/extras/SolutionAnalysis.hpp",
"include/qpOASES/extras/SolutionAnalysis.ipp",
"include/qpOASES/MessageHandling.hpp",
"include/qpOASES/QProblemB.hpp",
"include/qpOASES.hpp",
],
copts = [
"-Wall",
"-pedantic",
"-Wshadow",
"-Wfloat-equal",
"-O3",
"-Wconversion",
"-Wsign-conversion",
"-fPIC",
"-DLINUX",
"-D__USE_LONG_INTEGERS__",
"-D__USE_LONG_FINTS__",
"-DSOLVER_NONE",
"-D__NO_COPYRIGHT__",
],
visibility = ["//visibility:public"],
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
cc_library(
name = "qp_oases",
srcs = [
"lib/libqpOASES.so",
],
hdrs = glob([
"include/**",
]),
includes = ["include"],
include_prefix = "qpOASES",
)
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*/
#if defined(__SINGLE_OBJECT__) || defined(__C_WRAPPER__)
#include <MessageHandling.cpp>
#include <Utils.cpp>
#include <Indexlist.cpp>
#include <SubjectTo.cpp>
#include <Bounds.cpp>
#include <Constraints.cpp>
#if !defined(__MATLAB__) || defined(WIN32)
#include <BLASReplacement.cpp>
#include <LAPACKReplacement.cpp>
#endif
#include <Matrices.cpp>
#include <Options.cpp>
#include <QProblemB.cpp>
#include <Flipper.cpp>
#include <QProblem.cpp>
#include <SQProblem.cpp>
#if defined(SOLVER_MA27) || defined(SOLVER_MA57)
#include <SparseSolver.cpp>
#include <SQProblemSchur.cpp>
#endif
#if !defined(__C_WRAPPER__) && !defined(__MATLAB__)
#include <OQPinterface.cpp>
#include <SolutionAnalysis.cpp>
#endif
#else /* default compilation mode */
#include <qpOASES/QProblemB.hpp>
#include <qpOASES/QProblem.hpp>
#include <qpOASES/SQProblem.hpp>
#include <qpOASES/SQProblemSchur.hpp>
#include <qpOASES/extras/OQPinterface.hpp>
#include <qpOASES/extras/SolutionAnalysis.hpp>
#endif
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Bounds.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of the Bounds class designed to manage working sets of
* bounds within a QProblem.
*/
#ifndef QPOASES_BOUNDS_HPP
#define QPOASES_BOUNDS_HPP
#include <qpOASES/SubjectTo.hpp>
BEGIN_NAMESPACE_QPOASES
/**
* \brief Manages working sets of bounds (i.e. box constraints).
*
* This class manages working sets of bounds (= box constraints)
* by storing index sets and other status information.
*
* \author Hans Joachim Ferreau
* \version 3.2
* \date 2007-2017
*/
class Bounds : public SubjectTo
{
/*
* PUBLIC MEMBER FUNCTIONS
*/
public:
/** Default constructor. */
Bounds( );
/** Constructor which takes the number of bounds. */
Bounds( int_t _n /**< Number of bounds. */
);
/** Copy constructor (deep copy). */
Bounds( const Bounds& rhs /**< Rhs object. */
);
/** Destructor. */
virtual ~Bounds( );
/** Assignment operator (deep copy). */
Bounds& operator=( const Bounds& rhs /**< Rhs object. */
);
/** Initialises object with given number of bounds.
* \return SUCCESSFUL_RETURN \n
RET_INVALID_ARGUMENTS */
returnValue init( int_t _n = 0 /**< Number of bounds. */
);
/** Initially adds number of a new (i.e. not yet in the list) bound to
* given index set.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_BOUND_FAILED \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_INVALID_ARGUMENTS */
returnValue setupBound( int_t number, /**< Number of new bound. */
SubjectToStatus _status /**< Status of new bound. */
);
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
* to the index set of free bounds; the order depends on the SujectToType
* of each index.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_BOUND_FAILED */
returnValue setupAllFree( );
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
* to the index set of fixed bounds (on their lower bounds);
* the order depends on the SujectToType of each index.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_BOUND_FAILED */
returnValue setupAllLower( );
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
* to the index set of fixed bounds (on their upper bounds);
* the order depends on the SujectToType of each index.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_BOUND_FAILED */
returnValue setupAllUpper( );
/** Moves index of a bound from index list of fixed to that of free bounds.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_BOUND_FAILED \n
RET_INDEX_OUT_OF_BOUNDS */
returnValue moveFixedToFree( int_t number /**< Number of bound to be freed. */
);
/** Moves index of a bound from index list of free to that of fixed bounds.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_BOUND_FAILED \n
RET_INDEX_OUT_OF_BOUNDS */
returnValue moveFreeToFixed( int_t number, /**< Number of bound to be fixed. */
SubjectToStatus _status /**< Status of bound to be fixed. */
);
/** Flip fixed bound.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_BOUND_FAILED \n
RET_INDEX_OUT_OF_BOUNDS */
returnValue flipFixed( int_t number );
/** Swaps the indices of two free bounds within the index set.
* \return SUCCESSFUL_RETURN \n
RET_SWAPINDEX_FAILED */
returnValue swapFree( int_t number1, /**< Number of first constraint or bound. */
int_t number2 /**< Number of second constraint or bound. */
);
/** Returns number of variables.
* \return Number of variables. */
inline int_t getNV( ) const;
/** Returns number of implicitly fixed variables.
* \return Number of implicitly fixed variables. */
inline int_t getNFV( ) const;
/** Returns number of bounded (but possibly free) variables.
* \return Number of bounded (but possibly free) variables. */
inline int_t getNBV( ) const;
/** Returns number of unbounded variables.
* \return Number of unbounded variables. */
inline int_t getNUV( ) const;
/** Returns number of free variables.
* \return Number of free variables. */
inline int_t getNFR( ) const;
/** Returns number of fixed variables.
* \return Number of fixed variables. */
inline int_t getNFX( ) const;
/** Returns a pointer to free variables index list.
* \return Pointer to free variables index list. */
inline Indexlist* getFree( );
/** Returns a pointer to fixed variables index list.
* \return Pointer to fixed variables index list. */
inline Indexlist* getFixed( );
/** Shifts forward type and status of all bounds by a given
* offset. This offset has to lie within the range [0,n/2] and has to
* be an integer divisor of the total number of bounds n.
* Type and status of the first \<offset\> bounds is thrown away,
* type and status of the last \<offset\> bounds is doubled,
* e.g. for offset = 2: \n
* shift( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b5,b6}
* \return SUCCESSFUL_RETURN \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_INVALID_ARGUMENTS \n
RET_SHIFTING_FAILED */
virtual returnValue shift( int_t offset /**< Shift offset within the range [0,n/2] and integer divisor of n. */
);
/** Rotates forward type and status of all bounds by a given
* offset. This offset has to lie within the range [0,n].
* Example for offset = 2: \n
* rotate( {b1,b2,b3,b4,b5,b6} ) = {b3,b4,b5,b6,b1,b2}
* \return SUCCESSFUL_RETURN \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_ROTATING_FAILED */
virtual returnValue rotate( int_t offset /**< Rotation offset within the range [0,n]. */
);
/** Prints information on bounds object
* (in particular, lists of free and fixed bounds.
* \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_CORRUPTED */
returnValue print( );
/*
* PROTECTED MEMBER FUNCTIONS
*/
protected:
/** Frees all allocated memory.
* \return SUCCESSFUL_RETURN */
returnValue clear( );
/** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */
returnValue copy( const Bounds& rhs /**< Rhs object. */
);
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
* to the index set corresponding to the desired status;
* the order depends on the SujectToType of each index.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_BOUND_FAILED */
returnValue setupAll( SubjectToStatus _status /**< Desired initial status for all bounds. */
);
/*
* PROTECTED MEMBER VARIABLES
*/
protected:
Indexlist freee; /**< Index list of free variables. */
Indexlist fixed; /**< Index list of fixed variables. */
};
END_NAMESPACE_QPOASES
#include <qpOASES/Bounds.ipp>
#endif /* QPOASES_BOUNDS_HPP */
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Bounds.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of inlined member functions of the Bounds class designed
* to manage working sets of bounds within a QProblem.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t N V
*/
inline int_t Bounds::getNV( ) const
{
return n;
}
/*
* g e t N F V
*/
inline int_t Bounds::getNFV( ) const
{
return getNumberOfType( ST_EQUALITY );
}
/*
* g e t N B V
*/
inline int_t Bounds::getNBV( ) const
{
return getNumberOfType( ST_BOUNDED );
}
/*
* g e t N U V
*/
inline int_t Bounds::getNUV( ) const
{
return getNumberOfType( ST_UNBOUNDED );
}
/*
* g e t N F R
*/
inline int_t Bounds::getNFR( ) const
{
return freee.getLength( );
}
/*
* g e t N F X
*/
inline int_t Bounds::getNFX( ) const
{
return fixed.getLength( );
}
/*
* g e t F r e e
*/
inline Indexlist* Bounds::getFree( )
{
return &freee;
}
/*
* g e t F i x e d
*/
inline Indexlist* Bounds::getFixed( )
{
return &fixed;
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Constants.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Definition of all global constants.
*/
#ifndef QPOASES_CONSTANTS_HPP
#define QPOASES_CONSTANTS_HPP
#include <qpOASES/Types.hpp>
BEGIN_NAMESPACE_QPOASES
/** Numerical value of machine precision (min eps, s.t. 1+eps > 1).
* Note: this value has to be positive! */
#ifdef __USE_SINGLE_PRECISION__
const real_t EPS = 1.193e-07f;
#else
const real_t EPS = 2.221e-16;
#endif /* __USE_SINGLE_PRECISION__ */
/** Numerical value of zero (for situations in which it would be
* unreasonable to compare with 0.0).
* Note: this value has to be positive! */
const real_t ZERO = 1.0e-25;
/** Numerical value of infinity (e.g. for non-existing bounds).
Note: this value has to be positive! */
const real_t INFTY = 1.0e20;
/** Maximum number of characters within a string.
* Note: this value should be at least 41! */
const uint_t MAX_STRING_LENGTH = 160;
END_NAMESPACE_QPOASES
#endif /* QPOASES_CONSTANTS_HPP */
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/ConstraintProduct.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2009-2017
*
* Declaration of the ConstraintProduct class 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_HPP
#define QPOASES_CONSTRAINT_PRODUCT_HPP
BEGIN_NAMESPACE_QPOASES
/**
* \brief Interface for specifying user-defined evaluations of constraint products.
*
* A class 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
* \version 3.2
* \date 2009-2017
*/
class ConstraintProduct
{
public:
/** Default constructor. */
ConstraintProduct( ) {};
/** Copy constructor. */
ConstraintProduct( const ConstraintProduct &toCopy /**< Rhs object. */
) {};
/** Destructor. */
virtual ~ConstraintProduct( ) {};
/** Assignment operator. */
ConstraintProduct &operator=( const ConstraintProduct &toCopy /**< Rhs object. */
)
{
return *this;
}
/** Evaluates the product of a given constraint with the current iterate.
* This function needs to be implemented in a derived class for the
* user-defined constraint product function.
* \return 0: successful \n
otherwise: not successful */
virtual int_t operator() ( int_t constrIndex, /**< Number of constraint to be evaluated. */
const real_t* const x, /**< Array containing current primal iterate. */
real_t* const constrValue /**< Output: Scalar value of the evaluated constraint. */
) const = 0;
};
END_NAMESPACE_QPOASES
#endif /* QPOASES_CONSTRAINT_PRODUCT_HPP */
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Constraints.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of the Constraints class designed to manage working sets of
* constraints within a QProblem.
*/
#ifndef QPOASES_CONSTRAINTS_HPP
#define QPOASES_CONSTRAINTS_HPP
#include <qpOASES/SubjectTo.hpp>
BEGIN_NAMESPACE_QPOASES
/**
* \brief Manages working sets of constraints.
*
* This class manages working sets of constraints by storing
* index sets and other status information.
*
* \author Hans Joachim Ferreau
* \version 3.2
* \date 2007-2017
*/
class Constraints : public SubjectTo
{
/*
* PUBLIC MEMBER FUNCTIONS
*/
public:
/** Default constructor. */
Constraints( );
/** Constructor which takes the number of constraints. */
Constraints( int_t _n /**< Number of constraints. */
);
/** Copy constructor (deep copy). */
Constraints( const Constraints& rhs /**< Rhs object. */
);
/** Destructor. */
virtual ~Constraints( );
/** Assignment operator (deep copy). */
Constraints& operator=( const Constraints& rhs /**< Rhs object. */
);
/** Initialises object with given number of constraints.
* \return SUCCESSFUL_RETURN \n
RET_INVALID_ARGUMENTS */
returnValue init( int_t _n = 0 /**< Number of constraints. */
);
/** Initially adds number of a new (i.e. not yet in the list) constraint to
* a given index set.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_CONSTRAINT_FAILED \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_INVALID_ARGUMENTS */
returnValue setupConstraint( int_t number, /**< Number of new constraint. */
SubjectToStatus _status /**< Status of new constraint. */
);
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
* to the index set of inactive constraints; the order depends on the SujectToType
* of each index. Only disabled constraints are added to index set of disabled constraints!
* \return SUCCESSFUL_RETURN \n
RET_SETUP_CONSTRAINT_FAILED */
returnValue setupAllInactive( );
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
* to the index set of active constraints (on their lower bounds); the order depends on the SujectToType
* of each index. Only disabled constraints are added to index set of disabled constraints!
* \return SUCCESSFUL_RETURN \n
RET_SETUP_CONSTRAINT_FAILED */
returnValue setupAllLower( );
/** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to
* to the index set of active constraints (on their upper bounds); the order depends on the SujectToType
* of each index. Only disabled constraints are added to index set of disabled constraints!
* \return SUCCESSFUL_RETURN \n
RET_SETUP_CONSTRAINT_FAILED */
returnValue setupAllUpper( );
/** Moves index of a constraint from index list of active to that of inactive constraints.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_CONSTRAINT_FAILED */
returnValue moveActiveToInactive( int_t number /**< Number of constraint to become inactive. */
);
/** Moves index of a constraint from index list of inactive to that of active constraints.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_CONSTRAINT_FAILED */
returnValue moveInactiveToActive( int_t number, /**< Number of constraint to become active. */
SubjectToStatus _status /**< Status of constraint to become active. */
);
/** Flip fixed constraint.
* \return SUCCESSFUL_RETURN \n
RET_MOVING_CONSTRAINT_FAILED \n
RET_INDEX_OUT_OF_BOUNDS */
returnValue flipFixed( int_t number );
/** Returns the number of constraints.
* \return Number of constraints. */
inline int_t getNC( ) const;
/** Returns the number of implicit equality constraints.
* \return Number of implicit equality constraints. */
inline int_t getNEC( ) const;
/** Returns the number of "real" inequality constraints.
* \return Number of "real" inequality constraints. */
inline int_t getNIC( ) const;
/** Returns the number of unbounded constraints (i.e. without any bounds).
* \return Number of unbounded constraints (i.e. without any bounds). */
inline int_t getNUC( ) const;
/** Returns the number of active constraints.
* \return Number of active constraints. */
inline int_t getNAC( ) const;
/** Returns the number of inactive constraints.
* \return Number of inactive constraints. */
inline int_t getNIAC( ) const;
/** Returns a pointer to active constraints index list.
* \return Pointer to active constraints index list. */
inline Indexlist* getActive( );
/** Returns a pointer to inactive constraints index list.
* \return Pointer to inactive constraints index list. */
inline Indexlist* getInactive( );
/** Shifts forward type and status of all constraints by a given
* offset. This offset has to lie within the range [0,n/2] and has to
* be an integer divisor of the total number of constraints n.
* Type and status of the first \<offset\> constraints is thrown away,
* type and status of the last \<offset\> constraints is doubled,
* e.g. for offset = 2: \n
* shift( {c1,c2,c3,c4,c5,c6} ) = {c3,c4,c5,c6,c5,c6}
* \return SUCCESSFUL_RETURN \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_INVALID_ARGUMENTS \n
RET_SHIFTING_FAILED */
virtual returnValue shift( int_t offset /**< Shift offset within the range [0,n/2] and integer divisor of n. */
);
/** Rotates forward type and status of all constraints by a given
* offset. This offset has to lie within the range [0,n].
* Example for offset = 2: \n
* rotate( {c1,c2,c3,c4,c5,c6} ) = {c3,c4,c5,c6,c1,c2}
* \return SUCCESSFUL_RETURN \n
RET_INDEX_OUT_OF_BOUNDS \n
RET_ROTATING_FAILED */
virtual returnValue rotate( int_t offset /**< Rotation offset within the range [0,n]. */
);
/** Prints information on constraints object
* (in particular, lists of inactive and active constraints.
* \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_CORRUPTED */
returnValue print( );
/*
* PROTECTED MEMBER FUNCTIONS
*/
protected:
/** Frees all allocated memory.
* \return SUCCESSFUL_RETURN */
returnValue clear( );
/** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */
returnValue copy( const Constraints& rhs /**< Rhs object. */
);
/** Initially adds all numbers of new (i.e. not yet in the list) bounds to
* to the index set corresponding to the desired status;
* the order depends on the SujectToType of each index.
* \return SUCCESSFUL_RETURN \n
RET_SETUP_CONSTRAINT_FAILED */
returnValue setupAll( SubjectToStatus _status /**< Desired initial status for all bounds. */
);
/*
* PROTECTED MEMBER VARIABLES
*/
protected:
Indexlist active; /**< Index list of active constraints. */
Indexlist inactive; /**< Index list of inactive constraints. */
};
END_NAMESPACE_QPOASES
#include <qpOASES/Constraints.ipp>
#endif /* QPOASES_CONSTRAINTS_HPP */
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Constraints.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of inlined member functions of the Constraints class designed
* to manage working sets of constraints within a QProblem.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t N C
*/
inline int_t Constraints::getNC( ) const
{
return n;
}
/*
* g e t N E C
*/
inline int_t Constraints::getNEC( ) const
{
return getNumberOfType( ST_EQUALITY );
}
/*
* g e t N I C
*/
inline int_t Constraints::getNIC( ) const
{
return getNumberOfType( ST_BOUNDED );
}
/*
* g e t N U C
*/
inline int_t Constraints::getNUC( ) const
{
return getNumberOfType( ST_UNBOUNDED );
}
/*
* g e t N A C
*/
inline int_t Constraints::getNAC( ) const
{
return active.getLength( );
}
/*
* g e t N I A C
*/
inline int_t Constraints::getNIAC( ) const
{
return inactive.getLength( );
}
/*
* g e t A c t i v e
*/
inline Indexlist* Constraints::getActive( )
{
return &active;
}
/*
* g e t I n a c t i v e
*/
inline Indexlist* Constraints::getInactive( )
{
return &inactive;
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Flipper.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of the Options class designed to manage user-specified
* options for solving a QProblem.
*/
#ifndef QPOASES_FLIPPER_HPP
#define QPOASES_FLIPPER_HPP
#include <qpOASES/Bounds.hpp>
#include <qpOASES/Constraints.hpp>
BEGIN_NAMESPACE_QPOASES
/**
* \brief Auxiliary class for storing a copy of the current matrix factorisations.
*
* This auxiliary class stores a copy of the current matrix factorisations. It
* is used by the classe QProblemB and QProblem in case flipping bounds are enabled.
*
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*/
class Flipper
{
friend class QProblemB;
friend class QProblem;
/*
* PUBLIC MEMBER FUNCTIONS
*/
public:
/** Default constructor. */
Flipper( );
/** Constructor which takes the number of bounds and constraints. */
Flipper( uint_t _nV, /**< Number of bounds. */
uint_t _nC = 0 /**< Number of constraints. */
);
/** Copy constructor (deep copy). */
Flipper( const Flipper& rhs /**< Rhs object. */
);
/** Destructor. */
~Flipper( );
/** Assignment operator (deep copy). */
Flipper& operator=( const Flipper& rhs /**< Rhs object. */
);
/** Initialises object with given number of bounds and constraints.
* \return SUCCESSFUL_RETURN \n
RET_INVALID_ARGUMENTS */
returnValue init( uint_t _nV = 0, /**< Number of bounds. */
uint_t _nC = 0 /**< Number of constraints. */
);
/** Copies current values to non-null arguments (assumed to be allocated with consistent size).
* \return SUCCESSFUL_RETURN */
returnValue get( Bounds* const _bounds, /**< Pointer to new bounds. */
real_t* const R, /**< New matrix R. */
Constraints* const _constraints = 0, /**< Pointer to new constraints. */
real_t* const _Q = 0, /**< New matrix Q. */
real_t* const _T = 0 /**< New matrix T. */
) const;
/** Assigns new values to non-null arguments.
* \return SUCCESSFUL_RETURN */
returnValue set( const Bounds* const _bounds, /**< Pointer to new bounds. */
const real_t* const _R, /**< New matrix R. */
const Constraints* const _constraints = 0, /**< Pointer to new constraints. */
const real_t* const _Q = 0, /**< New matrix Q. */
const real_t* const _T = 0 /**< New matrix T. */
);
/*
* PROTECTED MEMBER FUNCTIONS
*/
protected:
/** Frees all allocated memory.
* \return SUCCESSFUL_RETURN */
returnValue clear( );
/** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */
returnValue copy( const Flipper& rhs /**< Rhs object. */
);
/** Returns dimension of matrix T.
* \return Dimension of matrix T. */
uint_t getDimT( ) const;
/*
* PROTECTED MEMBER VARIABLES
*/
protected:
uint_t nV; /**< Number of variables. */
uint_t nC; /**< Number of constraints. */
Bounds bounds; /**< Data structure for problem's bounds. */
Constraints constraints; /**< Data structure for problem's constraints. */
real_t* R; /**< Cholesky factor of H (i.e. H = R^T*R). */
real_t* Q; /**< Orthonormal quadratic matrix, A = [0 T]*Q'. */
real_t* T; /**< Reverse triangular matrix, A = [0 T]*Q'. */
};
END_NAMESPACE_QPOASES
#endif /* QPOASES_FLIPPER_HPP */
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Indexlist.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of the Indexlist class designed to manage index lists of
* constraints and bounds within a SubjectTo object.
*/
#ifndef QPOASES_INDEXLIST_HPP
#define QPOASES_INDEXLIST_HPP
#include <qpOASES/Utils.hpp>
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.2
* \date 2007-2017
*/
class Indexlist
{
/*
* FRIENDS
*/
friend class DenseMatrix;
friend class SymDenseMat;
friend class SparseMatrix;
friend class SparseMatrixRow;
friend class SymSparseMat;
/*
* PUBLIC MEMBER FUNCTIONS
*/
public:
/** Default constructor. */
Indexlist( );
/** Constructor which takes the desired physical length of the index list. */
Indexlist( int_t n /**< Physical length of index list. */
);
/** Copy constructor (deep copy). */
Indexlist( const Indexlist& rhs /**< Rhs object. */
);
/** Destructor. */
~Indexlist( );
/** Assingment operator (deep copy). */
Indexlist& operator=( const Indexlist& rhs /**< Rhs object. */
);
/** Initialises index list of desired physical length.
* \return SUCCESSFUL_RETURN \n
RET_INVALID_ARGUMENTS */
returnValue init( int_t n = 0 /**< 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 getNumberArray( int_t** const numberarray /**< Output: Array of numbers (NULL on error). */
) const;
/** Creates an array of all numbers within the index set in correct order.
* \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_CORRUPTED */
returnValue getISortArray( int_t** const iSortArray /**< Output: iSort Array. */
) const;
/** 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_t getIndex( int_t givennumber /**< Number whose index shall be determined. */
) const;
/** Returns the number stored at a given physical index.
* \return >= 0: Number stored at given physical index. \n
-RET_INDEXLIST_OUTOFBOUNDS */
int_t getNumber( int_t physicalindex /**< Physical index of the number to be returned. */
) const;
/** Returns the current length of the index list.
* \return Current length of the index list. */
inline int_t getLength( ) const;
/** Returns last number within the index list.
* \return Last number within the index list. */
inline int_t getLastNumber( ) const;
/** Adds number to index list.
* \return SUCCESSFUL_RETURN \n
RET_INDEXLIST_MUST_BE_REORDERD \n
RET_INDEXLIST_EXCEEDS_MAX_LENGTH */
returnValue addNumber( int_t addnumber /**< Number to be added. */
);
/** Removes number from index list.
* \return SUCCESSFUL_RETURN */
returnValue removeNumber( int_t removenumber /**< Number to be removed. */
);
/** Swaps two numbers within index list.
* \return SUCCESSFUL_RETURN */
returnValue swapNumbers( int_t number1, /**< First number for swapping. */
int_t 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 */
inline BooleanType isMember( int_t _number /**< Number to be tested for membership. */
) const;
/*
* PROTECTED MEMBER FUNCTIONS
*/
protected:
/** Frees all allocated memory.
* \return SUCCESSFUL_RETURN */
returnValue clear( );
/** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */
returnValue copy( const Indexlist& rhs /**< Rhs object. */
);
/** 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_t findInsert( int_t i
) const;
/*
* PROTECTED MEMBER VARIABLES
*/
protected:
int_t* number; /**< Array to store numbers of constraints or bounds. */
int_t* iSort; /**< Index list to sort vector \a number */
int_t length; /**< Length of index list. */
int_t first; /**< Physical index of first element. */
int_t last; /**< Physical index of last element. */
int_t lastusedindex; /**< Physical index of last entry in index list. */
int_t physicallength; /**< Physical length of index list. */
};
END_NAMESPACE_QPOASES
#include <qpOASES/Indexlist.ipp>
#endif /* QPOASES_INDEXLIST_HPP */
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Indexlist.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of inlined member functions of the Indexlist class designed
* to manage index lists of constraints and bounds within a QProblem_SubjectTo.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t N u m b e r
*/
inline int_t Indexlist::getNumber( int_t physicalindex ) const
{
/* consistency check */
if ( ( physicalindex < 0 ) || ( physicalindex > length ) )
return -RET_INDEXLIST_OUTOFBOUNDS;
return number[physicalindex];
}
/*
* g e t L e n g t h
*/
inline int_t Indexlist::getLength( ) const
{
return length;
}
/*
* g e t L a s t N u m b e r
*/
inline int_t Indexlist::getLastNumber( ) const
{
return number[length-1];
}
/*
* g e t L a s t N u m b e r
*/
inline BooleanType Indexlist::isMember( int_t _number ) const
{
if ( getIndex( _number ) >= 0 )
return BT_TRUE;
else
return BT_FALSE;
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/LapackBlasReplacement.hpp
* \author Andreas Potschka, Hans Joachim Ferreau, Christian Kirches
* \version 3.2
* \date 2009-2017
*
* Declarations for external LAPACK/BLAS functions.
*/
#ifndef QPOASES_LAPACKBLASREPLACEMENT_HPP
#define QPOASES_LAPACKBLASREPLACEMENT_HPP
#ifdef __USE_SINGLE_PRECISION__
/** Macro for calling level 3 BLAS operation in single precision. */
#define GEMM sgemm_
/** Macro for calling level 3 BLAS operation in single precision. */
#define SYR ssyr_
/** Macro for calling level 3 BLAS operation in single precision. */
#define SYR2 ssyr2_
/** Macro for calling level 3 BLAS operation in single precision. */
#define POTRF spotrf_
/** Macro for calling level 3 BLAS operation in single precision. */
/* #define GEQRF sgeqrf_ */
/** Macro for calling level 3 BLAS operation in single precision. */
/* #define ORMQR sormqr_ */
/** Macro for calling level 3 BLAS operation in single precision. */
#define TRTRS strtrs_
/** Macro for calling level 3 BLAS operation in single precision. */
#define TRCON strcon_
#else
/** Macro for calling level 3 BLAS operation in double precision. */
#define GEMM dgemm_
/** Macro for calling level 3 BLAS operation in double precision. */
#define SYR dsyr_
/** Macro for calling level 3 BLAS operation in double precision. */
#define SYR2 dsyr2_
/** Macro for calling level 3 BLAS operation in double precision. */
#define POTRF dpotrf_
/** Macro for calling level 3 BLAS operation in double precision. */
/* #define GEQRF dgeqrf_ */
/** Macro for calling level 3 BLAS operation in double precision. */
/* #define ORMQR dormqr_ */
/** Macro for calling level 3 BLAS operation in double precision. */
#define TRTRS dtrtrs_
/** Macro for calling level 3 BLAS operation in double precision. */
#define TRCON dtrcon_
#endif /* __USE_SINGLE_PRECISION__ */
extern "C"
{
/** Performs one of the matrix-matrix operation in double precision. */
void dgemm_( const char*, const char*, const la_uint_t*, const la_uint_t*, const la_uint_t*,
const double*, const double*, const la_uint_t*, const double*, const la_uint_t*,
const double*, double*, const la_uint_t* );
/** Performs one of the matrix-matrix operation in single precision. */
void sgemm_( const char*, const char*, const la_uint_t*, const la_uint_t*, const la_uint_t*,
const float*, const float*, const la_uint_t*, const float*, const la_uint_t*,
const float*, float*, const la_uint_t* );
/** Performs a symmetric rank 1 operation in double precision. */
void dsyr_( const char*, const la_uint_t*, const double*, const double*,
const la_uint_t*, double*, const la_uint_t* );
/** Performs a symmetric rank 1 operation in single precision. */
void ssyr_( const char*, const la_uint_t*, const float*, const float*,
const la_uint_t*, float*, const la_uint_t* );
/** Performs a symmetric rank 2 operation in double precision. */
void dsyr2_( const char*, const la_uint_t*, const double*, const double*,
const la_uint_t*, const double*, const la_uint_t*, double*, const la_uint_t*);
/** Performs a symmetric rank 2 operation in single precision. */
void ssyr2_( const char*, const la_uint_t*, const float*, const float*,
const la_uint_t*, const float*, const la_uint_t*, float*, const la_uint_t*);
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in double precision. */
void dpotrf_( const char*, const la_uint_t*, double*, const la_uint_t*, la_int_t* );
/** Calculates the Cholesky factorization of a real symmetric positive definite matrix in single precision. */
void spotrf_( const char*, const la_uint_t*, float*, const la_uint_t*, la_int_t* );
/** Computes a QR factorization of a real M-by-N matrix A in double precision */
/* void dgeqrf_( const la_uint_t* M, const la_uint_t* N, double* A, const la_uint_t* LDA,
double* TAU, double* WORK, const la_uint_t* LWORK, int *INFO );*/
/** Computes a QR factorization of a real M-by-N matrix A in single precision */
/* void sgeqrf_( const la_uint_t* M, const la_uint_t* N, float* A, const la_uint_t* LDA,
float* TAU, float* WORK, const la_uint_t* LWORK, int *INFO );*/
/** Multiplies C with orthogonal matrix Q**T as returned by geqrf (double precision) */
/* void dormqr_( const char* SIDE, const char* TRANS, const la_uint_t* M, const la_uint_t* N, const la_uint_t* K,
double* A, const la_uint_t* LDA, double* TAU, double* C, const la_uint_t* LDC,
double* WORK, const la_uint_t* LWORK, int *INFO );*/
/** Multiplies C with orthogonal matrix Q**T as returned by geqrf (single precision) */
/* void sormqr_( const char* SIDE, const char* TRANS, const la_uint_t* M, const la_uint_t* N, const la_uint_t* K,
float* A, const la_uint_t* LDA, float* TAU, float* C, const la_uint_t* LDC,
float* WORK, const la_uint_t* LWORK, int *INFO );*/
/** Solves a triangular system (double precision) */
void dtrtrs_( const char* UPLO, const char* TRANS, const char* DIAG, const la_uint_t* N, const la_uint_t* NRHS,
double* A, const la_uint_t* LDA, double* B, const la_uint_t* LDB, la_int_t* INFO );
/** Solves a triangular system (single precision) */
void strtrs_( const char* UPLO, const char* TRANS, const char* DIAG, const la_uint_t* N, const la_uint_t* NRHS,
float* A, const la_uint_t* LDA, float* B, const la_uint_t* LDB, la_int_t* INFO );
/** Estimate the reciprocal of the condition number of a triangular matrix in double precision */
void dtrcon_( const char* NORM, const char* UPLO, const char* DIAG, const la_uint_t* N, double* A, const la_uint_t* LDA,
double* RCOND, double* WORK, const la_uint_t* IWORK, la_int_t* INFO );
/** Estimate the reciprocal of the condition number of a triangular matrix in single precision */
void strcon_( const char* NORM, const char* UPLO, const char* DIAG, const la_uint_t* N, float* A, const la_uint_t* LDA,
float* RCOND, float* WORK, const la_uint_t* IWORK, la_int_t* INFO );
}
#endif /* QPOASES_LAPACKBLASREPLACEMENT_HPP */
此差异已折叠。
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/MessageHandling.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of inlined member functions of the MessageHandling class.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t E r r o r V i s i b i l i t y S t a t u s
*/
inline VisibilityStatus MessageHandling::getErrorVisibilityStatus( ) const
{
return errorVisibility;
}
/*
* g e t W a r n i n g V i s i b i l i t y S t a t u s
*/
inline VisibilityStatus MessageHandling::getWarningVisibilityStatus( ) const
{
return warningVisibility;
}
/*
* g e t I n f o V i s i b i l i t y S t a t u s
*/
inline VisibilityStatus MessageHandling::getInfoVisibilityStatus( ) const
{
return infoVisibility;
}
/*
* g e t O u t p u t F i l e
*/
inline FILE* MessageHandling::getOutputFile( ) const
{
return outputFile;
}
/*
* g e t E r r o r C o u n t
*/
inline int_t MessageHandling::getErrorCount( ) const
{
return errorCount;
}
/*
* s e t E r r o r V i s i b i l i t y S t a t u s
*/
inline void MessageHandling::setErrorVisibilityStatus( VisibilityStatus _errorVisibility )
{
errorVisibility = _errorVisibility;
}
/*
* s e t W a r n i n g V i s i b i l i t y S t a t u s
*/
inline void MessageHandling::setWarningVisibilityStatus( VisibilityStatus _warningVisibility )
{
warningVisibility = _warningVisibility;
}
/*
* s e t I n f o V i s i b i l i t y S t a t u s
*/
inline void MessageHandling::setInfoVisibilityStatus( VisibilityStatus _infoVisibility )
{
infoVisibility = _infoVisibility;
}
/*
* s e t O u t p u t F i l e
*/
inline void MessageHandling::setOutputFile( FILE* _outputFile )
{
outputFile = _outputFile;
}
/*
* s e t E r r o r C o u n t
*/
inline returnValue MessageHandling::setErrorCount( int_t _errorCount )
{
if ( _errorCount >= -1 )
{
errorCount = _errorCount;
return SUCCESSFUL_RETURN;
}
else
return RET_INVALID_ARGUMENTS;
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/Options.hpp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Declaration of the Options class designed to manage user-specified
* options for solving a QProblem.
*/
#ifndef QPOASES_OPTIONS_HPP
#define QPOASES_OPTIONS_HPP
#include <qpOASES/Utils.hpp>
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.2
* \date 2007-2017
*/
class Options
{
/*
* PUBLIC MEMBER FUNCTIONS
*/
public:
/** Default constructor. */
Options( );
/** Copy constructor (deep copy). */
Options( const Options& rhs /**< Rhs object. */
);
/** Destructor. */
~Options( );
/** Assignment operator (deep copy). */
Options& operator=( const Options& rhs /**< Rhs object. */
);
/** Sets all options to default values.
* \return SUCCESSFUL_RETURN */
returnValue setToDefault( );
/** Sets all options to values resulting in maximum reliabilty.
* \return SUCCESSFUL_RETURN */
returnValue setToReliable( );
/** Sets all options to values resulting in minimum solution time.
* \return SUCCESSFUL_RETURN */
returnValue setToMPC( );
/** Same as setToMPC( ), for ensuring backwards compatibility.
* \return SUCCESSFUL_RETURN */
returnValue setToFast( );
/** 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 ensureConsistency( );
/** Prints values of all options.
* \return SUCCESSFUL_RETURN */
returnValue print( ) const;
/*
* PROTECTED MEMBER FUNCTIONS
*/
protected:
/** Copies all members from given rhs object.
* \return SUCCESSFUL_RETURN */
returnValue copy( const Options& rhs /**< Rhs object. */
);
/*
* PUBLIC MEMBER VARIABLES
*/
public:
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_t enableDriftCorrection; /**< Specifies the frequency of drift corrections (0 = off). */
int_t 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_t numRegularisationSteps; /**< Maximum number of successive regularisation steps. */
real_t epsRegularisation; /**< Scaling factor of identity matrix used for Hessian regularisation. */
int_t 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. */
real_t rcondSMin; /**< Minimum reciprocal condition number of S before refactorization is triggered */
BooleanType enableInertiaCorrection; /**< Specifies whether the working set should be repaired when negative curvature is discovered during hotstart. */
BooleanType enableDropInfeasibles; /**< ... */
int_t dropBoundPriority; /**< ... */
int_t dropEqConPriority; /**< ... */
int_t dropIneqConPriority; /**< ... */
};
END_NAMESPACE_QPOASES
#endif /* QPOASES_OPTIONS_HPP */
/*
* end of file
*/
此差异已折叠。
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/QProblem.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of inlined member functions of the QProblem class which
* is able to use the newly developed online active set strategy for
* parametric quadratic programming.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t C o n s t r a i n t s
*/
inline returnValue QProblem::getConstraints( Constraints& _constraints ) const
{
int_t nV = getNV( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
_constraints = constraints;
return SUCCESSFUL_RETURN;
}
/*
* g e t N C
*/
inline int_t QProblem::getNC( ) const
{
return constraints.getNC( );
}
/*
* g e t N E C
*/
inline int_t QProblem::getNEC( ) const
{
return constraints.getNEC( );
}
/*
* g e t N A C
*/
inline int_t QProblem::getNAC( ) const
{
return constraints.getNAC( );
}
/*
* g e t N I A C
*/
inline int_t QProblem::getNIAC( ) const
{
return constraints.getNIAC( );
}
/*****************************************************************************
* P R O T E C T E D *
*****************************************************************************/
/*
* s e t A
*/
inline returnValue QProblem::setA( Matrix *A_new )
{
int_t j;
int_t nV = getNV( );
int_t nC = getNC( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( A_new == 0 )
return THROWERROR( RET_INVALID_ARGUMENTS );
/* Set constraint matrix AND update member AX. */
if ( ( freeConstraintMatrix == BT_TRUE ) && ( A != 0 ) )
{
delete A;
A = 0;
}
A = A_new;
freeConstraintMatrix = BT_FALSE;
A->times(1, 1.0, x, nV, 0.0, Ax, nC);
A->getRowNorm(tempC);
for( j=0; j<nC; ++j )
{
Ax_u[j] = ubA[j] - Ax[j];
Ax_l[j] = Ax[j] - lbA[j];
// (ckirches) disable constraints with empty rows
if ( isZero( tempC[j] ) == BT_TRUE )
constraints.setType ( j, ST_DISABLED );
}
return SUCCESSFUL_RETURN;
}
/*
* s e t A
*/
inline returnValue QProblem::setA( const real_t* const A_new )
{
int_t j;
int_t nV = getNV( );
int_t nC = getNC( );
DenseMatrix* dA;
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( A_new == 0 )
return THROWERROR( RET_INVALID_ARGUMENTS );
/* Set constraint matrix AND update member AX. */
if ( ( freeConstraintMatrix == BT_TRUE ) && ( A != 0 ) )
{
delete A;
A = 0;
}
A = dA = new DenseMatrix(nC, nV, nV, (real_t*) A_new);
freeConstraintMatrix = BT_TRUE;
A->times(1, 1.0, x, nV, 0.0, Ax, nC);
for( j=0; j<nC; ++j )
{
Ax_u[j] = ubA[j] - Ax[j];
Ax_l[j] = Ax[j] - lbA[j];
}
return SUCCESSFUL_RETURN;
}
/*
* s e t L B A
*/
inline returnValue QProblem::setLBA( const real_t* const lbA_new )
{
uint_t i;
uint_t nV = (uint_t)getNV( );
uint_t nC = (uint_t)getNC( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( lbA_new != 0 )
{
memcpy( lbA,lbA_new,nC*sizeof(real_t) );
}
else
{
/* if no lower constraints' bounds are specified, set them to -infinity */
for( i=0; i<nC; ++i )
lbA[i] = -INFTY;
}
return SUCCESSFUL_RETURN;
}
/*
* s e t L B A
*/
inline returnValue QProblem::setLBA( int_t number, real_t value )
{
int_t nV = getNV( );
int_t nC = getNC( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( ( number >= 0 ) && ( number < nC ) )
{
lbA[number] = value;
return SUCCESSFUL_RETURN;
}
else
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
}
/*
* s e t U B A
*/
inline returnValue QProblem::setUBA( const real_t* const ubA_new )
{
uint_t i;
uint_t nV = (uint_t)getNV( );
uint_t nC = (uint_t)getNC( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( ubA_new != 0 )
{
memcpy( ubA,ubA_new,nC*sizeof(real_t) );
}
else
{
/* if no upper constraints' bounds are specified, set them to infinity */
for( i=0; i<nC; ++i )
ubA[i] = INFTY;
}
return SUCCESSFUL_RETURN;
}
/*
* s e t U B A
*/
inline returnValue QProblem::setUBA( int_t number, real_t value )
{
int_t nV = getNV( );
int_t nC = getNC( );
if ( nV == 0 )
return THROWERROR( RET_QPOBJECT_NOT_SETUP );
if ( ( number >= 0 ) && ( number < nC ) )
{
ubA[number] = value;
return SUCCESSFUL_RETURN;
}
else
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2017 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/SQProblem.ipp
* \author Hans Joachim Ferreau, Andreas Potschka, Christian Kirches
* \version 3.2
* \date 2007-2017
*
* Implementation of inlined member functions of the SQProblem class which
* is able to use the newly developed online active set strategy for
* parametric quadratic programming with varying matrices.
*/
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
BEGIN_NAMESPACE_QPOASES
END_NAMESPACE_QPOASES
/*
* end of file
*/
此差异已折叠。
/*
* This file is part of qpOASES.
*
* qpOASES -- An Implementation of the Online Active Set Strategy.
* Copyright (C) 2007-2013 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/SQProblemSchur.ipp
* \author Andreas Waechter, Dennis Janka
* \version 3.2
* \date 2012-2017
*
* Implementation of inlined member functions of the SQProblemSchur class which
* is able to use the newly developed online active set strategy for
* parametric quadratic programming.
*/
BEGIN_NAMESPACE_QPOASES
/*****************************************************************************
* P U B L I C *
*****************************************************************************/
/*
* g e t N u m F a c t o r i z a t i o n s
*/
inline int_t SQProblemSchur::getNumFactorizations( ) const
{
return numFactorizations;
}
END_NAMESPACE_QPOASES
/*
* end of file
*/
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册