aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy > Class Template Reference

<agrum/BN/io/cnf/FactorisedValuesCNFWriter.h> More...

#include <FactorisedValuesCNFWriter.h>

Inheritance diagram for gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >:
Collaboration diagram for gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >:

Public Member Functions

void write (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn)
 Writes a Bayesian network in the output stream.
void write (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn)
 Writes a Bayesian network in the file referenced by filePath.
GUM_NODISCARD bool isModificationAllowed () const
void setAllowModification (bool am)
Constructor & destructor
 FactorisedValuesCNFWriter ()
 Default constructor.
 ~FactorisedValuesCNFWriter ()
 Destructor.
Accessors/Modifiers
void combineAdd (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using addition with the given gum::ApproximationPolicy.
void combineSub (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using substraction with the given gum::ApproximationPolicy.
void combineMult (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using multiplication with the given gum::ApproximationPolicy.
void combineDiv (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using division with the given gum::ApproximationPolicy.
void combineMax (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using max with the given gum::ApproximationPolicy.
void combineMin (const ApproximationPolicy< GUM_SCALAR > *ap)
 Combine using min with the given gum::ApproximationPolicy.

Protected Member Functions

void _doWrite (std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
 Writes a Bayesian network in the output stream using the BN format.
void _doWrite (const std::string &filePath, const IBayesNet< GUM_SCALAR > &bn) final
 Writes a Bayesian network in the referenced file using the BN format.
GUM_SCALAR fromExact (const GUM_SCALAR &value) const override
 Convert value to his approximation.
virtual void _syntacticalCheck (const IBayesNet< GUM_SCALAR > &bn)
 Check whether the BN is syntactically correct for BIF format.
void _validCharInNamesCheck (const IBayesNet< GUM_SCALAR > &bn)
 }
std::string _onlyValidCharsInName (const std::string &name)
 }
std::string _buildNameWithOnlyValidChars (const std::string &name)
 }
bool _allowModification_
 }

Detailed Description

template<typename GUM_SCALAR, template< typename > class IApproximationPolicy = ExactPolicy>
class gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >

<agrum/BN/io/cnf/FactorisedValuesCNFWriter.h>

Writes a IBayesNet in the BN format.

This class servers to write the content of a Bayesian network in the BN format. See TODO for information on this format.

Definition at line 79 of file FactorisedValuesCNFWriter.h.

Constructor & Destructor Documentation

◆ FactorisedValuesCNFWriter()

template<typename GUM_SCALAR, template< typename > class IApproximationPolicy = ExactPolicy>
gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >::FactorisedValuesCNFWriter ( )

Default constructor.

◆ ~FactorisedValuesCNFWriter()

template<typename GUM_SCALAR, template< typename > class IApproximationPolicy = ExactPolicy>
gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >::~FactorisedValuesCNFWriter ( )

Destructor.

Member Function Documentation

◆ _buildNameWithOnlyValidChars()

std::string gum::BNWriter< GUM_SCALAR >::_buildNameWithOnlyValidChars ( const std::string & name)
protectedinherited

}

◆ _doWrite() [1/2]

template<typename GUM_SCALAR, template< typename > class IApproximationPolicy = ExactPolicy>
void gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >::_doWrite ( const std::string & filePath,
const IBayesNet< GUM_SCALAR > & bn )
finalprotectedvirtual

Writes a Bayesian network in the referenced file using the BN format.

If the files doesn't exists, it is created.

Parameters
filePathThe path to the file used to write the Bayesian network.
bnThe Bayesian network writed in the file.
Exceptions
IOErrorRaised if and I/O error occurs.

Implements gum::BNWriter< GUM_SCALAR >.

◆ _doWrite() [2/2]

template<typename GUM_SCALAR, template< typename > class IApproximationPolicy = ExactPolicy>
void gum::FactorisedValuesCNFWriter< GUM_SCALAR, IApproximationPolicy >::_doWrite ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
finalprotectedvirtual

Writes a Bayesian network in the output stream using the BN format.

Parameters
outputThe output stream.
bnThe Bayesian network writen in output.
Exceptions
IOErrorRaised if and I/O error occurs.

Implements gum::CNFWriter< GUM_SCALAR, ExactPolicy >.

◆ _onlyValidCharsInName()

std::string gum::BNWriter< GUM_SCALAR >::_onlyValidCharsInName ( const std::string & name)
protectedinherited

}

