42 cost(), equalities(), inequalities() {
49 cost(_cost), equalities(_linearEqualities), inequalities(
50 _linearInequalities) {
54 void print(
const std::string&
s =
"") {
55 std::cout <<
s << std::endl;
56 cost.
print(
"Quadratic cost factors: ");
57 equalities.
print(
"Linear equality factors: ");
58 inequalities.
print(
"Linear inequality factors: ");
62 if (cachedCostVariableIndex_.
size() == 0)
68 Vector g = Vector::Zero(delta.
at(key).size());
72 g += factor->gradient(key, delta);
const gtsam::Symbol key('X', 0)
const_iterator find(Key key) const
Find the iterator for the requested variable entry.
size_t size() const
The number of variable entries. This is equal to the number of unique variable Keys.
Vector costGradient(Key key, const VectorValues &delta) const
Factor graph of all LinearInequality factors.
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print out graph to std::cout, with optional key formatter.
const_iterator end() const
Iterator to the first variable entry.
Factor graph of all LinearEquality factors.
void g(const string &key, int i)
GaussianFactorGraph cost
Quadratic cost factors.
Linear Factor Graph where all factors are Gaussians.
VariableIndex cachedCostVariableIndex_
std::shared_ptr< This > shared_ptr
shared_ptr to this class
InequalityFactorGraph inequalities
linear inequality constraints: cI(x) <= 0
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
EqualityFactorGraph equalities
linear equality constraints: cE(x) = 0
const sharedFactor at(size_t i) const
QP(const GaussianFactorGraph &_cost, const EqualityFactorGraph &_linearEqualities, const InequalityFactorGraph &_linearInequalities)
void print(const std::string &s="")
const VariableIndex & costVariableIndex() const
utility functions for loading datasets
std::uint64_t Key
Integer nonlinear key type.