17#ifndef BT_PATH_SOLVER_H
18#define BT_PATH_SOLVER_H
25#include "PATH/SimpleLCP.h"
26#include "PATH/License.h"
27#include "PATH/Error_Interface.h"
29void __stdcall MyError(Void *
data,
Char *msg)
31 printf(
"Path Error: %s\n", msg);
33void __stdcall MyWarning(Void *
data,
Char *msg)
35 printf(
"Path Warning: %s\n", msg);
41#include "Dantzig/lcp.h"
48 License_SetString(
"2069810742&Courtesy_License&&&USR&2013&14_12_2011&1000&PATH&GEN&31_12_2013&0_0_0&0&0_0");
50 e.warning = MyWarning;
52 Error_SetInterface(&
e);
59 int numVariables =
b.rows();
60 if (0 == numVariables)
72 btAlignedObjectArray<double> values;
73 btAlignedObjectArray<int> rowIndices;
74 btAlignedObjectArray<int> colIndices;
76 for (
int i = 0;
i <
A.rows();
i++)
78 for (
int j = 0; j <
A.cols(); j++)
89 int numNonZero = rowIndices.
size();
90 btAlignedObjectArray<double> zResult;
91 zResult.
resize(numVariables);
92 btAlignedObjectArray<double>
rhs;
93 btAlignedObjectArray<double> upperBounds;
94 btAlignedObjectArray<double> lowerBounds;
95 for (
int i = 0;
i < numVariables;
i++)
102 SimpleLCP(numVariables, numNonZero, &rowIndices[0], &colIndices[0], &values[0], &
rhs[0], &lowerBounds[0], &upperBounds[0], &
status, &zResult[0]);
106 static const char *gReturnMsgs[] = {
108 "MCP_Solved: The problem was solved",
109 "MCP_NoProgress: A stationary point was found",
110 "MCP_MajorIterationLimit: Major iteration limit met",
111 "MCP_MinorIterationLimit: Cumulative minor iteration limit met",
112 "MCP_TimeLimit: Ran out of time",
113 "MCP_UserInterrupt: Control-C, typically",
114 "MCP_BoundError: Problem has a bound error",
115 "MCP_DomainError: Could not find starting point",
116 "MCP_Infeasible: Problem has no solution",
117 "MCP_Error: An error occurred within the code",
118 "MCP_LicenseError: License could not be found",
121 printf(
"ERROR: The PATH MCP solver failed: %s\n", gReturnMsgs[(
unsigned int)
status]);
122 printf(
"using Projected Gauss Seidel fallback\n");
128 for (
int i = 0;
i < numVariables;
i++)
132 if (
x[
i] != zResult[
i])
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void resize(int newsize, const T &fillData=T())
SIMD_FORCE_INLINE void push_back(const T &_Val)
original version written by Erwin Coumans, October 2013
virtual bool solveMLCP(const btMatrixXu &A, const btVectorXu &b, btVectorXu &x, const btVectorXu &lo, const btVectorXu &hi, const btAlignedObjectArray< int > &limitDependency, int numIterations, bool useSparsity=true)=0