gtsam  4.1.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
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
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 }
gtsam::QPInitSolver
This class finds a feasible solution for a QP problem.
Definition: QPInitSolver.h:32
gtsam::LPInitSolver
This LPInitSolver implements the strategy in Matlab: http://www.mathworks.com/help/optim/ug/linear-pr...
Definition: LPInitSolver.h:52
gtsam::LP::equalities
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
Definition: LP.h:55
gtsam::LP
Data structure of a Linear Program.
Definition: LP.h:51
gtsam::QP::equalities
EqualityFactorGraph equalities
linear equality constraints: cE(x) = 0
Definition: QP.h:33
gtsam::QP
Struct contains factor graphs of a Quadratic Programming problem.
Definition: QP.h:31
LPInitSolver.h
This finds a feasible solution for an LP problem.
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
gtsam::QP::inequalities
InequalityFactorGraph inequalities
linear inequality constraints: cI(x) <= 0
Definition: QP.h:34
gtsam::VectorValues
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74
gtsam::LinearCost
This class defines a linear cost function c'x which is a JacobianFactor with only one row.
Definition: LinearCost.h:31
gtsam::QPInitSolver::QPInitSolver
QPInitSolver(const QP &qp)
Constructor with a QP problem.
Definition: QPInitSolver.h:36
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::QPInitSolver::solve
VectorValues solve() const
Definition: QPInitSolver.h:39
gtsam::LPInitSolver::solve
VectorValues solve() const
Definition: LPInitSolver.cpp:27
gtsam::maxKey
Key maxKey(const PROBLEM &problem)
Find the max key in a problem.
Definition: ActiveSetSolver.h:192
gtsam::LP::cost
LinearCost cost
Linear cost factor.
Definition: LP.h:54
gtsam::LP::inequalities
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
Definition: LP.h:56