|
1 /************************************************************************* |
|
2 * * |
|
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * |
|
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org * |
|
5 * * |
|
6 * This library is free software; you can redistribute it and/or * |
|
7 * modify it under the terms of EITHER: * |
|
8 * (1) The GNU Lesser General Public License as published by the Free * |
|
9 * Software Foundation; either version 2.1 of the License, or (at * |
|
10 * your option) any later version. The text of the GNU Lesser * |
|
11 * General Public License is included with this library in the * |
|
12 * file LICENSE.TXT. * |
|
13 * (2) The BSD-style license that is included with this library in * |
|
14 * the file LICENSE-BSD.TXT. * |
|
15 * * |
|
16 * This library is distributed in the hope that it will be useful, * |
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * |
|
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. * |
|
20 * * |
|
21 *************************************************************************/ |
|
22 |
|
23 /* |
|
24 |
|
25 given (A,b,lo,hi), solve the LCP problem: A*x = b+w, where each x(i),w(i) |
|
26 satisfies one of |
|
27 (1) x = lo, w >= 0 |
|
28 (2) x = hi, w <= 0 |
|
29 (3) lo < x < hi, w = 0 |
|
30 A is a matrix of dimension n*n, everything else is a vector of size n*1. |
|
31 lo and hi can be +/- dInfinity as needed. the first `nub' variables are |
|
32 unbounded, i.e. hi and lo are assumed to be +/- dInfinity. |
|
33 |
|
34 we restrict lo(i) <= 0 and hi(i) >= 0. |
|
35 |
|
36 the original data (A,b) may be modified by this function. |
|
37 |
|
38 if the `findex' (friction index) parameter is nonzero, it points to an array |
|
39 of index values. in this case constraints that have findex[i] >= 0 are |
|
40 special. all non-special constraints are solved for, then the lo and hi values |
|
41 for the special constraints are set: |
|
42 hi[i] = abs( hi[i] * x[findex[i]] ) |
|
43 lo[i] = -hi[i] |
|
44 and the solution continues. this mechanism allows a friction approximation |
|
45 to be implemented. the first `nub' variables are assumed to have findex < 0. |
|
46 |
|
47 */ |
|
48 |
|
49 |
|
50 #ifndef _ODE_LCP_H_ |
|
51 #define _ODE_LCP_H_ |
|
52 |
|
53 |
|
54 void dSolveLCP (int n, dReal *A, dReal *x, dReal *b, dReal *w, |
|
55 int nub, dReal *lo, dReal *hi, int *findex); |
|
56 |
|
57 |
|
58 #endif |