qpOASES
3.1.1
|
Go to the source code of this file.
Functions | |
BEGIN_NAMESPACE_QPOASES returnValue | print (const real_t *const v, int n, const char *name=0) |
returnValue | print (const real_t *const v, int n, const int *const V_idx, const char *name=0) |
returnValue | print (const real_t *const M, int nrow, int ncol, const char *name=0) |
returnValue | print (const real_t *const M, int nrow, int ncol, const int *const ROW_idx, const int *const COL_idx, const char *name=0) |
returnValue | print (const int *const index, int n, const char *name=0) |
returnValue | myPrintf (const char *s) |
returnValue | printCopyrightNotice () |
returnValue | readFromFile (real_t *data, int nrow, int ncol, const char *datafilename) |
returnValue | readFromFile (real_t *data, int n, const char *datafilename) |
returnValue | readFromFile (int *data, int n, const char *datafilename) |
returnValue | writeIntoFile (const real_t *const data, int nrow, int ncol, const char *datafilename, BooleanType append=BT_FALSE) |
returnValue | writeIntoFile (const real_t *const data, int n, const char *datafilename, BooleanType append=BT_FALSE) |
returnValue | writeIntoFile (const int *const integer, int n, const char *datafilename, BooleanType append=BT_FALSE) |
returnValue | writeIntoMatFile (FILE *const matFile, const real_t *const data, int nRows, int nCols, const char *name) |
returnValue | writeIntoMatFile (FILE *const matFile, const int *const data, int nRows, int nCols, const char *name) |
real_t | getCPUtime () |
real_t | getNorm (const real_t *const v, int n, int type=2) |
BooleanType | isEqual (real_t x, real_t y, real_t TOL=ZERO) |
BooleanType | isZero (real_t x, real_t TOL=ZERO) |
real_t | getSign (real_t arg) |
int | getMax (int x, int y) |
int | getMin (int x, int y) |
real_t | getMax (real_t x, real_t y) |
real_t | getMin (real_t x, real_t y) |
real_t | getAbs (real_t x) |
real_t | getSqrt (real_t x) |
returnValue | getKktViolation (int nV, int nC, const real_t *const H, const real_t *const g, const real_t *const A, const real_t *const lb, const real_t *const ub, const real_t *const lbA, const real_t *const ubA, const real_t *const x, const real_t *const y, real_t &stat, real_t &feas, real_t &cmpl, const real_t *const workingSetB=0, const real_t *const workingSetC=0, BooleanType hasIdentityHessian=BT_FALSE) |
returnValue | getKktViolation (int nV, const real_t *const H, const real_t *const g, const real_t *const lb, const real_t *const ub, const real_t *const x, const real_t *const y, real_t &stat, real_t &feas, real_t &cmpl, const real_t *const workingSetB=0, BooleanType hasIdentityHessian=BT_FALSE) |
returnValue | convertBooleanTypeToString (BooleanType value, char *const string) |
returnValue | convertSubjectToStatusToString (SubjectToStatus value, char *const string) |
returnValue | convertPrintLevelToString (PrintLevel value, char *const string) |
int | getSimpleStatus (returnValue returnvalue, BooleanType doPrintStatus=BT_FALSE) |
returnValue | normaliseConstraints (int nV, int nC, real_t *A, real_t *lbA, real_t *ubA, int type=1) |
Declaration of some utility functions for working with qpOASES.
returnValue convertBooleanTypeToString | ( | BooleanType | value, |
char *const | string | ||
) |
Writes a value of BooleanType into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
References BT_FALSE, and SUCCESSFUL_RETURN.
Referenced by Options::print().
returnValue convertPrintLevelToString | ( | PrintLevel | value, |
char *const | string | ||
) |
Writes a value of PrintLevel into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
References PL_DEBUG_ITER, PL_HIGH, PL_LOW, PL_MEDIUM, PL_NONE, PL_TABULAR, and SUCCESSFUL_RETURN.
Referenced by Options::print().
returnValue convertSubjectToStatusToString | ( | SubjectToStatus | value, |
char *const | string | ||
) |
Writes a value of SubjectToStatus into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
References ST_INACTIVE, ST_INFEASIBLE_LOWER, ST_INFEASIBLE_UPPER, ST_LOWER, ST_UNDEFINED, ST_UPPER, and SUCCESSFUL_RETURN.
Referenced by Options::print().
Returns the absolute value of a real number.
x | Real number. |
Referenced by QProblem::addBound_checkLI(), QProblem::addConstraint_checkLI(), QProblemB::backsolveR(), QProblem::backsolveT(), QProblemB::computeCholesky(), QProblemB::computeGivens(), QProblem::computeProjectedCholesky(), QProblemB::determineDataShift(), QProblem::determineDataShift(), QProblemB::determineHessianType(), QProblem::determineStepDirection(), QProblemB::determineStepDirection(), QProblem::dropInfeasibles(), QProblem::ensureNonzeroCurvature(), getKktViolation(), getNorm(), QProblemB::getRelativeHomotopyLength(), QProblem::getRelativeHomotopyLength(), SparseMatrix::getRowNorm(), QProblemB::hotstart(), QProblem::hotstart(), DenseMatrix::isDiag(), isEqual(), isZero(), main(), QProblem::performRamping(), QProblem::printIteration(), and QProblemB::printIteration().
real_t getCPUtime | ( | ) |
Returns the current system time.
References real_t.
Referenced by SQProblem::hotstart(), QProblemB::hotstart(), QProblem::hotstart(), QProblemB::isCPUtimeLimitExceeded(), main(), QProblem::solveInitialQP(), QProblemB::solveInitialQP(), QProblem::solveQP(), and QProblemB::solveQP().
returnValue getKktViolation | ( | int | nV, |
int | nC, | ||
const real_t *const | H, | ||
const real_t *const | g, | ||
const real_t *const | A, | ||
const real_t *const | lb, | ||
const real_t *const | ub, | ||
const real_t *const | lbA, | ||
const real_t *const | ubA, | ||
const real_t *const | x, | ||
const real_t *const | y, | ||
real_t & | stat, | ||
real_t & | feas, | ||
real_t & | cmpl, | ||
const real_t *const | workingSetB = 0 , |
||
const real_t *const | workingSetC = 0 , |
||
BooleanType | hasIdentityHessian = BT_FALSE |
||
) |
Computes the maximum violation of the KKT optimality conditions of given iterate for given QP data.
nV | Number of variables. |
nC | Number of constraints. |
H | Hessian matrix (may be NULL if Hessian is zero or identity matrix). |
g | Gradient vector. |
A | Constraint matrix. |
lb | Lower bound vector (on variables). |
ub | Upper bound vector (on variables). |
lbA | Lower constraints' bound vector. |
ubA | Upper constraints' bound vector. |
x | Primal trial vector. |
y | Dual trial vector. |
stat | Output: maximum value of stationarity condition residual. |
feas | Output: maximum value of primal feasibility violation. |
cmpl | Output: maximum value of complementarity residual. |
workingSetB | Working set of bounds (used to determine active bounds). |
workingSetC | Working set of constraints (used to determine active constraints). |
hasIdentityHessian | Indicating whether Hessian matrix is identity matrix or not if NULL pointer is passed. |
References BT_TRUE, EPS, getAbs(), isEqual(), real_t, and SUCCESSFUL_RETURN.
Referenced by getKktViolation(), and solveOQPbenchmark().
returnValue getKktViolation | ( | int | nV, |
const real_t *const | H, | ||
const real_t *const | g, | ||
const real_t *const | lb, | ||
const real_t *const | ub, | ||
const real_t *const | x, | ||
const real_t *const | y, | ||
real_t & | stat, | ||
real_t & | feas, | ||
real_t & | cmpl, | ||
const real_t *const | workingSetB = 0 , |
||
BooleanType | hasIdentityHessian = BT_FALSE |
||
) |
Computes the maximum violation of the KKT optimality conditions of given iterate for given QP data.
nV | Number of variables. |
H | Hessian matrix (may be NULL if Hessian is zero or identity matrix). |
g | Gradient vector. |
lb | Lower bound vector (on variables). |
ub | Upper bound vector (on variables). |
x | Primal trial vector. |
y | Dual trial vector. |
stat | Output: maximum value of stationarity condition residual. |
feas | Output: maximum value of primal feasibility violation. |
cmpl | Output: maximum value of complementarity residual. |
workingSetB | Working set of bounds (used to determine active bounds). |
hasIdentityHessian | Indicating whether Hessian matrix is identity matrix or not if NULL pointer is passed |
References getKktViolation().
int getMax | ( | int | x, |
int | y | ||
) | [inline] |
Returns maximum of two integers.
x | First integer. |
y | Second integer. |
Referenced by QProblem::ensureNonzeroCurvature(), SolutionAnalysis::getKktViolation(), QProblem::performDriftCorrection(), QProblemB::performDriftCorrection(), QProblem::performRamping(), QProblem::performStep(), QProblemB::performStep(), DenseMatrix::times(), DenseMatrix::transTimes(), QProblemB::updateFarBounds(), and QProblem::updateFarBounds().
Returns maximum of two reals.
x | First real number. |
y | Second real number. |
int getMin | ( | int | x, |
int | y | ||
) | [inline] |
Returns minimum of two integers.
x | First integer. |
y | Second integer. |
Referenced by QProblemB::computeCholesky(), QProblem::computeProjectedCholesky(), QProblem::performDriftCorrection(), QProblemB::performDriftCorrection(), QProblem::QProblem(), QProblemB::updateFarBounds(), and QProblem::updateFarBounds().
Returns minimum of two reals.
x | First real number. |
y | Second real number. |
Returns the N-norm of a vector.
v | Vector. |
n | Vector's dimension. |
type | Norm type, 1: one-norm, 2: Euclidean norm. |
References getAbs(), getSqrt(), INFTY, real_t, RET_INVALID_ARGUMENTS, and THROWERROR.
Referenced by normaliseConstraints(), and QProblemB::regulariseHessian().
Returns sign of a real-valued argument.
arg | real-valued argument whose sign is to be determined. |
int getSimpleStatus | ( | returnValue | returnvalue, |
BooleanType | doPrintStatus = BT_FALSE |
||
) |
Converts a returnValue from an (S)QProblem(B) object into a more simple status flag.
returnvalue | ReturnValue to be analysed. |
doPrintStatus | Flag indicating whether simple status shall be printed to screen. |
References BT_TRUE, getGlobalMessageHandler(), MessageHandling::getInfoVisibilityStatus(), RET_HOTSTART_STOPPED_INFEASIBILITY, RET_HOTSTART_STOPPED_UNBOUNDEDNESS, RET_INIT_FAILED_INFEASIBILITY, RET_INIT_FAILED_UNBOUNDEDNESS, RET_MAX_NWSR_REACHED, RET_SIMPLE_STATUS_P0, MessageHandling::setErrorCount(), MessageHandling::setInfoVisibilityStatus(), SUCCESSFUL_RETURN, THROWINFO, and VS_VISIBLE.
Returns the square-root of a real number.
x | Non-negative real number. |
Referenced by QProblemB::computeCholesky(), QProblemB::computeGivens(), QProblem::computeProjectedCholesky(), dpotrf_(), getNorm(), SparseMatrix::getRowNorm(), normaliseConstraints(), QProblem::removeBound(), QProblemB::removeBound(), QProblem::removeConstraint(), and spotrf_().
Tests whether two real_t-valued arguments are (numerically) equal.
x | First real number. |
y | Second real number. |
TOL | Tolerance for comparison. |
References BT_FALSE, BT_TRUE, and getAbs().
Referenced by dgemm_(), DenseMatrix::getCol(), SparseMatrix::getCol(), SparseMatrixRow::getCol(), getKktViolation(), DenseMatrix::getRow(), SparseMatrix::getRow(), SparseMatrixRow::getRow(), sgemm_(), DenseMatrix::times(), SparseMatrix::times(), SparseMatrixRow::times(), DenseMatrix::transTimes(), SparseMatrix::transTimes(), and SparseMatrixRow::transTimes().
BooleanType isZero | ( | real_t | x, |
real_t | TOL = ZERO |
||
) | [inline] |
Tests whether a real-valued argument is (numerically) zero.
x | Real number. |
TOL | Tolerance for comparison. |
References BT_FALSE, BT_TRUE, and getAbs().
Referenced by SparseMatrix::addToDiag(), SparseMatrixRow::addToDiag(), QProblemB::computeGivens(), QProblemB::determineHessianType(), dgemm_(), QProblem::setA(), sgemm_(), SparseMatrix::SparseMatrix(), SparseMatrixRow::SparseMatrixRow(), DenseMatrix::times(), SparseMatrix::times(), SparseMatrixRow::times(), DenseMatrix::transTimes(), SparseMatrix::transTimes(), and SparseMatrixRow::transTimes().
returnValue myPrintf | ( | const char * | s | ) |
Prints a string to desired output target (useful also for MATLAB output!).
s | String to be written. |
References getGlobalMessageHandler(), MessageHandling::getOutputFile(), RET_INVALID_ARGUMENTS, RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, SUCCESSFUL_RETURN, and THROWERROR.
Referenced by MessageHandling::listAllMessages(), main(), print(), Options::print(), Constraints::print(), Bounds::print(), printCopyrightNotice(), QProblem::printIteration(), QProblemB::printIteration(), QProblem::printProperties(), QProblemB::printProperties(), and MessageHandling::throwMessage().
returnValue normaliseConstraints | ( | int | nV, |
int | nC, | ||
real_t * | A, | ||
real_t * | lbA, | ||
real_t * | ubA, | ||
int | type = 1 |
||
) |
Normalises QP constraints.
nV | Number of variables. |
nC | Number of constraints. |
A | Input: Constraint matrix, Output: Normalised constraint matrix. |
lbA | Input: Constraints' lower bound vector, Output: Normalised constraints' lower bound vector. |
ubA | Input: Constraints' upper bound vector, Output: Normalised constraints' upper bound vector. |
type | Norm type, 1: one-norm, 2: Euclidean norm. |
References EPS, getNorm(), getSqrt(), INFTY, real_t, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and THROWERROR.
BEGIN_NAMESPACE_QPOASES returnValue print | ( | const real_t *const | v, |
int | n, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) vector.
v | Vector to be printed. |
n | Length of vector. |
name | Name of vector. |
References MAX_STRING_LENGTH, myPrintf(), and SUCCESSFUL_RETURN.
Referenced by print().
returnValue print | ( | const real_t *const | v, |
int | n, | ||
const int *const | V_idx, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) permuted vector.
v | Vector to be printed. |
n | Length of vector. |
V_idx | Pemutation vector. |
name | Name of vector. |
References MAX_STRING_LENGTH, myPrintf(), and SUCCESSFUL_RETURN.
returnValue print | ( | const real_t *const | M, |
int | nrow, | ||
int | ncol, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) matrix.
M | Matrix to be printed. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
name | Name of matrix. |
References MAX_STRING_LENGTH, myPrintf(), print(), and SUCCESSFUL_RETURN.
returnValue print | ( | const real_t *const | M, |
int | nrow, | ||
int | ncol, | ||
const int *const | ROW_idx, | ||
const int *const | COL_idx, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) permuted matrix.
M | Matrix to be printed. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
ROW_idx | Row pemutation vector. |
COL_idx | Column pemutation vector. |
name | Name of matrix. |
References MAX_STRING_LENGTH, myPrintf(), print(), and SUCCESSFUL_RETURN.
returnValue print | ( | const int *const | index, |
int | n, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) index array.
index | Index array to be printed. |
n | Length of index array. |
name | Name of index array. |
References MAX_STRING_LENGTH, myPrintf(), and SUCCESSFUL_RETURN.
Prints qpOASES copyright notice.
References myPrintf(), and SUCCESSFUL_RETURN.
Referenced by QProblemB::QProblemB().
returnValue readFromFile | ( | real_t * | data, |
int | nrow, | ||
int | ncol, | ||
const char * | datafilename | ||
) |
Reads a real_t matrix from file.
data | Matrix to be read from file. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
datafilename | Data file name. |
References __FILE__, __FUNC__, __LINE__, getGlobalMessageHandler(), MAX_STRING_LENGTH, real_t, RET_NOT_YET_IMPLEMENTED, RET_UNABLE_TO_OPEN_FILE, RET_UNABLE_TO_READ_FILE, SUCCESSFUL_RETURN, MessageHandling::throwError(), and VS_VISIBLE.
Referenced by SQProblem::hotstart(), QProblemB::init(), QProblem::init(), QProblemB::loadQPvectorsFromFile(), QProblem::loadQPvectorsFromFile(), readFromFile(), readOQPdata(), readOQPdimensions(), QProblemB::setupQPdataFromFile(), and QProblem::setupQPdataFromFile().
returnValue readFromFile | ( | real_t * | data, |
int | n, | ||
const char * | datafilename | ||
) |
Reads a real_t vector from file.
data | Vector to be read from file. |
n | Length of vector. |
datafilename | Data file name. |
References readFromFile().
returnValue readFromFile | ( | int * | data, |
int | n, | ||
const char * | datafilename | ||
) |
Reads an integer (column) vector from file.
data | Vector to be read from file. |
n | Length of vector. |
datafilename | Data file name. |
References __FILE__, __FUNC__, __LINE__, getGlobalMessageHandler(), MAX_STRING_LENGTH, RET_NOT_YET_IMPLEMENTED, RET_UNABLE_TO_OPEN_FILE, RET_UNABLE_TO_READ_FILE, SUCCESSFUL_RETURN, MessageHandling::throwError(), and VS_VISIBLE.
returnValue writeIntoFile | ( | const real_t *const | data, |
int | nrow, | ||
int | ncol, | ||
const char * | datafilename, | ||
BooleanType | append = BT_FALSE |
||
) |
Writes a real_t matrix into a file.
data | Matrix to be written into file. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
datafilename | Data file name. |
append | Indicates if data shall be appended if the file already exists (otherwise it is overwritten). |
References __FILE__, __FUNC__, __LINE__, BT_TRUE, getGlobalMessageHandler(), MAX_STRING_LENGTH, RET_NOT_YET_IMPLEMENTED, RET_UNABLE_TO_OPEN_FILE, SUCCESSFUL_RETURN, MessageHandling::throwError(), and VS_VISIBLE.
Referenced by writeIntoFile().
returnValue writeIntoFile | ( | const real_t *const | data, |
int | n, | ||
const char * | datafilename, | ||
BooleanType | append = BT_FALSE |
||
) |
Writes a real_t vector into a file.
data | Vector to be written into file. |
n | Length of vector. |
datafilename | Data file name. |
append | Indicates if data shall be appended if the file already exists (otherwise it is overwritten). |
References writeIntoFile().
returnValue writeIntoFile | ( | const int *const | integer, |
int | n, | ||
const char * | datafilename, | ||
BooleanType | append = BT_FALSE |
||
) |
Writes an integer (column) vector into a file.
integer | Integer vector to be written into file. |
n | Length of vector. |
datafilename | Data file name. |
append | Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). |
References __FILE__, __FUNC__, __LINE__, BT_TRUE, getGlobalMessageHandler(), MAX_STRING_LENGTH, RET_NOT_YET_IMPLEMENTED, RET_UNABLE_TO_OPEN_FILE, SUCCESSFUL_RETURN, MessageHandling::throwError(), and VS_VISIBLE.
returnValue writeIntoMatFile | ( | FILE *const | matFile, |
const real_t *const | data, | ||
int | nRows, | ||
int | nCols, | ||
const char * | name | ||
) |
Writes a real_t matrix/vector into a Matlab binary file.
matFile | Pointer to Matlab binary file. |
data | Data to be written into file. |
nRows | Row number of matrix. |
nCols | Column number of matrix. |
name | Matlab name of matrix/vector to be stored. |
References MatMatrixHeader::imaginaryPart, MatMatrixHeader::nCharName, MatMatrixHeader::nCols, MatMatrixHeader::nRows, MatMatrixHeader::numericFormat, real_t, RET_INVALID_ARGUMENTS, RET_NOT_YET_IMPLEMENTED, RET_UNABLE_TO_WRITE_FILE, and SUCCESSFUL_RETURN.
Referenced by writeIntoMatFile(), QProblem::writeQpDataIntoMatFile(), and QProblem::writeQpWorkspaceIntoMatFile().
returnValue writeIntoMatFile | ( | FILE *const | matFile, |
const int *const | data, | ||
int | nRows, | ||
int | nCols, | ||
const char * | name | ||
) |
Writes in integer matrix/vector into a Matlab binary file.
matFile | Pointer to Matlab binary file. |
data | Data to be written into file. |
nRows | Row number of matrix. |
nCols | Column number of matrix. |
name | Matlab name of matrix/vector to be stored. |
References real_t, and writeIntoMatFile().