aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::UAIMRFWriter< GUM_SCALAR > Class Template Reference

<agrum/MRF/io/UAI/UAIMRFWriter.h> More...

#include <UAIMRFWriter.h>

Inheritance diagram for gum::UAIMRFWriter< GUM_SCALAR >:
Collaboration diagram for gum::UAIMRFWriter< GUM_SCALAR >:

Public Member Functions

void write (std::ostream &output, const IMarkovRandomField< GUM_SCALAR > &MN) final
 Writes a Markov net to the given output stream.
void write (std::string_view filePath, const IMarkovRandomField< GUM_SCALAR > &MN) final
 Writes an Markov net in the file referenced by filePath.
virtual void write (std::string_view filePath, IMarkovRandomField< GUM_SCALAR > &MN)
 Writes a Markov random field in the file referenced by filePath, updating metadata (software, creation, lastModification) before writing.
Constructor & destructor
 UAIMRFWriter ()
 Default constructor.
 ~UAIMRFWriter () override
 Destructor.

Private Member Functions

std::string _preambule_ (const IMarkovRandomField< GUM_SCALAR > &MN)
 Returns the header of the BIF file.
std::string _factorBloc_ (const IMarkovRandomField< GUM_SCALAR > &MN, const Tensor< GUM_SCALAR > &clikpot)

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::UAIMRFWriter< GUM_SCALAR >

<agrum/MRF/io/UAI/UAIMRFWriter.h>

Writes an Markov net in a text file with UAI format

This class export a Markov net into an text file, using UAI format

cf. http://www.cs.huji.ac.il/project/PASCAL/fileFormat.php

Definition at line 77 of file UAIMRFWriter.h.

Constructor & Destructor Documentation

◆ UAIMRFWriter()

template<GUM_Numeric GUM_SCALAR>
gum::UAIMRFWriter< GUM_SCALAR >::UAIMRFWriter ( )

Default constructor.

◆ ~UAIMRFWriter()

template<GUM_Numeric GUM_SCALAR>
gum::UAIMRFWriter< GUM_SCALAR >::~UAIMRFWriter ( )
override

Destructor.

Member Function Documentation

◆ _factorBloc_()

template<GUM_Numeric GUM_SCALAR>
std::string gum::UAIMRFWriter< GUM_SCALAR >::_factorBloc_ ( const IMarkovRandomField< GUM_SCALAR > & MN,
const Tensor< GUM_SCALAR > & clikpot )
private

◆ _preambule_()

template<GUM_Numeric GUM_SCALAR>
std::string gum::UAIMRFWriter< GUM_SCALAR >::_preambule_ ( const IMarkovRandomField< GUM_SCALAR > & MN)
private

Returns the header of the BIF file.

◆ write() [1/3]

template<GUM_Numeric GUM_SCALAR>
virtual void gum::MRFWriter< GUM_SCALAR >::write ( std::string_view filePath,
IMarkovRandomField< GUM_SCALAR > & MN )
virtualinherited

Writes a Markov random field in the file referenced by filePath, updating metadata (software, creation, lastModification) before writing.

If the file doesn't exists, it is created. If the file exists, it's content will be erased.

Default implementation delegates to the const overload.

Parameters
filePathThe path to the file used to write the Markov random field.
MNThe Markov random field written to the file (non-const to allow metadata update).
Exceptions
IOErrorRaised if an I/O error occurs.

Reimplemented in gum::GumMRFWriter< GUM_SCALAR >.

◆ write() [2/3]

template<GUM_Numeric GUM_SCALAR>
void gum::UAIMRFWriter< GUM_SCALAR >::write ( std::ostream & output,
const IMarkovRandomField< GUM_SCALAR > & MN )
finalvirtual

Writes a Markov net to the given output stream.

Parameters
outputThe output stream.
MNThe Markov net written to the stream.
Exceptions
IOErrorRaised if an I/O error occurs.

Implements gum::MRFWriter< GUM_SCALAR >.

◆ write() [3/3]

template<GUM_Numeric GUM_SCALAR>
void gum::UAIMRFWriter< GUM_SCALAR >::write ( std::string_view filePath,
const IMarkovRandomField< GUM_SCALAR > & MN )
finalvirtual

Writes an Markov net 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.

Parameters
filePathThe path to the file used to write the Markov net.
MNThe Markov net written to the file.
Exceptions
IOErrorRaised if an I/O error occurs.

Implements gum::MRFWriter< GUM_SCALAR >.


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