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 
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::FactorGraph< LinearInequality >::print
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print out graph to std::cout, with optional key formatter.
Definition: FactorGraph-inst.h:37
x
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
Definition: gnuplot_common_settings.hh:12
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
FactorGraph-inst.h
Factor Graph Base Class.
gtsam::InequalityFactorGraph::equals
bool equals(const InequalityFactorGraph &other, double tol=1e-9) const
Definition: InequalityFactorGraph.h:47
gtsam::FactorGraph
Definition: BayesTree.h:34
LinearInequality.h
LinearInequality derived from Base with constrained noise model.
gtsam::VectorValues
Definition: VectorValues.h:74
gtsam::KeyFormatter
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
gtsam::FactorGraph< LinearInequality >::equals
bool equals(const This &fg, double tol=1e-9) const
Check equality up to tolerance.
Definition: FactorGraph-inst.h:50
gtsam::InequalityFactorGraph::shared_ptr
std::shared_ptr< InequalityFactorGraph > shared_ptr
Definition: InequalityFactorGraph.h:37
VectorValues.h
Factor Graph Values.
gtsam::InequalityFactorGraph::print
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Definition: InequalityFactorGraph.h:40
gtsam::InequalityFactorGraph::Base
FactorGraph< LinearInequality > Base
Definition: InequalityFactorGraph.h:34
str
Definition: pytypes.h:1558
gtsam::InequalityFactorGraph::error
double error(const VectorValues &x) const
Definition: InequalityFactorGraph.h:59
gtsam::InequalityFactorGraph
Definition: InequalityFactorGraph.h:32
gtsam
traits
Definition: SFMdata.h:40
gtsam::Testable
Definition: Testable.h:152
gtsam::traits
Definition: Group.h:36
FactorGraph.h
Factor Graph Base Class.
args
Definition: pytypes.h:2210
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::FactorGraph< LinearInequality >::sharedFactor
std::shared_ptr< LinearInequality > sharedFactor
Shared pointer to a factor.
Definition: FactorGraph.h:62
pybind_wrapper_test_script.other
other
Definition: pybind_wrapper_test_script.py:42
gtsam::InequalityFactorGraph::add
void add(Args &&... args)
Add a linear inequality, forwards arguments to LinearInequality.
Definition: InequalityFactorGraph.h:52


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:28