◆ _syntacticalCheck()

virtual void gum::BNWriter< GUM_SCALAR >::_syntacticalCheck ( const IBayesNet< GUM_SCALAR > & bn)
protectedvirtualinherited

Check whether the BN is syntactically correct for BIF format.

Exceptions
FatalErrorif found.

◆ _validCharInNamesCheck()

void gum::BNWriter< GUM_SCALAR >::_validCharInNamesCheck ( const IBayesNet< GUM_SCALAR > & bn)
protectedinherited

}

◆ combineAdd()

void gum::ExactPolicy< GUM_SCALAR >::combineAdd ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using addition with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 97 of file exactPolicy_tpl.h.

68{}

◆ combineDiv()

void gum::ExactPolicy< GUM_SCALAR >::combineDiv ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using division with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 117 of file exactPolicy_tpl.h.

82{}

◆ combineMax()

void gum::ExactPolicy< GUM_SCALAR >::combineMax ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using max with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 123 of file exactPolicy_tpl.h.

86{}

◆ combineMin()

void gum::ExactPolicy< GUM_SCALAR >::combineMin ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using min with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 129 of file exactPolicy_tpl.h.

90{}

◆ combineMult()

void gum::ExactPolicy< GUM_SCALAR >::combineMult ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using multiplication with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 111 of file exactPolicy_tpl.h.

78{}

◆ combineSub()

void gum::ExactPolicy< GUM_SCALAR >::combineSub ( const ApproximationPolicy< GUM_SCALAR > * ap)
inherited

Combine using substraction with the given gum::ApproximationPolicy.

Parameters
apThe policy to combine with.

Definition at line 104 of file exactPolicy_tpl.h.

73{}

◆ fromExact()

GUM_SCALAR gum::CNFWriter< GUM_SCALAR, ExactPolicy >::fromExact ( const GUM_SCALAR & value) const
inlineoverrideprotectedvirtualinherited

Convert value to his approximation.

This method, at least in release mode, should not verify the limits

Parameters
valueThe converted value.
Returns
The value approximation representation.

Implements gum::ApproximationPolicy< GUM_SCALAR >.

Definition at line 129 of file CNFWriter.h.

129 {
131 }
Writes a IBayesNet in the BN format.
Definition CNFWriter.h:85

◆ isModificationAllowed()

GUM_NODISCARD bool gum::BNWriter< GUM_SCALAR >::isModificationAllowed ( ) const
inherited

◆ setAllowModification()

void gum::BNWriter< GUM_SCALAR >::setAllowModification ( bool am)
inherited

◆ write() [1/2]

void gum::BNWriter< GUM_SCALAR >::write ( const std::string & filePath,
const IBayesNet< GUM_SCALAR > & bn )
inherited

Writes a Bayesian network in the file referenced by filePath.

  • If the file doesn't exists, it is created.
  • If the file exists, it's content will be erased.
  • If the bn can not be written for syntactical reasons, throw an error or try to correct it (conditioned by the value of allowModification
Parameters
filePathThe path to the file used to write the Bayesian network.
bnThe Bayesian network writen in the file.
Exceptions
IOErrorRaised if an I/O error occurs.

◆ write() [2/2]

void gum::BNWriter< GUM_SCALAR >::write ( std::ostream & output,
const IBayesNet< GUM_SCALAR > & bn )
inherited

Writes a Bayesian network in the output stream.

  • If the bn can not be written for syntactical reasons, throw an error or try to correct it (conditioned by the value of allowModification
Parameters
outputThe output stream.
bnThe Bayesian network written in output.
Exceptions
IOErrorRaised if an I/O error occurs.
SyntaxErrorRaised if syntactical errors in the BN

Member Data Documentation

◆ _allowModification_

bool gum::BNWriter< GUM_SCALAR >::_allowModification_
privateinherited

}

Definition at line 163 of file BNWriter.h.


The documentation for this class was generated from the following file: