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 std::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 
void add(Args &&... args)
Add a linear inequality, forwards arguments to LinearInequality.
bool equals(const This &fg, double tol=1e-9) const
Check equality up to tolerance.
Definition: pytypes.h:2012
bool equals(const InequalityFactorGraph &other, double tol=1e-9) const
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print out graph to std::cout, with optional key formatter.
Factor Graph Values.
FactorGraph< LinearInequality > Base
std::shared_ptr< InequalityFactorGraph > shared_ptr
Definition: pytypes.h:1403
double error(const VectorValues &x) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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
traits
Definition: chartTesting.h:28
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Factor Graph Base Class.
const G double tol
Definition: Group.h:86
std::shared_ptr< LinearInequality > sharedFactor
Shared pointer to a factor.
Definition: FactorGraph.h:105
Factor Graph Base Class.
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 Tue Jul 4 2023 02:34:22