gtsam  4.1.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 
20 #include <gtsam_unstable/dllexport.h>
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 
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
gtsam::Constraint
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: Constraint.h:32
gtsam::Constraint::Constraint
Constraint(const KeyVector &js)
Construct n-way factor.
Definition: Constraint.h:41
gtsam::Constraint::partiallyApply
virtual shared_ptr partiallyApply(const std::vector< Domain > &) const =0
Partially apply known values, domain version.
gtsam::Assignment
An assignment from labels to value index (size_t).
Definition: Assignment.h:34
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
gtsam::DiscreteFactor
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:34
gtsam::Constraint::Constraint
Constraint()
Default constructor for I/O.
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::Constraint::partiallyApply
virtual shared_ptr partiallyApply(const Values &) const =0
Partially apply known values.
gtsam::Constraint::Constraint
Constraint(Key j)
Construct unary factor.
Definition: Constraint.h:46
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
gtsam::Constraint::~Constraint
virtual ~Constraint()
Virtual destructor.
Definition: Constraint.h:70
gtsam::Constraint::Constraint
Constraint(KeyIterator beginKey, KeyIterator endKey)
construct from container
Definition: Constraint.h:57
gtsam::DiscreteFactor::shared_ptr
boost::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition: DiscreteFactor.h:40
gtsam::Constraint::Constraint
Constraint(Key j1, Key j2)
Construct binary factor.
Definition: Constraint.h:51
DiscreteFactor.h