Go to the documentation of this file.
28 using namespace gtsam;
39 graph.
add(
A & AI,
"1 1 1 0 1 1 1 1 0 1 1 1");
42 graph.
add(
A & ME,
"1 1 1 0 1 1 1 1 0 1 1 1");
45 graph.
add(
A & PC,
"1 1 1 0 1 1 1 1 0 1 1 1");
46 graph.
add(ME & AI,
"0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0");
47 graph.
add(PC & ME,
"0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0");
48 graph.
add(PC & AI,
"0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0");
51 auto actualMPE =
graph.optimize();
119 auto normalization = newFactor.
max(newFactor.
size());
121 newFactor = newFactor / *normalization;
133 normalization = expectedFactor.
max(expectedFactor.
size());
135 expectedFactor = expectedFactor / *normalization;
145 expectedBayesNet.
add(signature);
146 expectedBayesNet.
add(
B |
A =
"5/3 3/5");
147 expectedBayesNet.
add(
A %
"1/1");
156 auto actualMPE =
graph.optimize();
161 auto mpeProbability = expectedBayesNet(mpe);
169 {Ordering::COLAMD, Ordering::METIS, Ordering::NATURAL,
191 {Ordering::COLAMD, Ordering::METIS, Ordering::NATURAL,
194 auto actualMPE = dag.
argmax();
196 auto actualMPE2 =
graph.optimize();
217 auto actualMPE =
graph.optimize();
232 graph.
add(
S &
C &
T2,
"0.80 0.20 0.20 0.80 0.95 0.05 0.05 0.95");
242 auto actualMPE =
graph.optimize();
270 " var0[label=\"0\"];\n"
271 " var1[label=\"1\"];\n"
272 " var2[label=\"2\"];\n"
274 " factor0[label=\"\", shape=point];\n"
277 " factor1[label=\"\", shape=point];\n"
292 vector<string>
names{
"C",
"A",
"B"};
299 " var0[label=\"C\"];\n"
300 " var1[label=\"A\"];\n"
301 " var2[label=\"B\"];\n"
303 " factor0[label=\"\", shape=point];\n"
306 " factor1[label=\"\", shape=point];\n"
323 "`DiscreteFactorGraph` of size 2\n"
340 vector<string>
names{
"C",
"A",
"B"};
static int runAllTests(TestResult &result)
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown.
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define EXPECT_LONGS_EQUAL(expected, actual)
#define EXPECT(condition)
std::shared_ptr< This > shared_ptr
const KeyFormatter & formatter
void dot(std::ostream &os, const Values &values, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const GraphvizFormatting &writer=GraphvizFormatting()) const
Output to graphviz format, stream version, with Values/extra options.
Provides additional testing facilities for common data structures.
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
const HybridBayesNet bayesNet
Elimination tree for discrete factors.
std::pair< DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr > EliminateDiscrete(const DiscreteFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for DiscreteFactorGraph.
std::pair< std::shared_ptr< BayesNetType >, std::shared_ptr< FactorGraphType > > eliminate(Eliminate function) const
static const Pose3 T2(Rot3::Rodrigues(0.3, 0.2, 0.1), P2)
Discrete Bayes Tree, the result of eliminating a DiscreteJunctionTree.
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
static enum @1096 ordering
const gtsam::Symbol key('X', 0)
OrderingType
Type of ordering to use.
TEST(DiscreteFactorGraph, test)
TEST_UNSAFE(DiscreteFactorGraph, debugScheduler)
void add(const DiscreteKey &key, const std::string &spec)
Matrix< Scalar, Dynamic, Dynamic > C
std::pair< Key, size_t > DiscreteKey
shared_ptr max(size_t nrFrontals) const
Create new factor by maximizing over all values with the same separator.
std::shared_ptr< This > shared_ptr
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
void product(const MatrixType &m)
DiscreteValues argmax(DiscreteValues given=DiscreteValues()) const
argmax by back-substitution, optionally given certain variables.
static const Similarity3 T1(R, Point3(3.5, -8.2, 4.2), 1)
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
NonlinearFactorGraph graph
std::uint64_t Key
Integer nonlinear key type.
Matrix< RealScalar, Dynamic, Dynamic > M
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:39:49