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
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 
35 protected:
37  struct Problem
38  {
39  public:
41  : G(Eigen::Map<Eigen::MatrixXd>(0x0, 0, 0)), a(Eigen::VectorXd(0)), C(Eigen::MatrixXd(0, 0)),
42  bl(Eigen::VectorXd(0)), bu(Eigen::VectorXd(0)), xl(Eigen::VectorXd(0)), xu(Eigen::VectorXd(0))
43  {
44  }
45 
46  // Map<const EigenObj> and thus Ref<const EigenObj> has its operator= deleted.
47  // We thus need to delete as well for Problem. This is not an issue as a solver is not
48  // meant to be copied. If it was needed to implement this operator, on would need to
49  // use placement new tricks on the XXXConstRef members.
50  Problem & operator=(const Problem &) = delete;
58  };
59 
60  internal::InitTermination init_() override;
61  internal::SelectedConstraint selectViolatedConstraint_(const VectorConstRef & x) const override;
62  void computeStep_(VectorRef z, VectorRef r, const internal::SelectedConstraint & sc) const override;
63  StepLength computeStepLength_(const internal::SelectedConstraint & sc,
64  const VectorConstRef & x,
65  const VectorConstRef & u,
66  const VectorConstRef & z,
67  const VectorConstRef & r) const override;
68  bool addConstraint_(const internal::SelectedConstraint & sc) override;
69  bool removeConstraint_(int l) override;
70  double dot_(const internal::SelectedConstraint & sc, const VectorConstRef & z) override;
71  void resize_(int nbVar, int nbCstr, bool useBounds) override;
72 
73  virtual void initActiveSet();
74 
75  void addInitialConstraint(const internal::SelectedConstraint & sc);
76 
81 };
82 
83 } // namespace jrl::qp
jrl::qp::internal::SelectedConstraint
Definition: SelectedConstraint.h:13
jrl::qp::internal::Workspace
Definition: Workspace.h:18
jrl::qp::VectorConstRef
Eigen::Ref< const Eigen::VectorXd > VectorConstRef
Definition: defs.h:13
jrl::qp::GoldfarbIdnaniSolver::work_J_
internal::Workspace work_J_
Definition: GoldfarbIdnaniSolver.h:78
jrl::qp::TerminationStatus
TerminationStatus
Definition: enums.h:26
jrl::qp::GoldfarbIdnaniSolver
Definition: GoldfarbIdnaniSolver.h:12
jrl::qp::GoldfarbIdnaniSolver::Problem::G
MatrixRef G
Definition: GoldfarbIdnaniSolver.h:51
jrl::qp::MatrixConstRef
Eigen::Ref< const Eigen::MatrixXd > MatrixConstRef
Definition: defs.h:11
jrl::qp::GoldfarbIdnaniSolver::pb_
Problem pb_
Definition: GoldfarbIdnaniSolver.h:80
jrl::qp::GoldfarbIdnaniSolver::Problem::bu
VectorConstRef bu
Definition: GoldfarbIdnaniSolver.h:55
jrl::qp
Definition: blockArrowLLT.h:12
jrl::qp::DualSolver::StepLength
Definition: DualSolver.h:63
jrl::qp::GoldfarbIdnaniSolver::Problem::bl
VectorConstRef bl
Definition: GoldfarbIdnaniSolver.h:54
jrl::qp::GoldfarbIdnaniSolver::work_d_
internal::Workspace work_d_
Definition: GoldfarbIdnaniSolver.h:77
jrl::qp::GoldfarbIdnaniSolver::Problem::xu
VectorConstRef xu
Definition: GoldfarbIdnaniSolver.h:57
jrl::qp::DualSolver
Definition: DualSolver.h:23
JRLQP_DLLAPI
#define JRLQP_DLLAPI
Definition: api.h:35
jrl::qp::GoldfarbIdnaniSolver::Problem::Problem
Problem()
Definition: GoldfarbIdnaniSolver.h:40
jrl::qp::GoldfarbIdnaniSolver::Problem::a
VectorConstRef a
Definition: GoldfarbIdnaniSolver.h:52
jrl::qp::GoldfarbIdnaniSolver::Problem::C
MatrixConstRef C
Definition: GoldfarbIdnaniSolver.h:53
jrl::qp::GoldfarbIdnaniSolver::work_R_
internal::Workspace work_R_
Definition: GoldfarbIdnaniSolver.h:79
DualSolver.h
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::GoldfarbIdnaniSolver::Problem::xl
VectorConstRef xl
Definition: GoldfarbIdnaniSolver.h:56
jrl::qp::GoldfarbIdnaniSolver::Problem
Definition: GoldfarbIdnaniSolver.h:37
jrl::qp::internal::InitTermination
Definition: TerminationType.h:38