PLDPSolver.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2009, 2010,
3  *
4  * Francois Keith
5  * Nicolas Mansard
6  * Olivier Stasse
7  *
8  * JRL, CNRS/AIST
9  *
10  * This file is part of walkGenJrl.
11  * walkGenJrl is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * walkGenJrl 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
19  * GNU General Lesser Public License for more details.
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with walkGenJrl. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * Research carried out within the scope of the
24  * Joint Japanese-French Robotics Laboratory (JRL)
25  */
33 #ifndef _PLDP_SOLVER_H_
34 
36 #include <vector>
37 
38 namespace Optimization {
39 namespace Solver {
43 class PLDPSolver {
44  public:
46  PLDPSolver(unsigned int CardU, double *iPu, double *Px, double *Pu,
47  double *iLQ);
48 
50  ~PLDPSolver();
51 
54  int SolveProblem(double *CstPartOfTheCostFunction,
55  unsigned int NbOfConstraints,
56  double *LinearPartOfConstraints,
57  double *CstPartOfConstraints, double *ZMPRef, double *XkYk,
58  double *X, std::vector<int> &SimilarConstraint,
59  unsigned int NumberOfRemovedConstraints,
60  bool StartingSequence);
61 
62  protected:
67  int ComputeInitialSolution(double *ZMPRef, double *XkYk,
68  bool StartingSequence);
69 
71  int PrecomputeiPuPx();
76  void InitializeSolver();
77 
80 
86 
93  int ForwardSubstitution();
94 
102  int BackwardSubstitution();
103 
107  double ComputeAlpha(vector<unsigned int> &NewActivatedConstraints,
108  vector<int> &SimilarConstraint);
109 
111  void StoreCurrentZMPSolution(double *XkYk);
112 
115  void WriteCurrentZMPSolution(string filename, double *XkYk);
116 
120  private:
122  double *m_Pu;
123 
125  double *m_iPu;
126 
128  double *m_Px;
129 
131  double *m_iPuPx;
132 
134  double *m_Vk;
135 
137  double *m_CstPartOfCostFunction;
138 
140  double *m_UnconstrainedDescentDirection;
141 
143  double *m_L;
144 
146  double *m_iL;
147 
149  double *m_iLQ;
150 
152  double *m_d;
153 
155  double *m_v1, *m_v2, *m_y;
156 
158  double *m_tmp1, *m_tmp2;
159 
161  double *m_A;
162 
164  double *m_b;
165 
167  bool *m_ConstraintsValueComputed;
168 
172  unsigned int m_NbMaxOfConstraints;
173 
175  unsigned int m_NbOfConstraints;
176 
178  unsigned int m_CardV;
179 
184  unsigned int m_DebugMode;
185 
187  int m_ItNb;
192  PatternGeneratorJRL::OptCholesky *m_OptCholesky;
193 
195  vector<unsigned int> m_ActivatedConstraints;
196 
198  vector<unsigned int> m_PreviouslyActivatedConstraints;
199 
201  bool m_HotStart;
202 
204  double *m_PreviousZMPSolution;
205 
207  double m_InternalTime;
208 
210  double m_tol;
211 
216  bool m_LimitedComputationTime;
217 
219  double m_AmountOfLimitedComputationTime;
220 
222 };
223 } // namespace Solver
224 } // namespace Optimization
225 #endif /* _PLDPSOLVER_H_*/
Optimization::Solver::PLDPSolver::InitializeSolver
void InitializeSolver()
Definition: PLDPSolver.cpp:131
Optimization::Solver::PLDPSolver::AllocateMemoryForSolver
void AllocateMemoryForSolver()
Definition: PLDPSolver.cpp:103
Optimization::Solver::PLDPSolver::ComputeInitialSolution
int ComputeInitialSolution(double *ZMPRef, double *XkYk, bool StartingSequence)
Definition: PLDPSolver.cpp:249
OptCholesky.hh
Optimization::Solver::PLDPSolver::ComputeProjectedDescentDirection
int ComputeProjectedDescentDirection()
Compute Projected descent direction.
Definition: PLDPSolver.cpp:351
Optimization::Solver::PLDPSolver::PLDPSolver
PLDPSolver(unsigned int CardU, double *iPu, double *Px, double *Pu, double *iLQ)
Constructor.
Definition: PLDPSolver.cpp:61
Optimization::Solver::PLDPSolver::ComputeAlpha
double ComputeAlpha(vector< unsigned int > &NewActivatedConstraints, vector< int > &SimilarConstraint)
Definition: PLDPSolver.cpp:463
Optimization::Solver::PLDPSolver::SolveProblem
int SolveProblem(double *CstPartOfTheCostFunction, unsigned int NbOfConstraints, double *LinearPartOfConstraints, double *CstPartOfConstraints, double *ZMPRef, double *XkYk, double *X, std::vector< int > &SimilarConstraint, unsigned int NumberOfRemovedConstraints, bool StartingSequence)
Solve the optimization problem.
Definition: PLDPSolver.cpp:569
Optimization::Solver::PLDPSolver::StoreCurrentZMPSolution
void StoreCurrentZMPSolution(double *XkYk)
Definition: PLDPSolver.cpp:862
Optimization
Definition: PLDPSolver.hh:38
Optimization::Solver::PLDPSolver::WriteCurrentZMPSolution
void WriteCurrentZMPSolution(string filename, double *XkYk)
Definition: PLDPSolver.cpp:888
Optimization::Solver::PLDPSolver::~PLDPSolver
~PLDPSolver()
Destructor.
Definition: PLDPSolver.cpp:153
Optimization::Solver::PLDPSolver
Definition: PLDPSolver.hh:43
Optimization::Solver::PLDPSolver::BackwardSubstitution
int BackwardSubstitution()
Compute v2 q (14b) in Dimitrov 2009. Second phase a Now solving LL^t v2 = v1 <-> L y = v1 with L^t v2...
Definition: PLDPSolver.cpp:320
Optimization::Solver::PLDPSolver::ForwardSubstitution
int ForwardSubstitution()
Forward substitution. First Phase EE^t v2 = v1 <-> LL^t v2 = v1 Now solving L y = v1.
Definition: PLDPSolver.cpp:297
Optimization::Solver::PLDPSolver::PrecomputeiPuPx
int PrecomputeiPuPx()
Definition: PLDPSolver.cpp:184