Bullet Collision Detection & Physics Library: btLemkeAlgorithm.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btLemkeAlgorithm.h
Go to the documentation of this file.
1/* Copyright (C) 2004-2013 MBSim Development Team
2
3Code was converted for the Bullet Continuous Collision Detection and Physics Library
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16//The original version is here
17//https://code.google.com/p/mbsim-env/source/browse/trunk/kernel/mbsim/numerics/linear_complementarity_problem/lemke_algorithm.cc
18//This file is re-distributed under the ZLib license, with permission of the original author (Kilian Grundl)
19//Math library was replaced from fmatvec to a the file src/LinearMath/btMatrixX.h
20//STL/std::vector replaced by btAlignedObjectArray
21
22#ifndef BT_NUMERICS_LEMKE_ALGORITHM_H_
23#define BT_NUMERICS_LEMKE_ALGORITHM_H_
24
25#include "LinearMath/btMatrixX.h"
26
27#include <vector> //todo: replace by btAlignedObjectArray
28
29 class btLemkeAlgorithm
30{
31public:
32 btLemkeAlgorithm(const btMatrixXu& M_, const btVectorXu& q_, const int& DEBUGLEVEL_ = 0) : DEBUGLEVEL(DEBUGLEVEL_)
33 {
34 setSystem(M_, q_);
35 }
36
37 /* GETTER / SETTER */
41 int getInfo()
42 {
43 return info;
44 }
45
49 int getSteps(void)
50 {
51 return steps;
52 }
53
57 void setSystem(const btMatrixXu& M_, const btVectorXu& q_)
58 {
59 m_M = M_;
60 m_q = q_;
61 }
62 /***************************************************/
63
67 btVectorXu solve(unsigned int maxloops = 0);
68
69 virtual ~btLemkeAlgorithm()
70 {
71 }
72
73protected:
74 int findLexicographicMinimum(const btMatrixXu& A, const int& pivotColIndex, const int& z0Row, bool& isRayTermination);
75 void GaussJordanEliminationStep(btMatrixXu& A, int pivotRowIndex, int pivotColumnIndex, const btAlignedObjectArray<int>& basis);
76 bool greaterZero(const btVectorXu& vector);
77 bool validBasis(const btAlignedObjectArray<int>& basis);
78
79 btMatrixXu m_M;
80 btVectorXu m_q;
81
85 unsigned int steps;
86
90 int DEBUGLEVEL;
91
98 int info;
99};
100
101#endif /* BT_NUMERICS_LEMKE_ALGORITHM_H_ */
btMatrixX.h
btMatrixXu
#define btMatrixXu
Definition: btMatrixX.h:529
btVectorXu
#define btVectorXu
Definition: btMatrixX.h:528
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition: btAlignedObjectArray.h:46
btLemkeAlgorithm
Definition: btLemkeAlgorithm.h:30
btLemkeAlgorithm::getSteps
int getSteps(void)
get the number of steps until the solution was found
Definition: btLemkeAlgorithm.h:49
btLemkeAlgorithm::m_M
btMatrixXu m_M
Definition: btLemkeAlgorithm.h:79
btLemkeAlgorithm::~btLemkeAlgorithm
virtual ~btLemkeAlgorithm()
Definition: btLemkeAlgorithm.h:69
btLemkeAlgorithm::solve
btVectorXu solve(unsigned int maxloops=0)
solve algorithm adapted from : Fast Implementation of Lemke’s Algorithm for Rigid Body Contact Simula...
Definition: btLemkeAlgorithm.cpp:60
btLemkeAlgorithm::validBasis
bool validBasis(const btAlignedObjectArray< int > &basis)
Definition: btLemkeAlgorithm.cpp:380
btLemkeAlgorithm::info
int info
did the algorithm find a solution
Definition: btLemkeAlgorithm.h:98
btLemkeAlgorithm::getInfo
int getInfo()
return info of solution process
Definition: btLemkeAlgorithm.h:41
btLemkeAlgorithm::findLexicographicMinimum
int findLexicographicMinimum(const btMatrixXu &A, const int &pivotColIndex, const int &z0Row, bool &isRayTermination)
Definition: btLemkeAlgorithm.cpp:223
btLemkeAlgorithm::greaterZero
bool greaterZero(const btVectorXu &vector)
Definition: btLemkeAlgorithm.cpp:365
btLemkeAlgorithm::DEBUGLEVEL
int DEBUGLEVEL
define level of debug output
Definition: btLemkeAlgorithm.h:90
btLemkeAlgorithm::btLemkeAlgorithm
btLemkeAlgorithm(const btMatrixXu &M_, const btVectorXu &q_, const int &DEBUGLEVEL_=0)
Definition: btLemkeAlgorithm.h:32
btLemkeAlgorithm::setSystem
void setSystem(const btMatrixXu &M_, const btVectorXu &q_)
set system with Matrix M and vector q
Definition: btLemkeAlgorithm.h:57
btLemkeAlgorithm::steps
unsigned int steps
number of steps until the Lemke algorithm found a solution
Definition: btLemkeAlgorithm.h:85
btLemkeAlgorithm::GaussJordanEliminationStep
void GaussJordanEliminationStep(btMatrixXu &A, int pivotRowIndex, int pivotColumnIndex, const btAlignedObjectArray< int > &basis)
Definition: btLemkeAlgorithm.cpp:319
btLemkeAlgorithm::m_q
btVectorXu m_q
Definition: btLemkeAlgorithm.h:80