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::LP
Definition: LP.h:51
gtsam::maxKey
Key maxKey(const PROBLEM &problem)
Definition: ActiveSetSolver.h:191
gtsam::LP::equalities
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
Definition: LP.h:55
gtsam::QP::inequalities
InequalityFactorGraph inequalities
linear inequality constraints: cI(x) <= 0
Definition: QP.h:34
gtsam::LP::cost
LinearCost cost
Linear cost factor.
Definition: LP.h:54
gtsam::VectorValues
Definition: VectorValues.h:74
gtsam::LinearCost
Definition: LinearCost.h:31
gtsam::QPInitSolver::qp_
const QP & qp_
Definition: QPInitSolver.h:33
gtsam::LPInitSolver
Definition: LPInitSolver.h:53
gtsam::QP::equalities
EqualityFactorGraph equalities
linear equality constraints: cE(x) = 0
Definition: QP.h:33
gtsam::LP::inequalities
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
Definition: LP.h:56
gtsam::QP
Definition: QP.h:31
gtsam
traits
Definition: SFMdata.h:40
LPInitSolver.h
This finds a feasible solution for an LP problem.
gtsam::QPInitSolver::QPInitSolver
QPInitSolver(const QP &qp)
Constructor with a QP problem.
Definition: QPInitSolver.h:36
gtsam::QPInitSolver::solve
VectorValues solve() const
Definition: QPInitSolver.h:39
gtsam::QPInitSolver
Definition: QPInitSolver.h:32
gtsam::LPInitSolver::solve
VectorValues solve() const
Definition: LPInitSolver.cpp:27
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:13:02