gtsam 4.1.1
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
24namespace gtsam {
25
33 const QP& qp_;
34public:
36 QPInitSolver(const QP& qp) : qp_(qp) {}
37
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 finds a feasible solution for an LP problem.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
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:69
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74
This class defines a linear cost function c'x which is a JacobianFactor with only one row.
Definition: LinearCost.h:31
Data structure of a Linear Program.
Definition: LP.h:51
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
Definition: LP.h:56
LinearCost cost
Linear cost factor.
Definition: LP.h:54
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
Definition: LP.h:55
This LPInitSolver implements the strategy in Matlab: http://www.mathworks.com/help/optim/ug/linear-pr...
Definition: LPInitSolver.h:52
VectorValues solve() const
Definition: LPInitSolver.cpp:27
Struct contains factor graphs of a Quadratic Programming problem.
Definition: QP.h:31
InequalityFactorGraph inequalities
linear inequality constraints: cI(x) <= 0
Definition: QP.h:34
EqualityFactorGraph equalities
linear equality constraints: cE(x) = 0
Definition: QP.h:33
This class finds a feasible solution for a QP problem.
Definition: QPInitSolver.h:32
QPInitSolver(const QP &qp)
Constructor with a QP problem.
Definition: QPInitSolver.h:36
VectorValues solve() const
Definition: QPInitSolver.h:39