gtsam 4.1.1
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
21#include <gtsam_unstable/dllexport.h>
22
23#include <boost/assign.hpp>
24
25namespace gtsam {
26
27class Domain;
28
33class Constraint : public DiscreteFactor {
34 public:
35 typedef boost::shared_ptr<Constraint> shared_ptr;
36
37 protected:
40
42 Constraint(Key j) : DiscreteFactor(boost::assign::cref_list_of<1>(j)) {}
43
46 : DiscreteFactor(boost::assign::cref_list_of<2>(j1)(j2)) {}
47
49 template <class KeyIterator>
50 Constraint(KeyIterator beginKey, KeyIterator endKey)
51 : DiscreteFactor(beginKey, endKey) {}
52
53 public:
56
59
61 ~Constraint() override {}
62
66
67 /*
68 * Ensure Arc-consistency
69 * @param j domain to be checked
70 * @param domains all other domains
71 */
72 virtual bool ensureArcConsistency(size_t j,
73 std::vector<Domain>& domains) const = 0;
74
76 virtual shared_ptr partiallyApply(const Values&) const = 0;
77
79 virtual shared_ptr partiallyApply(const std::vector<Domain>&) const = 0;
81};
82// DiscreteFactor
83
84} // namespace gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
An assignment from labels to value index (size_t).
Definition: Assignment.h:34
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:34
boost::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition: DiscreteFactor.h:40
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: Constraint.h:33
~Constraint() override
Virtual destructor.
Definition: Constraint.h:61
Constraint(const KeyVector &js)
Construct n-way factor.
Definition: Constraint.h:39
Constraint()
Default constructor for I/O.
virtual shared_ptr partiallyApply(const Values &) const =0
Partially apply known values.
Constraint(Key j1, Key j2)
Construct binary factor.
Definition: Constraint.h:45
Constraint(KeyIterator beginKey, KeyIterator endKey)
construct from container
Definition: Constraint.h:50
virtual shared_ptr partiallyApply(const std::vector< Domain > &) const =0
Partially apply known values, domain version.
Constraint(Key j)
Construct unary factor.
Definition: Constraint.h:42