26 using namespace gtsam;
28 int main(
int argc,
char **argv) {
30 DiscreteKey Asia(0, 2), Smoking(4, 2), Tuberculosis(3, 2), LungCancer(6, 2),
31 Bronchitis(7, 2), Either(5, 2), XRay(2, 2), Dyspnea(1, 2);
32 asia.
add(Asia %
"99/1");
33 asia.
add(Smoking %
"50/50");
35 asia.
add(Tuberculosis | Asia =
"99/1 95/5");
36 asia.
add(LungCancer | Smoking =
"99/1 90/10");
37 asia.
add(Bronchitis | Smoking =
"70/30 40/60");
39 asia.
add((Either | Tuberculosis, LungCancer) =
"F T T T");
41 asia.
add(XRay | Either =
"95/5 2/98");
42 asia.
add((Dyspnea | Either, Bronchitis) =
"9/1 2/8 3/7 1/9");
45 vector<string> pretty = {
"Asia",
"Dyspnea",
"XRay",
"Tuberculosis",
46 "Smoking",
"Either",
"LungCancer",
"Bronchitis"};
69 fg.
add(Dyspnea,
"0 1");
77 cout <<
"\n10 samples:" << endl;
78 for (
size_t i = 0;
i < 10;
i++) {
void add(const DiscreteKey &j, SOURCE table)
static enum @843 ordering
boost::shared_ptr< BayesTreeType > eliminateMultifrontal(OptionalOrderingType orderingType=boost::none, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
void add(const Signature &s)
const KeyFormatter & formatter
std::pair< Key, size_t > DiscreteKey
A class for computing marginals in a DiscreteFactorGraph.
int main(int argc, char **argv)
boost::shared_ptr< Values > sharedValues
boost::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType=boost::none, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
boost::shared_ptr< This > shared_ptr
std::uint64_t Key
Integer nonlinear key type.
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override