solver
LinSolver.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 
17 
18 namespace solver {
19 
26  class LinSolver
27  {
28  public:
29  LinSolver(){}
30  ~LinSolver(){}
31 
32  void updateMatrix();
33  void initializeMatrix();
34  FactStatus numericFactorization();
35  void initialize(Cone& cone, SolverSetting& stgs, SolverStorage& stg);
36  int solve(const Eigen::Ref<const Eigen::VectorXd>& permB, OptimizationVector& searchDir, bool is_initialization = false);
37  void matrixTransposeTimesVector(const Eigen::SparseMatrix<double>& A,const Eigen::Ref<const Eigen::VectorXd>& eig_x, Eigen::Ref<Eigen::VectorXd> eig_y, bool add = true, bool is_new = true);
38 
39  // Some getter and setter methods
40  int perm(int id) { return perm_.indices()[id]; }
41  int invPerm(int id) { return invPerm_.indices()[id]; }
42  Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>& perm() { return perm_; }
43  Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>& invPerm() { return invPerm_; }
44  const Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>& perm() const { return perm_; }
45  const Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>& invPerm() const { return invPerm_; }
46 
47  private:
48  inline Cone& getCone() { return *cone_; }
49  inline SolverStorage& getStorage() { return *storage_; }
50  inline SolverSetting& getSetting() { return *setting_; }
51  inline linalg::SparseCholesky& getCholesky() { return cholesky_; }
52 
53  void buildProblem();
54  void findPermutation();
55  void resizeProblemData();
56  void symbolicFactorization();
57 
58  private:
59  Cone* cone_;
60  SolverStorage* storage_;
61  SolverSetting* setting_;
62  linalg::SparseCholesky cholesky_;
63 
64  ConicVector Gdx_;
65  double static_regularization_;
66  ExtendedVector sign_, permSign_;
67  Eigen::VectorXd permX_, Pe_, permdX_;
68  Eigen::SparseMatrix<double> kkt_, permKkt_;
69  Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic> perm_, invPerm_, permK_;
70  };
71 }
ECOS - Embedded Conic Solver.
Class that provides storage space for the optimization matrices, vectors and variables.
Definition: Cone.hpp:380
Helper class to define an optimization vector, including primal and dual variables, and variables to render the optimization problem homogeneous.
Definition: Cone.hpp:322
Class that provides functionality for handling solution of linear systems in optimization problems...
Definition: LinSolver.hpp:26
Class that provides access to all environment variables required by the solver.
Definition: SolverSetting.hpp:43
Definition: Cone.hpp:20
Class to perform an LDL factorization of a matrix.
Definition: SparseCholesky.hpp:58
This class contains all information about the conic optimization problem, and provides functionality ...
Definition: Cone.hpp:87
Helper class to work with variables, which are members of a proper convex cone.
Definition: Cone.hpp:232
Helper class to work with optimization variables, lay down in an extended order.
Definition: Cone.hpp:280
ECOS - Embedded Conic Solver.