DART  6.7.3
BoxedLcpConstraintSolver.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_CONSTRAINT_BOXEDLCPCONSTRAINTSOLVER_HPP_
34 #define DART_CONSTRAINT_BOXEDLCPCONSTRAINTSOLVER_HPP_
35 
38 
39 namespace dart {
40 namespace constraint {
41 
43 {
44 public:
47  double timeStep, BoxedLcpSolverPtr boxedLcpSolver = nullptr);
48 
50  void setBoxedLcpSolver(BoxedLcpSolverPtr lcpSolver);
51 
54 
55 protected:
56  // Documentation inherited.
57  void solveConstrainedGroup(ConstrainedGroup& group) override;
58 
61 
63  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> mA;
64 
66  Eigen::VectorXd mX;
67 
69  Eigen::VectorXd mB;
70 
72  Eigen::VectorXd mW;
73 
75  Eigen::VectorXd mLo;
76 
78  Eigen::VectorXd mHi;
79 
81  Eigen::VectorXi mFIndex;
82 
84  Eigen::VectorXi mOffset;
85 
86 #ifndef NDEBUG
87 private:
89  bool isSymmetric(std::size_t n, double* A);
90 
92  bool isSymmetric(
93  std::size_t n, double* A, std::size_t begin, std::size_t end);
94 
96  void print(
97  std::size_t n,
98  double* A,
99  double* x,
100  double* lo,
101  double* hi,
102  double* b,
103  double* w,
104  int* findex);
105 #endif
106 };
107 
108 } // namespace constraint
109 } // namespace dart
110 
111 #endif // DART_CONSTRAINT_BOXEDLCPCONSTRAINTSOLVER_HPP_
Definition: BoxedLcpConstraintSolver.hpp:43
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > mA
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:63
Eigen::VectorXd mLo
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:75
bool isSymmetric(std::size_t n, double *A)
Return true if the matrix is symmetric.
Definition: BoxedLcpConstraintSolver.cpp:208
Eigen::VectorXi mOffset
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:84
ConstBoxedLcpSolverPtr getBoxedLcpSolver() const
Returns boxed LCP (BLCP) solver.
Definition: BoxedLcpConstraintSolver.cpp:75
Eigen::VectorXd mX
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:66
BoxedLcpSolverPtr mBoxedLcpSolver
Boxed LCP solver.
Definition: BoxedLcpConstraintSolver.hpp:60
Eigen::VectorXd mW
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:72
void print(std::size_t n, double *A, double *x, double *lo, double *hi, double *b, double *w, int *findex)
Print debug information.
Definition: BoxedLcpConstraintSolver.cpp:273
void setBoxedLcpSolver(BoxedLcpSolverPtr lcpSolver)
Sets boxed LCP (BLCP) solver.
Definition: BoxedLcpConstraintSolver.cpp:62
Eigen::VectorXd mB
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:69
Eigen::VectorXd mHi
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:78
Eigen::VectorXi mFIndex
Cache data for boxed LCP formulation.
Definition: BoxedLcpConstraintSolver.hpp:81
void solveConstrainedGroup(ConstrainedGroup &group) override
Definition: BoxedLcpConstraintSolver.cpp:81
BoxedLcpConstraintSolver(double timeStep, BoxedLcpSolverPtr boxedLcpSolver=nullptr)
Constructor.
Definition: BoxedLcpConstraintSolver.cpp:53
ConstrainedGroup is a group of skeletons that interact each other with constraints.
Definition: ConstrainedGroup.hpp:58
ConstraintSolver manages constraints and computes constraint impulses.
Definition: ConstraintSolver.hpp:56
std::shared_ptr< const BoxedLcpSolver > ConstBoxedLcpSolverPtr
Definition: SmartPointer.hpp:55
std::shared_ptr< BoxedLcpSolver > BoxedLcpSolverPtr
Definition: SmartPointer.hpp:55
Definition: BulletCollisionDetector.cpp:63