gtsam  4.0.0 gtsam
QPInitSolver.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
9
10  * -------------------------------------------------------------------------- */
11
20 #pragma once
21
23
24 namespace gtsam {
25
32 class QPInitSolver {
33  const QP& qp_;
34 public:
36  QPInitSolver(const QP& qp) : qp_(qp) {}
37
39  VectorValues solve() const {
40  // Make an LP with any linear cost function. It doesn't matter for
41  // initialization.
42  LP initProblem;
43  // make an unrelated key for a random variable cost
44  Key newKey = maxKey(qp_) + 1;
45  initProblem.cost = LinearCost(newKey, Vector::Ones(1));
46  initProblem.equalities = qp_.equalities;
47  initProblem.inequalities = qp_.inequalities;
48  LPInitSolver initSolver(initProblem);
49  return initSolver.solve();
50  }
51 };
52
53
54 }
This class finds a feasible solution for a QP problem.
Definition: QPInitSolver.h:32
This LPInitSolver implements the strategy in Matlab: http://www.mathworks.com/help/optim/ug/linear-pr...
Definition: LPInitSolver.h:53
EqualityFactorGraph equalities
linear equality constraints: cE(x) = 0
Definition: QP.h:33
Key maxKey(const PROBLEM &problem)
Find the max key in a problem.
Definition: ActiveSetSolver.h:192
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Struct contains factor graphs of a Quadratic Programming problem.
Definition: QP.h:31
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
Definition: LP.h:56
QPInitSolver(const QP &qp)
Constructor with a QP problem.
Definition: QPInitSolver.h:36
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:73
Data structure of a Linear Program.
Definition: LP.h:51
This class defines a linear cost function c'x which is a JacobianFactor with only one row.
Definition: LinearCost.h:31
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
InequalityFactorGraph inequalities
linear inequality constraints: cI(x) <= 0
Definition: QP.h:34
LinearCost cost
Linear cost factor.
Definition: LP.h:54
This finds a feasible solution for an LP problem.
VectorValues solve() const
Definition: QPInitSolver.h:39
VectorValues solve() const
Definition: LPInitSolver.cpp:27
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
Definition: LP.h:55