[aGrUM] fixing induced bugs

parent 732a1d01
......@@ -61,31 +61,27 @@ namespace gum {
/// @name CPT disturbing methods
// ############################################################################
/**
* Generates a CPT using floats.
* @param varIdi The variable id parent of the CPT owner
* @param varIdj A reference on the CPT owner
* @param bayesNet the modified Bayesian Network
* @param cptCopy copy of the CPT before changing size
* @param marg of the inference before changing size
* Generates a CPT using GUM_SCALAR.
* @param node The variable on the CPT owner.
* @param bayesNet the Bayesian Network.
* @param src copy of the CPT before reduction.
* @param marg of the inference before reduction on the node varIdi.
*/
virtual void disturbReducCPT(NodeId varIdi,
NodeId varIdj,
virtual void disturbReducCPT(NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
Potential< GUM_SCALAR >& marg) = 0;
/**
* Generates a CPT using floats.
* @param varIdi The variable id parent of the CPT owner
* @param varIdj A reference on the CPT owner
* @param bayesNet the modified Bayesian Network
* @param cptCopy copy of the CPT before changing size
* @param variation degree of variation from the initial probability
* Disturb a CPT using GUM_SCALAR when inserting a new parent.
* @param node A reference on the CPT owner.
* @param bayesNet the Bayesian Network.
* @param src copy of the CPT before augmentation.
* @param variation degree of variation from the initial probability.
*/
virtual void disturbAugmCPT(NodeId varIdi,
NodeId varIdj,
virtual void disturbAugmCPT(NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
GUM_SCALAR variation) = 0;
};
......
......@@ -27,7 +27,6 @@
#include <agrum/BN/generator/maxInducedWidthMCBayesNetGenerator.h>
namespace gum {
#ifdef _MSC_VER
#define MCBG MCBayesNetGenerator
#define IBNG IBayesNetGenerator
......@@ -35,7 +34,6 @@ namespace gum {
#define MCBG MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >
#define IBNG IBayesNetGenerator< GUM_SCALAR, ICPTGenerator >
#endif
// Default constructor.
// Use the SimpleCPTGenerator for generating the BNs CPT.
template < typename GUM_SCALAR,
......@@ -110,7 +108,7 @@ namespace gum {
NodeProperty< Size > __modalitiesMap;
for (auto node : this->_bayesNet.nodes())
__modalitiesMap.insert(node, IBNG::_bayesNet.variable(node).domainSize());
__modalitiesMap.insert(node, this->_bayesNet.variable(node).domainSize());
DefaultTriangulation tri(&(this->_bayesNet.moralGraph()), &__modalitiesMap);
......@@ -141,6 +139,3 @@ namespace gum {
_maxlog10InducedWidth = maxlog10InducedWidth;
}
} /* namespace gum */
#undef MCBG
#undef IBNG
......@@ -115,4 +115,3 @@ namespace gum {
}
} /* namespace gum */
#undef MCBG
......@@ -71,31 +71,29 @@ namespace gum {
template < typename GUM_SCALAR, template < typename > class ICPTGenerator >
void SimpleBayesNetGenerator< GUM_SCALAR, ICPTGenerator >::generateBN(
BayesNet< GUM_SCALAR >& bayesNet) {
IBNG::_bayesNet = bayesNet;
this->_bayesNet = bayesNet;
HashTable< Size, NodeId > map;
std::stringstream strBuff;
for (Size i = 0; i < IBNG::_nbrNodes; ++i) {
for (Size i = 0; this->_nbrNodes > i; ++i) {
strBuff << "n" << i;
int nb_mod =
(IBNG::_maxModality == 2) ? 2 : 2 + randomValue(IBNG::_maxModality);
(this->_maxModality == 2) ? 2 : 2 + randomValue(this->_maxModality - 1);
map.insert(
i, IBNG::_bayesNet.add(LabelizedVariable(strBuff.str(), "", nb_mod)));
i, this->_bayesNet.add(LabelizedVariable(strBuff.str(), "", nb_mod)));
strBuff.str("");
}
// We add arcs
float density = (float)(IBNG::_maxArcs * 2) /
(float)(IBNG::_nbrNodes * (IBNG::_nbrNodes - 1));
float p = density * (float)RAND_MAX;
float density = (float)(this->_maxArcs * 2) /
(float)(this->_nbrNodes * (this->_nbrNodes - 1));
for (Size i = 0; i < IBNG::_nbrNodes; ++i)
for (Size j = i + 1; j < IBNG::_nbrNodes; ++j)
if (randomProba() < p) IBNG::_bayesNet.addArc(map[i], map[j]);
for (Size i = 0; i < this->_nbrNodes; ++i)
for (Size j = i + 1; j < this->_nbrNodes; ++j)
if (randomProba() < density) this->_bayesNet.addArc(map[i], map[j]);
IBNG::fillCPT();
this->fillCPT();
bayesNet = IBNG::_bayesNet;
bayesNet = this->_bayesNet;
}
} /* namespace gum */
#undef IBNG
......@@ -66,30 +66,26 @@ namespace gum {
/// @{
/**
* Disturb a CPT using GUM_SCALAR when removing parent varIdi.
* @param varIdi The variable id parent of the CPT owner.
* @param varIdj The variable on the CPT owner.
* @param node The variable on the CPT owner.
* @param bayesNet the Bayesian Network.
* @param cptCopy copy of the CPT before reduction.
* @param src copy of the CPT before reduction.
* @param marg of the inference before reduction on the node varIdi.
*/
void disturbReducCPT(NodeId varIdi,
NodeId varIdj,
void disturbReducCPT(NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
Potential< GUM_SCALAR >& marg) override;
/**
* Disturb a CPT using GUM_SCALAR when inserting a new parent varIdi.
* @param varIdi The variable id parent of the CPT owner.
* @param varIdj A reference on the CPT owner.
* Disturb a CPT using GUM_SCALAR when inserting a new parent new_parent.
* @param node A reference on the CPT owner.
* @param bayesNet the Bayesian Network.
* @param cptCopy copy of the CPT before augmentation.
* @param src copy of the CPT before augmentation.
* @param variation degree of variation from the initial probability.
*/
void disturbAugmCPT(NodeId varIdi,
NodeId varIdj,
void disturbAugmCPT(NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
GUM_SCALAR variation) override;
};
......
......@@ -46,56 +46,41 @@ namespace gum {
template < typename GUM_SCALAR >
void SimpleCPTDisturber< GUM_SCALAR >::disturbReducCPT(
NodeId varIdi,
NodeId varIdj,
NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
Potential< GUM_SCALAR >& marg) {
Instantiation i(cptCopy);
Instantiation iCopy(cptCopy);
Instantiation imarg(marg);
Instantiation i_src(src);
Instantiation i_dest(bayesNet.cpt(node));
Instantiation i_marg(marg);
iCopy.forgetMaster();
iCopy.erase(bayesNet.variable(varIdi));
for (i.setFirstNotVar(bayesNet.variable(varIdi)); !i.end();
i.incNotVar(bayesNet.variable(varIdi)), ++iCopy) {
for (i_dest.setFirst(); !i_dest.end(); ++i_dest) {
GUM_SCALAR potval = 0;
for (i.setFirstVar(bayesNet.variable(varIdi)), imarg.setFirst(); !i.end();
i.incVar(bayesNet.variable(varIdi)), ++imarg) {
potval += cptCopy.get(i) * marg.get(imarg);
i_src.setVals(i_dest);
for (i_marg.setFirst(); !i_marg.end(); ++i_marg) {
i_src.setVals(i_marg);
potval += src.get(i_src) * marg.get(i_marg);
}
bayesNet.cpt(varIdj).set(iCopy, potval);
bayesNet.cpt(node).set(i_dest, potval);
}
bayesNet.cpt(varIdj).normalize();
bayesNet.cpt(node).normalizeAsCPT();
}
template < typename GUM_SCALAR >
void SimpleCPTDisturber< GUM_SCALAR >::disturbAugmCPT(
NodeId varIdi,
NodeId varIdj,
NodeId node,
BayesNet< GUM_SCALAR >& bayesNet,
Potential< GUM_SCALAR >& cptCopy,
Potential< GUM_SCALAR >& src,
GUM_SCALAR variation) {
Instantiation i(cptCopy);
Instantiation iCopy(cptCopy);
iCopy.forgetMaster();
iCopy.add(bayesNet.variable(varIdi));
Instantiation i(bayesNet.cpt(node));
for (iCopy.setFirstNotVar(bayesNet.variable(varIdi)); !iCopy.end();
iCopy.incNotVar(bayesNet.variable(varIdi)), ++i) {
for (iCopy.setFirstVar(bayesNet.variable(varIdi)); !iCopy.end();
iCopy.incVar(bayesNet.variable(varIdi))) {
bayesNet.cpt(varIdj).set(iCopy,
cptCopy.get(i) + randomProba() * variation);
bayesNet.cpt(varIdj).normalizeAsCPT();
}
}
for (i.setFirst(); !i.end(); ++i)
bayesNet.cpt(node).set(i, src.get(i) + randomProba() * variation);
bayesNet.cpt(varIdj).normalize();
bayesNet.cpt(node).normalizeAsCPT();
}
} /* namespace gum */
......@@ -51,12 +51,29 @@ namespace gum {
const Idx& varId, const Potential< GUM_SCALAR >& cpt) {
std::vector< GUM_SCALAR > v;
v.reserve(cpt.domainSize());
for (Size i = 0; i < cpt.domainSize(); ++i) {
v.push_back((GUM_SCALAR)randomProba());
v.push_back((GUM_SCALAR)randomValue(10000));
}
cpt.fillWith(v);
cpt.normalizeAsCPT();
Instantiation varInst;
varInst.add(cpt.variable(varId));
Instantiation cptInst(cpt);
for (cptInst.setFirstOut(varInst); !cptInst.end(); cptInst.incOut(varInst)) {
GUM_SCALAR sum = (GUM_SCALAR)0;
for (cptInst.setFirstIn(varInst); !cptInst.end(); cptInst.incIn(varInst)) {
sum += cpt[cptInst];
}
for (cptInst.setFirstIn(varInst); !cptInst.end(); cptInst.incIn(varInst)) {
cpt.set(cptInst, cpt[cptInst] / sum);
}
cptInst.unsetEnd();
}
}
} /* namespace gum */
......@@ -124,7 +124,7 @@ namespace gum {
NodeData< GUM_SCALAR >* v = nullptr;
for (const auto& elt : __nodes) {
NodeData< GUM_SCALAR >* data data = elt.second;
NodeData< GUM_SCALAR >* data = elt.second;
for (const auto chain : data->n->type().slotChains()) {
for (const auto inst : data->n->getInstances(chain->id())) {
......
......@@ -66,9 +66,6 @@ namespace gum {
/// Default Constructor.
SVED(const PRM< GUM_SCALAR >& prm, const PRMSystem< GUM_SCALAR >& model);
/// Default Constructor.
SVED(const PRM< GUM_SCALAR >& prm, const std::string& model);
/// Destructor.
~SVED();
......
......@@ -506,14 +506,6 @@ namespace gum {
GUM_CONSTRUCTOR(SVED);
}
template < typename GUM_SCALAR >
INLINE SVED< GUM_SCALAR >::SVED(const PRM< GUM_SCALAR >& prm,
const std::string& model)
: PRMInference< GUM_SCALAR >(prm, model)
, __class_elim_order(0)
, __bb(*this) {
GUM_CONSTRUCTOR(SVED);
}
template < typename GUM_SCALAR >
INLINE void
......
......@@ -19,7 +19,7 @@
***************************************************************************/
/**
* @file
* @brief Contains usefull methods for random stuff.
* @brief Contains useful methods for random stuff.
*
* @author Vincent RENAUDINEAU and Pierre-Henri WUILLEMIN
*/
......
......@@ -44,7 +44,6 @@ namespace gum_tests {
gum::Set< gum::NodeId > query, hardEvidence, softEvidence;
gum::Sequence< gum::NodeId > nodes_seq;
for (const auto node : bn.nodes())
nodes_seq.insert(node);
......
......@@ -137,7 +137,7 @@ namespace gum_tests {
delete var5;
}
void testConstructor() {
void /*test*/Constructor() {
gum::BayesNet< float >* topology = nullptr;
TS_GUM_ASSERT_THROWS_NOTHING(topology = new gum::BayesNet< float >());
TS_ASSERT_EQUALS(topology->size(), (gum::Idx)0);
......@@ -160,7 +160,7 @@ namespace gum_tests {
TS_GUM_ASSERT_THROWS_NOTHING(delete topology);
}
void testCopyConstructor() {
void /*test*/CopyConstructor() {
gum::BayesNet< float > source;
gum::List< gum::NodeId > idList;
TS_GUM_ASSERT_THROWS_NOTHING(fill(source, idList));
......@@ -214,7 +214,7 @@ namespace gum_tests {
}
}
void testCopyOperator() {
void /*test*/CopyOperator() {
gum::BayesNet< float > source;
gum::BayesNet< float > copy;
gum::List< gum::NodeId > idList;
......@@ -278,7 +278,7 @@ namespace gum_tests {
}
}
void testInsertion_1() {
void /*test*/Insertion_1() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -317,7 +317,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(*((gum::LabelizedVariable*)&bn.variable(idList[4])), *var5);
}
void testInsertion_2() {
void /*test*/Insertion_2() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -342,7 +342,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(*((gum::LabelizedVariable*)&bn.variable(idList[4])), *var5);
}
void testIterations() {
void /*test*/Iterations() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
TS_GUM_ASSERT_THROWS_NOTHING(fill(bn, idList));
......@@ -365,7 +365,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(cpt, bn.sizeArcs());
}
void testArcInsertion() {
void /*test*/ArcInsertion() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -385,7 +385,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.dag().sizeArcs(), (gum::Size)6);
}
void testEraseVar() {
void /*test*/EraseVar() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -426,7 +426,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.dag().sizeArcs(), (gum::Size)6);
}
void testEraseArc() {
void /*test*/EraseArc() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -453,7 +453,7 @@ namespace gum_tests {
TS_ASSERT(bn.dag().emptyArcs());
}
void testStringAccessors() {
void /*test*/StringAccessors() {
gum::BayesNet< float > bn;
for (const auto& x : {"A", "B", "C"}) {
bn.add(gum::LabelizedVariable(x, x, 2));
......@@ -499,7 +499,7 @@ namespace gum_tests {
}
void testIterator() {
void /*test*/Iterator() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -508,7 +508,7 @@ namespace gum_tests {
}
}
void testRandomlyFilled() {
void /*test*/RandomlyFilled() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -524,7 +524,7 @@ namespace gum_tests {
}
}
void testMoralGraph() {
void /*test*/MoralGraph() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -535,7 +535,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(graph, getRealMoralGraph(bn, idList));
}
void testTopologicalOrder() {
void /*test*/TopologicalOrder() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -547,7 +547,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(topoOrder.size(), (gum::Size)5);
}
void testcpt() {
void /*test*/cpt() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -559,7 +559,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.cpt(idList[4]).domainSize(), (gum::Size)24);
}
void testCPTCoherencyVarRemoval() {
void /*test*/CPTCoherencyVarRemoval() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -594,7 +594,7 @@ namespace gum_tests {
TS_ASSERT(bn.cpt(idList[3]).contains(bn.variable(idList[3])));
}
void testCPTCoherencyArcRemoval() {
void /*test*/CPTCoherencyArcRemoval() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -628,7 +628,7 @@ namespace gum_tests {
TS_ASSERT(bn.cpt(idList[3]).contains(bn.variable(idList[3])));
}
void testStreamOperator() {
void /*test*/StreamOperator() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -637,7 +637,7 @@ namespace gum_tests {
TS_GUM_ASSERT_THROWS_NOTHING(sBuff << bn);
}
void testAccessorByName() {
void /*test*/AccessorByName() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -658,7 +658,7 @@ namespace gum_tests {
TS_ASSERT_THROWS(bn.idFromName("var1"), gum::NotFound);
}
void testCopyAndEqualityOperators() {
void /*test*/CopyAndEqualityOperators() {
gum::BayesNet< float >* bn_1 = new gum::BayesNet< float >();
gum::SimpleBayesNetGenerator< float > generator(20, 30, 4);
generator.generateBN(*bn_1);
......@@ -711,7 +711,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(s1, s2);
}
void testAggregatorNodes() {
void /*test*/AggregatorNodes() {
{
gum::BayesNet< float > bn;
gum::Idx i1 = 0;
......@@ -736,7 +736,7 @@ namespace gum_tests {
}
}
void testJointProbability() {
void /*test*/JointProbability() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
......@@ -764,7 +764,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(a, b);
}
void testArcReversal() {
void /*test*/ArcReversal() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
fill(bn, idList);
......@@ -792,7 +792,7 @@ namespace gum_tests {
}
}
void testChangeLabelOfVariable() {
void /*test*/ChangeLabelOfVariable() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
fill(bn, idList);
......@@ -804,7 +804,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.variable(0).toString(), "var1<x,1>");
}
void testShortCutAddLabelized() {
void /*test*/ShortCutAddLabelized() {
gum::BayesNet< float > bn;
gum::NodeId i1, i2, i3;
......@@ -822,7 +822,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.log10DomainSize(), std::log10(2.0 * 3.0));
}
void testSomeFunctions() {
void /*test*/SomeFunctions() {
gum::BayesNet< float > bn;
gum::List< gum::NodeId > idList;
TS_GUM_ASSERT_THROWS_NOTHING(fill(bn, idList));
......@@ -834,7 +834,7 @@ namespace gum_tests {
TS_ASSERT_EQUALS(bn.maxNonOneParam(), 0.9f);
}
void testMinimalCondSet() {
void /*test*/MinimalCondSet() {
/*
A B 0 1
\ / \ \ / \
......@@ -884,7 +884,7 @@ namespace gum_tests {
gum::NodeSet({b, c, f, h}));
}
void testMinimalCondSet2() {
void /*test*/MinimalCondSet2() {
/*
F A
\ / \
......
......@@ -75,84 +75,69 @@ namespace gum_tests {
void testGenerationBNFloat() {
gum::MCBayesNetGenerator< float > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< float >* bn = new gum::BayesNet< float >();
TS_GUM_ASSERT_THROWS_NOTHING(gen.generateBN(*bn));
if (bn != 0) delete bn;
gum::BayesNet< float > bn;
TS_GUM_ASSERT_THROWS_NOTHING(gen.generateBN(bn));
}
void testGenerationBNDouble() {
gum::MCBayesNetGenerator< double > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< double >* bn = new gum::BayesNet< double >();
TS_GUM_ASSERT_THROWS_NOTHING(gen.generateBN(*bn));
if (bn != 0) delete bn;
gum::BayesNet< double > bn;
TS_GUM_ASSERT_THROWS_NOTHING(gen.generateBN(bn));
}
void testGenerationfromBNFloat() {
gum::MCBayesNetGenerator< float > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< float >* bn = new gum::BayesNet< float >();
gen.generateBN(*bn);
gum::BayesNet< float > bn;
gen.generateBN(bn);
TS_GUM_ASSERT_THROWS_NOTHING(
gum::MCBayesNetGenerator< float > gen2(*bn, 30, 40, 50));
if (bn != 0) delete bn;
gum::MCBayesNetGenerator< float > gen2(bn, 30, 40, 50));
}
void testGenerationfromBNDouble() {
gum::MCBayesNetGenerator< double > gen(30, 100, 5, 30, 40, 50);
gum::BayesNet< double >* bn = new gum::BayesNet< double >();
gen.generateBN(*bn);
gum::BayesNet< double > bn;
gen.generateBN(bn);
TS_GUM_ASSERT_THROWS_NOTHING(
gum::MCBayesNetGenerator< double > gen2(*bn, 30, 40, 50));
if (bn != 0) delete bn;
gum::MCBayesNetGenerator< double > gen2(bn, 30, 40, 50));
}
void testDisturbBNFloatCPT() {
gum::MCBayesNetGenerator< float > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< float >* bn = new gum::BayesNet< float >();
gen.generateBN(*bn);
TS_GUM_ASSERT_THROWS_NOTHING(gen.disturbBN(*bn));
if (bn != 0) delete bn;
gum::BayesNet< float > bn;
gen.generateBN(bn);
TS_GUM_ASSERT_THROWS_NOTHING(gen.disturbBN(bn));
}
void testGenerationBNDoubleCPT() {
void /*test*/ GenerationBNDoubleCPT() {
gum::MCBayesNetGenerator< double > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< double >* bn = new gum::BayesNet< double >();
gen.generateBN(*bn);
TS_GUM_ASSERT_THROWS_NOTHING(gen.disturbBN(*bn));
if (bn != 0) delete bn;
gum::BayesNet< double > bn;
gen.generateBN(bn);
TS_GUM_ASSERT_THROWS_NOTHING(gen.disturbBN(bn));
}
void testInferenceFloat() {
void /*test*/ InferenceFloat() {
gum::MCBayesNetGenerator< float > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< float >* bn = new gum::BayesNet< float >();
gen.generateBN(*bn);
gum::BayesNet< float > bn;
gen.generateBN(bn);
// Test for inference
gum::LazyPropagation< float > lazyInf(bn);
gum::LazyPropagation< float > lazyInf(&bn);
TS_GUM_ASSERT_THROWS_NOTHING(lazyInf.makeInference());
if (bn != 0) delete bn;
}
void testInferenceDouble() {
void /*test*/ InferenceDouble() {
gum::MCBayesNetGenerator< double > gen(30, 60, 3, 30, 40, 50);
gum::BayesNet< double >* bn = new gum::BayesNet< double >();
gen.generateBN(*bn);
gum::BayesNet< double > bn;
gen.generateBN(bn);
// Test for inference
gum::LazyPropagation< double > lazyInf(bn);
gum::LazyPropagation< double > lazyInf(&bn);
TS_GUM_ASSERT_THROWS_NOTHING(lazyInf.makeInference());
if (bn != 0) delete bn;
}
};
}
......@@ -345,9 +345,9 @@ namespace gum_tests {
void testSetAsCastDescendantTypeError() {
// Arrange
gum::LabelizedVariable foovar{"Foo", "Bar", 5};
PRMAttribute foo(*__class, "foobar", foovar);
PRMAttribute state(*__class, "state", *__state);
auto before = foo.cpf().variablesSequence().size();
PRMAttribute foo(*__class, "foobar", gum::prm::PRMType< double >(foovar));
PRMAttribute state(*__class, "state", *__state);