20#ifndef NUMERICS_LEMKE_ALGORITHM_H_
21#define NUMERICS_LEMKE_ALGORITHM_H_
23#include <fmatvec/fmatvec.h>
24#include <fmatvec/atom.h>
34 LemkeAlgorithm(
const fmatvec::SqrMat & M_,
const fmatvec::Vec & q_) :
36 assert(M_.rows() == q.size());
37 assert(M_.cols() == q.size());
40 LemkeAlgorithm(
const fmatvec::SymMat & M_,
const fmatvec::Vec & q_) {
62 void setSystem(
const fmatvec::SqrMat & M_,
const fmatvec::Vec & q_) {
63 assert(M_.rows() == q_.size());
64 assert(M_.cols() == q_.size());
72 void setSystem(
const fmatvec::SymMat & M_,
const fmatvec::Vec & q_) {
73 M.resize(M_.size(), fmatvec::NONINIT);
74 for (
int i = 0; i < M.size(); i++)
75 for (
int j = 0; j < M.size(); j++)
84 fmatvec::Vec
solve(
unsigned int maxloops = 0);
89 int findLexicographicMinimum(
const fmatvec::Mat &A,
const int & pivotColIndex);
90 bool LexicographicPositive(
const fmatvec::Vec & v);
91 void GaussJordanEliminationStep(fmatvec::Mat &A,
int pivotRowIndex,
int pivotColumnIndex,
const std::vector<size_t> & basis);
92 bool greaterZero(
const fmatvec::Vec & vector);
93 bool validBasis(
const std::vector<size_t> & basis);
Definition: lemke_algorithm.h:28
unsigned int steps
number of steps until the Lemke algorithm found a solution
Definition: lemke_algorithm.h:101
int getInfo()
return info of solution process
Definition: lemke_algorithm.h:48
void setSystem(const fmatvec::SymMat &M_, const fmatvec::Vec &q_)
set system with Matrix M and vector q
Definition: lemke_algorithm.h:72
int info
did the algorithm find a solution
Definition: lemke_algorithm.h:109
void setSystem(const fmatvec::SqrMat &M_, const fmatvec::Vec &q_)
set system with Matrix M and vector q
Definition: lemke_algorithm.h:62
fmatvec::Vec solve(unsigned int maxloops=0)
solve algorithm adapted from : Fast Implementation of Lemkeās Algorithm for Rigid Body Contact Simula...
Definition: lemke_algorithm.cc:34
int getSteps()
get the number of steps until the solution was found
Definition: lemke_algorithm.h:55
namespace MBSim
Definition: bilateral_constraint.cc:30