[aGrUM] class UtilityTable is removed

parent 75058609
......@@ -29,7 +29,7 @@ from .utils import trace, notif, critic, warn, error, recglob, srcAgrum
pathtopyAgrum = "./wrappers/pyAgrum/generated-files3/pyAgrum.py"
classesToSkip = ['Vector_int','Vector_double','Vector_string','SwigPyIterator','GumException','SyntaxError'
,'MultiDimContainer_double','UtilityTable_double','BayesNetInference_double']
,'MultiDimContainer_double','Potential_double','BayesNetInference_double']
methodsToSkip = ['swig_import_helper','setTriangulation','statsObj','whenNodeAdded','whenNodeDeleted','whenArcAdded','whenArcDeleted','whenLoading','whenProgress','whenStop']
......@@ -52,7 +52,7 @@ def noDocstring2(lines,dic):
if not(methodClass in dic) :
dic[methodClass]=[]
dic[methodClass].append(getMethodName(line)+" does not have any doc")
def signatureOnly2(lines,dic):
for i, line in enumerate(lines):
if re.match("^def [^_].*",line, flags = 0) :
......@@ -71,7 +71,7 @@ def signatureOnly2(lines,dic):
if not(methodClass in dic) :
dic[methodClass]=[]
dic[methodClass].append(methodName+" only has a signature")
def multipleSignatureOnly2(lines,dic):
for i, line in enumerate(lines):
if re.match("^def [^_].*",line, flags = 0):
......@@ -116,7 +116,7 @@ def multipleSignatureOnly2(lines,dic):
if not(methodClass in dic) :
dic[methodClass]=[]
dic[methodClass].append(methodName+" only has multiple signatures")
def getClass(lines,i):
previousline = lines[i-1]
while not(re.match("^class",previousline, flags = 0)):
......@@ -169,4 +169,4 @@ def computeNbrError(showFunct):
if showFunct:
prettyprint(dic)
return numberOfUndocumentedMethods(dic)
\ No newline at end of file
return numberOfUndocumentedMethods(dic)
......@@ -69,7 +69,7 @@ def prettifying_errors(line):
cfg.C_ERROR + t[1],
cfg.C_VALUE + t[2] + cfg.C_END])
else:
return res + s
return res + s[1]
return line
......
......@@ -25,7 +25,7 @@
#ifndef GUM_UT_GENERATOR_H
#define GUM_UT_GENERATOR_H
#include <agrum/multidim/utilityTable.h>
#include <agrum/multidim/potential.h>
namespace gum {
......@@ -63,7 +63,7 @@ namespace gum {
* @param varId The variable id of the UT owner.
* @param ut A reference on the UT to fill.
*/
virtual void generateUT(const Idx& varId, const UtilityTable< float >& ut) = 0;
virtual void generateUT(const Idx& varId, const Potential< float >& ut) = 0;
/**
* Generates a UT using doubles.
......@@ -71,7 +71,7 @@ namespace gum {
* @param ut A reference on the UT to fill.
*/
virtual void generateUT(const Idx& varId,
const UtilityTable< double >& ut) = 0;
const Potential< double >& ut) = 0;
/// @}
};
......
......@@ -37,7 +37,7 @@ namespace gum {
// @param varID The variable id of the UT owner.
// @param ut A reference on the UT to fill.
void SimpleUTGenerator::generateUT(const Idx& varId,
const UtilityTable< float >& ut) {
const Potential< float >& ut) {
std::vector< float > v;
for (Size i = 0; i < ut.domainSize(); ++i)
......@@ -50,7 +50,7 @@ namespace gum {
// @param varID The variable id of the UT owner.
// @param ut A reference on the UT to fill.
void SimpleUTGenerator::generateUT(const Idx& varId,
const UtilityTable< double >& ut) {
const Potential< double >& ut) {
std::vector< double > v;
for (Size i = 0; i < ut.domainSize(); ++i)
......
......@@ -63,14 +63,14 @@ namespace gum {
* @param varId The variable id of the UT owner.
* @param ut A reference on the UT to fill.
*/
virtual void generateUT(const Idx& varId, const UtilityTable< float >& ut);
virtual void generateUT(const Idx& varId, const Potential< float >& ut);
/**
* Generates a UT using doubles.
* @param varId The variable id of the UT owner.
* @param ut A reference on the UT to fill.
*/
virtual void generateUT(const Idx& varId, const UtilityTable< double >& ut);
virtual void generateUT(const Idx& varId, const Potential< double >& ut);
/// @}
};
......
......@@ -140,13 +140,13 @@ namespace gum {
Set< Potential< GUM_SCALAR >* > __potentialDummies;
/// The set of dummies sparse utilities matrix created.
Set< UtilityTable< GUM_SCALAR >* > __utilityDummies;
Set< Potential< GUM_SCALAR >* > __utilityDummies;
/// The resulting potential from inference
Potential< GUM_SCALAR >* __inferencePotential;
/// The resulting utility from inference
UtilityTable< GUM_SCALAR >* __inferenceUtility;
Potential< GUM_SCALAR >* __inferenceUtility;
/// @}
// ====================================================================
......@@ -204,7 +204,7 @@ namespace gum {
void __reduceClique(CliqueProperties< GUM_SCALAR >* absorbedClique,
NodeSet& separator,
Potential< GUM_SCALAR >*& potentialMarginal,
UtilityTable< GUM_SCALAR >*& utilityMarginal);
Potential< GUM_SCALAR >*& utilityMarginal);
/// Returns a pointer over a "dummy" potential, which is a CPT filled with
/// one MultiDimSparse filled with 1. This is used by empty cliques.
......@@ -220,7 +220,7 @@ namespace gum {
/// @param cliqueId The NodeId of the cliqueId for which we build a dummy
/// utility.
/// @return A pointer over the dummy bucket.
UtilityTable< GUM_SCALAR >* __makeDummyUtility(NodeId cliqueId);
Potential< GUM_SCALAR >* __makeDummyUtility(NodeId cliqueId);
/// Returns true if observed node is eliminated after current node
bool __IsEliminatedAfter(NodeId observedNode, NodeId currentNode);
......@@ -263,7 +263,7 @@ namespace gum {
/// @param removable for cleaning purpose after inference, we have to keep
/// track
/// of adding potential during inference
void addUtility(const UtilityTable< GUM_SCALAR >& ut, bool removable = false);
void addUtility(const Potential< GUM_SCALAR >& ut, bool removable = false);
/// Removes all potential and utility table added during an inference
void cleanFromInference();
......@@ -293,7 +293,7 @@ namespace gum {
potentialBucket();
/// @return Returns the bucket of this Clique
const HashTable< const UtilityTable< GUM_SCALAR >*, Instantiation* >&
const HashTable< const Potential< GUM_SCALAR >*, Instantiation* >&
utilityBucket();
/// @return returns the elimination sequence for this clique
......@@ -314,7 +314,7 @@ namespace gum {
HashTable< const Potential< GUM_SCALAR >*, Instantiation* > __potentialBucket;
/// The utility bucket of this clique
HashTable< const UtilityTable< GUM_SCALAR >*, Instantiation* > __utilityBucket;
HashTable< const Potential< GUM_SCALAR >*, Instantiation* > __utilityBucket;
/// The sequence of elimination of node in the clique
Sequence< NodeId > __eliminationOrder;
......@@ -329,7 +329,7 @@ namespace gum {
List< const Potential< GUM_SCALAR >* > __removablePotentialList;
/// The list of utilities that have been had during an inference
List< const UtilityTable< GUM_SCALAR >* > __removableUtilityList;
List< const Potential< GUM_SCALAR >* > __removableUtilityList;
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
......
......@@ -465,7 +465,7 @@ namespace gum {
NodeSet separator = __getSeparator(absorbedCliqueId, absorbingCliqueId);
Potential< GUM_SCALAR >* potentialMarginal = 0;
UtilityTable< GUM_SCALAR >* utilityMarginal = 0;
Potential< GUM_SCALAR >* utilityMarginal = 0;
// First we reduce absorbed clique by eleminating clique variables which
// aren't
......@@ -518,7 +518,7 @@ namespace gum {
CliqueProperties< GUM_SCALAR >* absorbedClique,
NodeSet& separator,
Potential< GUM_SCALAR >*& potentialMarginal,
UtilityTable< GUM_SCALAR >*& utilityMarginal) {
Potential< GUM_SCALAR >*& utilityMarginal) {
Instantiation cliqueInstance(absorbedClique->cliqueInstantiation());
Sequence< const DiscreteVariable* > cliqueRemainVarList(
......@@ -532,7 +532,7 @@ namespace gum {
// First we create the tables that will result from variable elimination
Potential< GUM_SCALAR >* newPotential = new Potential< GUM_SCALAR >();
UtilityTable< GUM_SCALAR >* newUtility = new UtilityTable< GUM_SCALAR >();
Potential< GUM_SCALAR >* newUtility = new Potential< GUM_SCALAR >();
// Then we need to add all not yet eliminated variables of the clique in
// ours
......@@ -674,9 +674,9 @@ namespace gum {
// __makeDummyUtility : creates a generic utility
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >*
INLINE Potential< GUM_SCALAR >*
InfluenceDiagramInference< GUM_SCALAR >::__makeDummyUtility(NodeId cliqueId) {
UtilityTable< GUM_SCALAR >* ut = new UtilityTable< GUM_SCALAR >(
Potential< GUM_SCALAR >* ut = new Potential< GUM_SCALAR >(
new MultiDimSparse< GUM_SCALAR >((GUM_SCALAR)0));
__utilityDummies.insert(ut);
......@@ -771,7 +771,7 @@ namespace gum {
// inference or not
template < typename GUM_SCALAR >
void
CliqueProperties< GUM_SCALAR >::addUtility(const UtilityTable< GUM_SCALAR >& ut,
CliqueProperties< GUM_SCALAR >::addUtility(const Potential< GUM_SCALAR >& ut,
bool removable) {
__utilityBucket.insert(&ut, new Instantiation(ut));
......@@ -792,7 +792,7 @@ namespace gum {
// utilityBucket : Returns the utiluty table bucket of this Clique
template < typename GUM_SCALAR >
INLINE const HashTable< const UtilityTable< GUM_SCALAR >*, Instantiation* >&
INLINE const HashTable< const Potential< GUM_SCALAR >*, Instantiation* >&
CliqueProperties< GUM_SCALAR >::utilityBucket() {
return __utilityBucket;
}
......
......@@ -38,7 +38,6 @@
#include <agrum/graphicalModels/DAGmodel.h>
#include <agrum/multidim/potential.h>
#include <agrum/multidim/utilityTable.h>
namespace gum {
......@@ -103,7 +102,7 @@ namespace gum {
* Returns the utility table of a utility node.
* @throw NotFound If no variable's id matches varId.
*/
virtual const UtilityTable< GUM_SCALAR >& utility(NodeId varId) const;
virtual const Potential< GUM_SCALAR >& utility(NodeId varId) const;
/**
* Returns a constant reference to the VariableNodeMap of this Influence
......@@ -385,7 +384,7 @@ namespace gum {
/// Mapping between potential variable's id and their CPT
NodeProperty< Potential< GUM_SCALAR >* > __potentialMap;
/// Mapping between utility variable's id and their utility table
NodeProperty< UtilityTable< GUM_SCALAR >* > __utilityMap;
NodeProperty< Potential< GUM_SCALAR >* > __utilityMap;
/// The temporal order
mutable List< NodeSet > __temporalOrder;
......
......@@ -135,7 +135,7 @@ namespace gum {
// Copying Utilities
for (const auto& uti : IDsource.__utilityMap) {
// Instanciation of the node's CPT
auto utilityCpy = new UtilityTable< GUM_SCALAR >;
auto utilityCpy = new Potential< GUM_SCALAR >;
(*utilityCpy) << variable(uti.first);
// Addition of the parents
......@@ -251,7 +251,7 @@ namespace gum {
* Returns the utility table of a utility node.
*/
template < typename GUM_SCALAR >
INLINE const UtilityTable< GUM_SCALAR >&
INLINE const Potential< GUM_SCALAR >&
InfluenceDiagram< GUM_SCALAR >::utility(NodeId varId) const {
return *(__utilityMap[varId]);
}
......@@ -449,7 +449,7 @@ namespace gum {
NodeId proposedId = _addNode(var, DesiredId);
UtilityTable< GUM_SCALAR >* varut = new UtilityTable< GUM_SCALAR >(aContent);
Potential< GUM_SCALAR >* varut = new Potential< GUM_SCALAR >(aContent);
(*varut) << variable(proposedId);
......
......@@ -216,7 +216,7 @@ namespace gum {
const Potential< GUM_SCALAR >* table = &__infdiag->cpt(currentVarId);
table->populate(tablevector);
} else if (__infdiag->isUtilityNode(currentVarId)) {
const UtilityTable< GUM_SCALAR >* table =
const Potential< GUM_SCALAR >* table =
&__infdiag->utility(currentVarId);
table->populate(tablevector);
}
......
......@@ -42,9 +42,11 @@ namespace gum {
* @class Potential potential.h <agrum/multidim/potential.h>
* @ingroup multidim_group
*
* @brief Class representing a potential.
* @brief aGrUM's Potential is a multi-dimensional array with tensor operators.
* It is used to represent probabilities and utilities in aGrUMs'
* multidimensional (graphical) models.
*
* Using the decorator pattern, this representation is independant from the
* Using the decorator pattern, this representation is independent from the
* implementation of the multidimensional matrix.
*
* @tparam GUM_SCALAR The type of the scalar stored in this multidimensional
......
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file
* @brief Implementation of the UtilityTable class.
* @author Jean-Philippe DUBUS and Pierre-Henri WUILLEMIN et Christophe GONZALES
*/
#include <agrum/multidim/utilityTable.h>
namespace gum {
template class UtilityTable< float >;
template class UtilityTable< double >;
} // namespace gum
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file
* @brief Headers of the UtilityTable class.
* @author Pierre-Henri WUILLEMIN et Christophe GONZALES
* @author Jean-Philippe DUBUS
*/
#ifndef GUM_UTILITY_TABLE_H
#define GUM_UTILITY_TABLE_H
#include <agrum/agrum.h>
#include <agrum/multidim/implementations/multiDimArray.h>
#include <agrum/multidim/implementations/multiDimDecorator.h>
namespace gum {
/**
* @class UtilityTable utilityTable.h <agrum/multidim/utilityTable.h>
* @ingroup multidim_group
*
* @brief Representation of a multi-dimensional utility table.
* @tparam GUM_SCALAR The type of scalars stored in this multidimensional
* table.
*/
template < typename GUM_SCALAR >
class UtilityTable : public MultiDimDecorator< GUM_SCALAR > {
public:
/**
* @brief Default constructor.
*
* Use a MultiDimArray as its implementation.
*/
UtilityTable();
/**
* @brief Constructor.
* @param aContent The implementation of this utility table.
*/
explicit UtilityTable(MultiDimImplementation< GUM_SCALAR >* aContent);
/**
* @brief Class destructor.
*/
virtual ~UtilityTable();
/**
* @brief Copy constructor.
*
* @param toCopy The UtilityTable to copy.
*/
UtilityTable(const UtilityTable< GUM_SCALAR >& toCopy);
/**
* @brief Copy operator.
*
* @param toCopy The UtilityTable to copy.
* @return This UtilityTable.
*/
UtilityTable< GUM_SCALAR >&
operator=(const UtilityTable< GUM_SCALAR >& toCopy);
virtual UtilityTable< GUM_SCALAR >* newFactory() const;
/**
*@brief copy a Potential data using name of variables and labels (not
*necessarily
*the same variables in the same orders)
*
*@warning a strict control on names of variables and labels are made
*
*@throw InvalidArgument if the Potential is not compatible with this
*/
const UtilityTable< GUM_SCALAR >&
fillWith(const UtilityTable< GUM_SCALAR >& src) const;
/**
* @brief Automatically fills the potential with the values in
* v.
*
* @param v Vector of values.
* @throw SizeError Raised if v size's does not matches this
* MultiDimContainer domain size.
*/
const UtilityTable< GUM_SCALAR >&
fillWith(const std::vector< GUM_SCALAR >& v) const;
/**
* @brief Automatically fills this MultiDimContainer with the value v
*
* @param v contains the data.
*/
const UtilityTable< GUM_SCALAR >& fillWith(const GUM_SCALAR& v) const;
protected:
virtual void _swap(const DiscreteVariable* x, const DiscreteVariable* y);
};
extern template class UtilityTable< float >;
extern template class UtilityTable< double >;
} /* namespace gum */
#include <agrum/multidim/utilityTable_tpl.h>
#endif /* GUM_UTILITY_TABLE_H */
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file
* @brief Implementation of the UtilityTable class.
* @author Pierre-Henri WUILLEMIN et Christophe GONZALES
* @author Jean-Philippe DUBUS
*/
namespace gum {
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >::UtilityTable()
: MultiDimDecorator< GUM_SCALAR >(new MultiDimArray< GUM_SCALAR >) {
GUM_CONSTRUCTOR(UtilityTable);
}
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >::UtilityTable(
MultiDimImplementation< GUM_SCALAR >* aContent)
: MultiDimDecorator< GUM_SCALAR >(aContent) {
GUM_CONSTRUCTOR(UtilityTable);
}
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >::~UtilityTable() {
GUM_DESTRUCTOR(UtilityTable);
}
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >::UtilityTable(
const UtilityTable< GUM_SCALAR >& toCopy)
: MultiDimDecorator< GUM_SCALAR >(
static_cast< MultiDimImplementation< GUM_SCALAR >* >(
toCopy.content()->newFactory())) {
const Sequence< const DiscreteVariable* >& varSeq = toCopy.variablesSequence();
for (Sequence< const DiscreteVariable* >::iterator_safe iter =
varSeq.beginSafe();
iter != varSeq.endSafe();
++iter) {
this->add(**iter);
}
Instantiation i1(toCopy);
Instantiation i2(*this);
for (i1.setFirst(), i2.setFirstIn(i1); !i1.end(); ++i1, i2.incIn(i1)) {
this->set(i2, toCopy[i1]);
}
GUM_CONS_CPY(UtilityTable);
}
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >& UtilityTable< GUM_SCALAR >::
operator=(const UtilityTable< GUM_SCALAR >& toCopy) {
GUM_ERROR(OperationNotAllowed,
"No copy for UtilityTable : how to choose the implementation ?");
return *this;
}
template < typename GUM_SCALAR >
INLINE UtilityTable< GUM_SCALAR >*
UtilityTable< GUM_SCALAR >::newFactory() const {
return new UtilityTable< GUM_SCALAR >(
static_cast< MultiDimImplementation< GUM_SCALAR >* >(
this->content()->newFactory()));
}
template < typename GUM_SCALAR >
INLINE void UtilityTable< GUM_SCALAR >::_swap(const DiscreteVariable* x,
const DiscreteVariable* y) {
MultiDimDecorator< GUM_SCALAR >::content()->swap(*x, *y);
}
template < typename GUM_SCALAR >
INLINE const UtilityTable< GUM_SCALAR >&
UtilityTable< GUM_SCALAR >::fillWith(const std::vector< GUM_SCALAR >& v) const {
this->populate(v);
return *this;
}
template < typename GUM_SCALAR >
INLINE const UtilityTable< GUM_SCALAR >&
UtilityTable< GUM_SCALAR >::fillWith(const GUM_SCALAR& v) const {
this->fill(v);
return *this;
}
template < typename GUM_SCALAR >
INLINE const UtilityTable< GUM_SCALAR >& UtilityTable< GUM_SCALAR >::fillWith(
const UtilityTable< GUM_SCALAR >& src) const {
if (src.domainSize() != this->domainSize()) {
GUM_ERROR(InvalidArgument, "Potential to copy has not the same dimension.");
}
Instantiation Isrc(src);
Instantiation Idst(*this);
for (Isrc.setFirst(); !Isrc.end(); ++Isrc) {
for (Idx i = 0; i < this->nbrDim(); i++) {
Idst.chgVal(Isrc.variable(i).name(), Isrc.variable(i).label(Isrc.val(i)));
}
this->set(Idst, src.get(Isrc));
}
return *this;
}
} /* namespace gum */
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}@lip6.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <cxxtest/AgrumTestSuite.h>
#include <cxxtest/testsuite_utils.h>
#include <agrum/variables/discretizedVariable.h>
#include <agrum/variables/labelizedVariable.h>
#include <agrum/multidim/implementations/multiDimArray.h>
#include <agrum/multidim/utilityTable.h>
namespace gum_tests {
class UtilityTestSuite : public CxxTest::TestSuite {
public:
void testCreation() {
gum::UtilityTable< double > p(new gum::MultiDimArray< double >());
TS_ASSERT(p.empty());
gum::LabelizedVariable a("a", "first var", 2), b("b", "second var", 4),
c("c", "third var", 5);
TS_GUM_ASSERT_THROWS_NOTHING(p << a << b << c);
}
void testFactory() {
gum::UtilityTable< double > p1(new gum::MultiDimArray< double >());
TS_GUM_ASSERT_THROWS_NOTHING(delete p1.newFactory());
}
};
}
......@@ -328,7 +328,7 @@ namespace gum_tests {
instChanceVar5.chgVal(chanceVar5, 1);
TS_ASSERT_DELTA(cptChanceVar5[instChanceVar5], 0.7, 0.001);
const gum::UtilityTable< float >& utUtilityVar1 =
const gum::Potential< float >& utUtilityVar1 =
net->utility(idMap["utilityVar1"]);
TS_ASSERT_EQUALS(utUtilityVar1.domainSize(), (gum::Size)4);
gum::Instantiation instUtilityVar1(utUtilityVar1);
......@@ -344,7 +344,7 @@ namespace gum_tests {
instUtilityVar1.chgVal(chanceVar1, 1);
TS_ASSERT_DELTA(utUtilityVar1[instUtilityVar1], 84, 0.001);
const gum::UtilityTable< float >& utUtilityVar2 =
const gum::Potential< float >& utUtilityVar2 =
net->utility(idMap["utilityVar2"]);
TS_ASSERT_EQUALS(utUtilityVar2.domainSize(), (gum::Size)4);
gum::Instantiation instUtilityVar2(utUtilityVar2);
......
......@@ -157,7 +157,7 @@ namespace gum_tests {
p5.populate(v);
}
const gum::UtilityTable< float >& u1 = id.utility(idList[9]);
const gum::Potential< float >& u1 = id.utility(idList[9]);
{
// FILLING PARAMS
const float t[4] = {42.0f, 69.0f, 666.0f, 84.0f};
......@@ -166,7 +166,7 @@ namespace gum_tests {
u1.populate(v);
}
const gum::UtilityTable< float >& u2 = id.utility(idList[10]);
const gum::Potential< float >& u2 = id.utility(idList[10]);
{
// FILLING PARAMS
const float t[4] = {42.0f, -69.0f, 666.0f, 84.0f};
......@@ -347,8 +347,8 @@ namespace gum_tests {
}
} else if (source.isUtilityNode(node)) {
const gum::UtilityTable< float >& srcUT = source.utility(node);
const gum::UtilityTable< float >& cpUT = copy->utility(node);
const gum::Potential< float >& srcUT = source.utility(node);
const gum::Potential< float >& cpUT = copy->utility(node);
gum::Instantiation srcInst(srcUT);
gum::Instantiation cpInst(cpUT);
......
......@@ -41,7 +41,7 @@ from .pyAgrum import statsObj
from .pyAgrum import Arc, Edge, DiGraph, UndiGraph, MixedGraph, DAG, CliqueGraph
from .pyAgrum import BayesNet, EssentialGraph, MarkovBlanket
from .pyAgrum import DiscretizedVariable, LabelizedVariable, RangeVariable, DiscreteVariable
from .pyAgrum import Potential, Instantiation, UtilityTable
from .pyAgrum import Potential, Instantiation, Potential
from .pyAgrum import BruteFor