18 #ifndef BT_PATH_SOLVER_H
19 #define BT_PATH_SOLVER_H
25 #include "PATH/SimpleLCP.h"
26 #include "PATH/License.h"
27 #include "PATH/Error_Interface.h"
29 void __stdcall MyError(Void *data, Char *msg)
31 printf(
"Path Error: %s\n",msg);
33 void __stdcall MyWarning(Void *data, Char *msg)
35 printf(
"Path Warning: %s\n",msg);
43 #include "Dantzig/lcp.h"
51 License_SetString(
"2069810742&Courtesy_License&&&USR&2013&14_12_2011&1000&PATH&GEN&31_12_2013&0_0_0&0&0_0");
53 e.warning = MyWarning;
55 Error_SetInterface(&e);
61 MCP_Termination status;
64 int numVariables = b.rows();
81 for (
int i=0;i<A.rows();i++)
83 for (
int j=0;j<A.cols();j++)
94 int numNonZero = rowIndices.
size();
96 zResult.
resize(numVariables);
100 for (
int i=0;i<numVariables;i++)
108 SimpleLCP(numVariables,numNonZero,&rowIndices[0],&colIndices[0],&values[0],&rhs[0],&lowerBounds[0],&upperBounds[0], &status, &zResult[0]);
110 if (status != MCP_Solved)
112 static const char* gReturnMsgs[] = {
114 "MCP_Solved: The problem was solved",
115 "MCP_NoProgress: A stationary point was found",
116 "MCP_MajorIterationLimit: Major iteration limit met",
117 "MCP_MinorIterationLimit: Cumulative minor iteration limit met",
118 "MCP_TimeLimit: Ran out of time",
119 "MCP_UserInterrupt: Control-C, typically",
120 "MCP_BoundError: Problem has a bound error",
121 "MCP_DomainError: Could not find starting point",
122 "MCP_Infeasible: Problem has no solution",
123 "MCP_Error: An error occurred within the code",
124 "MCP_LicenseError: License could not be found",
128 printf(
"ERROR: The PATH MCP solver failed: %s\n", gReturnMsgs[(
unsigned int)status]);
129 printf(
"using Projected Gauss Seidel fallback\n");
134 for (
int i=0;i<numVariables;i++)
138 if (x[i] != zResult[i])
151 #endif //BT_PATH_SOLVER_H
void push_back(const T &_Val)
int size() const
return the number of elements in the array
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
original version written by Erwin Coumans, October 2013
void resize(int newsize, const T &fillData=T())