Constraint.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 
18 #pragma once
19 
22 #include <gtsam_unstable/dllexport.h>
23 
24 #include <map>
25 
26 namespace gtsam {
27 
28 class Domain;
29 using Domains = std::map<Key, Domain>;
30 
35 class GTSAM_UNSTABLE_EXPORT Constraint : public DiscreteFactor {
36  public:
37  typedef std::shared_ptr<Constraint> shared_ptr;
38 
39  protected:
42 
45 
47  Constraint(const KeyVector& js) : DiscreteFactor(js) {}
48 
50  template <class KeyIterator>
51  Constraint(KeyIterator beginKey, KeyIterator endKey)
52  : DiscreteFactor(beginKey, endKey) {}
53 
54  public:
57 
59  Constraint();
60 
62  ~Constraint() override {}
63 
67 
68  /*
69  * Ensure Arc-consistency by checking every possible value of domain j.
70  * @param j domain to be checked
71  * @param (in/out) domains all domains, but only domains->at(j) will be checked.
72  * @return true if domains->at(j) was changed, false otherwise.
73  */
74  virtual bool ensureArcConsistency(Key j, Domains* domains) const = 0;
75 
77  virtual shared_ptr partiallyApply(const DiscreteValues&) const = 0;
78 
80  virtual shared_ptr partiallyApply(const Domains&) const = 0;
84 
86  std::string markdown(const KeyFormatter& keyFormatter = DefaultKeyFormatter,
87  const Names& names = {}) const override {
88  return "`Constraint` on " + std::to_string(size()) + " variables\n";
89  }
90 
92  std::string html(const KeyFormatter& keyFormatter = DefaultKeyFormatter,
93  const Names& names = {}) const override {
94  return "<p>Constraint on " + std::to_string(size()) + " variables</p>";
95  }
96 
98 };
99 // DiscreteFactor
100 
101 } // namespace gtsam
gtsam::Constraint::Constraint
Constraint(KeyIterator beginKey, KeyIterator endKey)
construct from container
Definition: Constraint.h:51
gtsam::Constraint::markdown
std::string markdown(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const override
Render as markdown table.
Definition: Constraint.h:86
gtsam::Constraint::html
std::string html(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const Names &names={}) const override
Render as html table.
Definition: Constraint.h:92
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:92
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
gtsam::Constraint::Constraint
Constraint(const KeyVector &js)
Construct n-way constraint factor.
Definition: Constraint.h:47
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
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
DiscreteFactor.h
gtsam::Domains
std::map< Key, Domain > Domains
Definition: Constraint.h:29
process_shonan_timing_results.names
dictionary names
Definition: process_shonan_timing_results.py:175
gtsam
traits
Definition: SFMdata.h:40
DiscreteValues.h
gtsam::DiscreteFactor::Names
DiscreteValues::Names Names
Translation table from values to strings.
Definition: DiscreteFactor.h:139
gtsam::DiscreteValues
Definition: DiscreteValues.h:34
gtsam::Constraint::Constraint
Constraint(Key j1, Key j2)
Construct binary constraint factor.
Definition: Constraint.h:44
gtsam::DiscreteFactor
Definition: DiscreteFactor.h:39
gtsam::Constraint::shared_ptr
std::shared_ptr< Constraint > shared_ptr
Definition: Constraint.h:37
gtsam::Constraint
Definition: Constraint.h:35
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
gtsam::Constraint::~Constraint
~Constraint() override
Virtual destructor.
Definition: Constraint.h:62
j1
double j1(double x)
Definition: j1.c:174
gtsam::Constraint::Constraint
Constraint(Key j)
Construct unary constraint factor.
Definition: Constraint.h:41


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:18