Go to the documentation of this file.
27 using namespace gtsam;
29 int main(
int argc,
char **argv) {
30 const int nrNodes = 4;
31 const size_t nrStates = 3;
35 vector<DiscreteKey>
keys;
36 for (
int k = 0; k < nrNodes; k++) {
38 keys.push_back(key_i);
46 const string transition =
"8/1/1 1/8/1 1/1/8";
47 for (
int k = 1; k < nrNodes; k++) {
70 chordal->print(
"Eliminated");
73 cout <<
"\n10 samples:" << endl;
74 for (
size_t k = 0; k < 10; k++) {
75 auto sample = chordal->sample();
80 cout <<
"\nComputing Node Marginals .." << endl;
82 for (
int k = 0; k < nrNodes; k++) {
85 ss <<
"marginal " << k;
std::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
int main(int argc, char **argv)
static std::stringstream ss
A class for computing marginals in a DiscreteFactorGraph.
static enum @1096 ordering
void add(const DiscreteKey &key, const std::string &spec)
std::pair< Key, size_t > DiscreteKey
std::shared_ptr< This > shared_ptr
DiscreteValues optimize(OptionalOrderingType orderingType={}) const
Find the maximum probable explanation (MPE) by doing max-product.
Marginals marginals(graph, result)
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:24