InequalityFactorGraph.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 
19 #pragma once
20 
25 
26 namespace gtsam {
27 
32 class InequalityFactorGraph: public FactorGraph<LinearInequality> {
33 private:
35 
36 public:
37  typedef boost::shared_ptr<InequalityFactorGraph> shared_ptr;
38 
40  void print(
41  const std::string& str = "",
42  const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override {
43  Base::print(str, keyFormatter);
44  }
45 
47  bool equals(const InequalityFactorGraph& other, double tol = 1e-9) const {
48  return Base::equals(other, tol);
49  }
50 
52  template <class... Args> void add(Args &&... args) {
53  emplace_shared<LinearInequality>(std::forward<Args>(args)...);
54  }
55 
59  double error(const VectorValues& x) const {
60  for (const sharedFactor& factor : *this) {
61  if (factor)
62  if (factor->error(x) > 1e-7)
63  return std::numeric_limits<double>::infinity();
64  }
65  return 0.0;
66  }
67 };
68 
70 template<>
71 struct traits<InequalityFactorGraph> : public Testable<InequalityFactorGraph> {
72 };
73 
74 } // \ namespace gtsam
75 
bool equals(const InequalityFactorGraph &other, double tol=1e-9) const
Definition: pytypes.h:1322
double error(const VectorValues &x) const
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
bool equals(const This &fg, double tol=1e-9) const
Factor Graph Values.
FactorGraph< LinearInequality > Base
Definition: pytypes.h:928
boost::shared_ptr< LinearInequality > sharedFactor
Shared pointer to a factor.
Definition: FactorGraph.h:98
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
Array< double, 1, 3 > e(1./3., 0.5, 2.)
traits
Definition: chartTesting.h:28
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
print out graph
void add(Args &&...args)
Add a linear inequality, forwards arguments to LinearInequality.
Factor Graph Base Class.
const G double tol
Definition: Group.h:83
boost::shared_ptr< InequalityFactorGraph > shared_ptr
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
LinearInequality derived from Base with constrained noise model.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:14