TVM  0.9.4
LexLSHierarchicalLeastSquareSolver.h
Go to the documentation of this file.
1 /* Copyright 2022 CNRS-AIST JRL and CNRS-UM LIRMM */
2 
3 #pragma once
4 
7 
8 #include <lexls/lexlsi.h>
9 
10 namespace tvm::solver
11 {
12 class LexLSHLSSolverFactory;
13 
16 {
17  TVM_ADD_NON_DEFAULT_OPTION(big_number, constant::big_number)
18  TVM_ADD_NON_DEFAULT_OPTION(verbose, false)
19  TVM_ADD_NON_DEFAULT_OPTION(warmStart, false)
23  TVM_ADD_NON_DEFAULT_OPTION(feasibleFirstLevel, false)
24 
25 public:
27 };
28 
31 {
32 public:
34 
35 protected:
36  void initializeBuild_(const std::vector<int> & nEq, const std::vector<int> & nIneq, bool useBounds) override;
37  ImpactFromChanges resize_(const std::vector<int> & nEq, const std::vector<int> & nIneq, bool useBounds) override;
38  void addBound_(LinearConstraintPtr bound, RangePtr range, bool first) override;
41  void setMinimumNorm_() override;
42  void resetBounds_() override;
43  void preAssignmentProcess_() override;
44  void postAssignmentProcess_() override;
45  bool solve_() override;
46  const Eigen::VectorXd & result_() const override;
47  bool handleDoubleSidedConstraint_() const override { return true; }
50 
51  void removeBounds_(const Range & range) override;
55 
57 
58  void printProblemData_() const override;
59  void printDiagnostic_() const override;
60 
61 private:
62  Eigen::MatrixXd boundData_;
63  std::vector<Eigen::MatrixXd> data_;
64 
65  VectorRef xl_;
66  VectorRef xu_;
67  std::vector<MatrixRef> A_;
68  std::vector<VectorRef> l_;
69  std::vector<VectorRef> u_;
70 
71  std::vector<LexLS::Index> varIndex_;
72 
73  bool warmStart_;
74  Eigen::VectorXd x0_;
75  std::vector<LexLS::ConstraintIdentifier> act_;
76 
77  LexLS::internal::LexLSI solver_;
78 
79  bool autoMinNorm_;
80  double big_number_;
81  bool feasibleFirstLevel_;
82 };
83 
88 {
89 public:
92 
93  std::unique_ptr<abstract::HLSSolverFactory> clone() const override;
94  std::unique_ptr<abstract::HierarchicalLeastSquareSolver> createSolver() const override;
95 
96 private:
97  LexLSHLSSolverOptions options_;
98 };
99 
100 } // namespace tvm::solver
#define TVM_ADD_NON_DEFAULT_OPTION(optionName, defaultValue)
Definition: Option.h:30
#define TVM_DLLAPI
Definition: api.h:35
Definition: Range.h:19
Definition: LinearConstraint.h:56
Definition: AssignmentTarget.h:37
Definition: LexLSHierarchicalLeastSquareSolver.h:88
LexLSHLSSolverFactory(const LexLSHLSSolverOptions &options={})
std::unique_ptr< abstract::HierarchicalLeastSquareSolver > createSolver() const override
std::unique_ptr< abstract::HLSSolverFactory > clone() const override
Definition: LexLSHierarchicalLeastSquareSolver.h:16
Definition: LexLSHierarchicalLeastSquareSolver.h:31
void addIneqalityConstraint_(LinearConstraintPtr cstr, SolvingRequirementsPtr req) override
Range nextInequalityConstraintRange_(int lvl, const constraint::abstract::LinearConstraint &cstr) const override
const Eigen::VectorXd & result_() const override
bool handleDoubleSidedConstraint_() const override
Definition: LexLSHierarchicalLeastSquareSolver.h:47
void updateInequalityTargetData(int lvl, scheme::internal::AssignmentTarget &target) override
Range nextEqualityConstraintRange_(int lvl, const constraint::abstract::LinearConstraint &cstr) const override
LexLSHierarchicalLeastSquareSolver(const LexLSHLSSolverOptions &options={})
void applyImpactLogic(ImpactFromChanges &impact)
void removeBounds_(const Range &range) override
void addEqualityConstraint_(LinearConstraintPtr cstr, SolvingRequirementsPtr req) override
void updateEqualityTargetData(int lvl, scheme::internal::AssignmentTarget &target) override
void initializeBuild_(const std::vector< int > &nEq, const std::vector< int > &nIneq, bool useBounds) override
void addBound_(LinearConstraintPtr bound, RangePtr range, bool first) override
ImpactFromChanges resize_(const std::vector< int > &nEq, const std::vector< int > &nIneq, bool useBounds) override
void updateBoundTargetData(scheme::internal::AssignmentTarget &target) override
Definition: LexLSSolverOptions.h:18
Definition: HierarchicalLeastSquareSolver.h:215
Definition: HierarchicalLeastSquareSolver.h:35
Definition: HierarchicalLeastSquareSolver.h:18
Eigen::Ref< Eigen::VectorXd > VectorRef
Definition: defs.h:51
std::shared_ptr< constraint::abstract::LinearConstraint > LinearConstraintPtr
Definition: defs.h:59
std::shared_ptr< Range > RangePtr
Definition: defs.h:61
std::shared_ptr< requirements::SolvingRequirementsWithCallbacks > SolvingRequirementsPtr
Definition: defs.h:63