gtsam  4.0.0
gtsam
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 <boost/assign.hpp>
23 
24 namespace gtsam {
25 
26  class Domain;
27 
32  class Constraint : public DiscreteFactor {
33 
34  public:
35 
36  typedef boost::shared_ptr<Constraint> shared_ptr;
37 
38  protected:
39 
41  Constraint(const KeyVector& js) :
42  DiscreteFactor(js) {
43  }
44 
47  DiscreteFactor(boost::assign::cref_list_of<1>(j)) {
48  }
49 
51  Constraint(Key j1, Key j2) :
52  DiscreteFactor(boost::assign::cref_list_of<2>(j1)(j2)) {
53  }
54 
56  template<class KeyIterator>
57  Constraint(KeyIterator beginKey, KeyIterator endKey) :
58  DiscreteFactor(beginKey, endKey) {
59  }
60 
61  public:
62 
65 
67  Constraint();
68 
70  virtual ~Constraint() {}
71 
75 
76  /*
77  * Ensure Arc-consistency
78  * @param j domain to be checked
79  * @param domains all other domains
80  */
81  virtual bool ensureArcConsistency(size_t j, std::vector<Domain>& domains) const = 0;
82 
84  virtual shared_ptr partiallyApply(const Values&) const = 0;
85 
86 
88  virtual shared_ptr partiallyApply(const std::vector<Domain>&) const = 0;
90  };
91 // DiscreteFactor
92 
93 }// namespace gtsam
Constraint(KeyIterator beginKey, KeyIterator endKey)
construct from container
Definition: Constraint.h:57
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: Constraint.h:32
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:34
virtual shared_ptr partiallyApply(const Values &) const =0
Partially apply known values.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:56
virtual ~Constraint()
Virtual destructor.
Definition: Constraint.h:70
Constraint()
Default constructor for I/O.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Constraint(const KeyVector &js)
Construct n-way factor.
Definition: Constraint.h:41
boost::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition: DiscreteFactor.h:40
Constraint(Key j)
Construct unary factor.
Definition: Constraint.h:46
Constraint(Key j1, Key j2)
Construct binary factor.
Definition: Constraint.h:51
Symbols for exporting classes and methods from DLLs.