Go to the documentation of this file.
37 template <
class LinearGraph>
40 for (
const typename LinearGraph::sharedFactor& factor : linearGraph) {
41 if (!factor)
continue;
42 for (
Key key : factor->keys())
43 keyDimMap[
key] = factor->getDim(factor->find(
key));
63 return (equalities.
error(
x) == 0 && inequalities.
error(
x) == 0);
67 void print(
const string&
s =
"")
const {
68 std::cout <<
s << std::endl;
69 cost.
print(
"Linear cost: ");
70 equalities.
print(
"Linear equality factors: ");
71 inequalities.
print(
"Linear inequality factors: ");
81 if (!cachedConstrainedKeyDimMap_.empty())
82 return cachedConstrainedKeyDimMap_;
86 cachedConstrainedKeyDimMap_.insert(keysDim2.begin(), keysDim2.end());
87 return cachedConstrainedKeyDimMap_;
93 if (it != cost.
end())
g = cost.
getA(it).transpose();
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Factor graph of all LinearEquality factors.
bool equals(const GaussianFactor &lf, double tol=1e-9) const override
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print out graph to std::cout, with optional key formatter.
const KeyDimMap & constrainedKeyDimMap() const
EqualityFactorGraph equalities
Linear equality constraints: cE(x) = 0.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Factor graph of all LinearInequality factors.
const_iterator find(Key key) const
find
bool equals(const InequalityFactorGraph &other, double tol=1e-9) const
KeyDimMap cachedConstrainedKeyDimMap_
cached key-dim map of all variables in the constraints
LinearCost cost
Linear cost factor.
Vector costGradient(Key key, const VectorValues &delta) const
bool equals(const This &fg, double tol=1e-9) const
Check equality up to tolerance.
LinearCost derived from JacobianFactor to support linear cost functions c'x.
bool isFeasible(const VectorValues &x) const
check feasibility
InequalityFactorGraph inequalities
Linear inequality constraints: cI(x) <= 0.
double error(const VectorValues &x) const
Compute error of a guess.
void print(const string &s="") const
print
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
const_iterator end() const
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
void g(const string &key, int i)
const gtsam::Symbol key('X', 0)
double error(const VectorValues &x) const
std::map< Key, uint32_t > KeyDimMap
Mapping between variable's key and its corresponding dimensionality.
KeyVector::const_iterator const_iterator
Const iterator over keys.
constABlock getA(const_iterator variable) const
bool equals(const LP &other, double tol=1e-9) const
equals
KeyDimMap collectKeyDim(const LinearGraph &linearGraph)
std::uint64_t Key
Integer nonlinear key type.
std::shared_ptr< LP > shared_ptr
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:44