bn.addEdge(bnodeCloudy, bnodeSprinkler);
bn.addEdge(bnodeSprinkler, bnodeWetGrass);
bn.addEdge(bnodeRain, bnodeWetGrass);
// this is simple
TabularCPD table = (TabularCPD) bnodeCloudy.getFunction();
table.setValue(0, 0.5);
table.setValue(1, 0.5);
// see image sprinkler.jpg to make sense out of the order
// plus mind the rder of execution of connect() above
table = (TabularCPD) bnodeSprinkler.getFunction();
table.setValue(0, 0.1);
table.setValue(1, 0.5);
table.setValue(2, 0.9);
table.setValue(3, 0.5);
// see image sprinkler.jpg to make sense out of the order
table = (TabularCPD) bnodeRain.getFunction();
table.setValue(0, 0.8);
table.setValue(1, 0.2);
table.setValue(2, 0.2);
table.setValue(3, 0.8);
// see image sprinkler.jpg to make sense out of the order
table = (TabularCPD) bnodeWetGrass.getFunction();
table.setValue(0, 0.99);
table.setValue(1, 0.9);
table.setValue(2, 0.9);
table.setValue(3, 0.0);
table.setValue(4, .01);
table.setValue(5, 0.1);
table.setValue(6, 0.1);
table.setValue(7, 1.0);
// Rain.setEvidence(new DiscreteEvidence((Discrete)Rain.getDomain(),
// "true"));;
// WetGrass.setEvidence(new
// DiscreteEvidence((Discrete)Sprinkler.getDomain(), "true"));;