BlockGISolver.h
Go to the documentation of this file.
1 /* Copyright 2020 CNRS-AIST JRL */
2 
3 #pragma once
4 
5 #include <vector>
6 
7 #include <Eigen/Core>
8 
9 #include <jrl-qp/DualSolver.h>
14 
16 {
19 {
20 public:
21  BlockGISolver();
24  BlockGISolver(int nbVar, int nbCstr, bool useBounds);
25 
26  virtual ~BlockGISolver() = default;
27 
34  const VectorConstRef & a,
35  const structured::StructuredC & C,
36  const VectorConstRef & bl,
37  const VectorConstRef & bu,
38  const VectorConstRef & xl,
39  const VectorConstRef & xu,
40  const std::vector<ActivationStatus> & as = {});
41 
42 protected:
44  struct Problem
45  {
46  public:
48  : G(), a(Eigen::VectorXd(0)), C(), bl(Eigen::VectorXd(0)), bu(Eigen::VectorXd(0)), xl(Eigen::VectorXd(0)),
49  xu(Eigen::VectorXd(0))
50  {
51  }
52 
53  // Map<const EigenObj> and thus Ref<const EigenObj> has its operator= deleted.
54  // We thus need to delete as well for Problem. This is not an issue as a solver is not
55  // meant to be copied. If it was needed to implement this operator, on would need to
56  // use placement new tricks on the XXXConstRef members.
57  Problem & operator=(const Problem &) = delete;
65  std::vector<ActivationStatus> as;
66  };
67 
68  internal::InitTermination init_() override;
69  internal::SelectedConstraint selectViolatedConstraint_(const VectorConstRef & x) const override;
70  void computeStep_(VectorRef z, VectorRef r, const internal::SelectedConstraint & sc) const override;
71  StepLength computeStepLength_(const internal::SelectedConstraint & sc,
72  const VectorConstRef & x,
73  const VectorConstRef & u,
74  const VectorConstRef & z,
75  const VectorConstRef & r) const override;
76  bool addConstraint_(const internal::SelectedConstraint & sc) override;
77  bool removeConstraint_(int l) override;
78  double dot_(const internal::SelectedConstraint & sc, const VectorConstRef & z) override;
79  void resize_(int nbVar, int nbCstr, bool useBounds) override;
80 
81  virtual internal::TerminationType processInitialActiveSet();
82  virtual internal::TerminationType initializeComputationData();
83  virtual internal::TerminationType initializePrimalDualPoints();
84 
88  // internal::Workspace<> work_tmp_; // for multiplication by Householder transform
89  // internal::Workspace<> work_hCoeffs_; // for initial QR decomposition
93 };
94 
95 } // namespace jrl::qp::experimental
jrl::qp::experimental::BlockGISolver::Problem::bu
VectorConstRef bu
Definition: BlockGISolver.h:62
jrl::qp::internal::SelectedConstraint
Definition: SelectedConstraint.h:13
jrl::qp::experimental::BlockGISolver::Problem::xu
VectorConstRef xu
Definition: BlockGISolver.h:64
jrl::qp::structured::StructuredQR
Definition: StructuredQR.h:16
jrl::qp::internal::Workspace
Definition: Workspace.h:18
jrl::qp::experimental::BlockGISolver::Problem::G
structured::StructuredG G
Definition: BlockGISolver.h:58
jrl::qp::structured::StructuredJ
Definition: StructuredJ.h:16
jrl::qp::internal::TerminationType
Definition: TerminationType.h:15
StructuredG.h
jrl::qp::VectorConstRef
Eigen::Ref< const Eigen::VectorXd > VectorConstRef
Definition: defs.h:13
jrl::qp::experimental::BlockGISolver::work_cx_
internal::Workspace work_cx_
Definition: BlockGISolver.h:90
StructuredJ.h
jrl::qp::TerminationStatus
TerminationStatus
Definition: enums.h:26
StructuredC.h
jrl::qp::experimental::BlockGISolver::pb_
Problem pb_
Definition: BlockGISolver.h:92
jrl::qp::structured::StructuredG
Definition: StructuredG.h:14
jrl::qp::DualSolver::StepLength
Definition: DualSolver.h:63
jrl::qp::experimental::BlockGISolver::J_
structured::StructuredJ J_
Definition: BlockGISolver.h:86
jrl::qp::structured::StructuredC
Definition: StructuredC.h:15
jrl::qp::experimental::BlockGISolver::Problem
Definition: BlockGISolver.h:44
jrl::qp::experimental::BlockGISolver::Problem::C
structured::StructuredC C
Definition: BlockGISolver.h:60
jrl::qp::DualSolver
Definition: DualSolver.h:23
StructuredQR.h
jrl::qp::experimental::BlockGISolver::work_d_
internal::Workspace work_d_
Definition: BlockGISolver.h:85
jrl::qp::experimental::BlockGISolver::Problem::a
VectorConstRef a
Definition: BlockGISolver.h:59
JRLQP_DLLAPI
#define JRLQP_DLLAPI
Definition: api.h:35
jrl::qp::experimental::BlockGISolver::QR_
structured::StructuredQR QR_
Definition: BlockGISolver.h:87
jrl::qp::experimental::BlockGISolver
Definition: BlockGISolver.h:18
jrl::qp::experimental::BlockGISolver::Problem::bl
VectorConstRef bl
Definition: BlockGISolver.h:61
jrl::qp::experimental
Definition: BlockGISolver.h:15
jrl::qp::experimental::BlockGISolver::Problem::as
std::vector< ActivationStatus > as
Definition: BlockGISolver.h:65
jrl::qp::experimental::BlockGISolver::Problem::xl
VectorConstRef xl
Definition: BlockGISolver.h:63
DualSolver.h
jrl::qp::experimental::BlockGISolver::Problem::Problem
Problem()
Definition: BlockGISolver.h:47
jrl::qp::VectorRef
Eigen::Ref< Eigen::VectorXd > VectorRef
Definition: defs.h:14
jrl::qp::experimental::BlockGISolver::work_bact_
internal::Workspace work_bact_
Definition: BlockGISolver.h:91
jrl::qp::internal::InitTermination
Definition: TerminationType.h:38