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