GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
File::TPGGraphDotExporter Class Reference

Class used to export a TPGGraph into a text file with the dot format. More...

`#include <tpgGraphDotExporter.h>`

Inheritance diagram for File::TPGGraphDotExporter:

## Public Member Functions
| TPGGraphDotExporter (const char *filePath, const TPG::TPGGraph &graph)
| Constructor for the exporter.
| TPGGraphDotExporter (const TPGGraphDotExporter &other)=delete
TPGGraphDotExporter & | operator= (const TPGGraphDotExporter &other)=delete
| ~TPGGraphDotExporter ()
void | setNewFilePath (const char *newFilePath)
| Set a new file for the exporter.
void | print ()
| Print the TPGGraph given when constructing the TPGGraphDotExporter into a dot file.
void | printSubGraph (const TPG::TPGVertex *root)
| Print a sub-tree of the TPGGraph given when constructing the TPGGraphDotExporter into a dot file.

## Protected Member Functions
void | printTPGTeam (const TPG::TPGTeam &team)
| Print the dot content for the given TPGTeam.
uint64_t | printTPGAction (const TPG::TPGAction &action)
| Print the dot content for the given TPGAction.
void | printTPGEdge (const TPG::TPGEdge &edge)
| Prints the dot content for the given TPGEdge. Prints the program index followed by its contants if the constants are used.
void | printProgram (const Program::Program &program)
| Prints the dot content for the given Program.
void | printTPGGraphHeader ()
| Prints header content in the dot file.
void | printTPGGraphFooter ()
| Prints footer content in the dot file.

## Protected Attributes
FILE * | pFile
| File in which the dot content is written during export.
std::string | offset
| Character chain used to control the indentation of the exported file.

## Detailed Description

Class used to export a TPGGraph into a text file with the dot format.

## Constructor & Destructor Documentation

## ◆ TPGGraphDotExporter() [1/2]

File::TPGGraphDotExporter::TPGGraphDotExporter | ( | const char * | filePath,
|  | const TPG::TPGGraph & | graph )
| inline

Constructor for the exporter.

Parameters

  [in] | filePath | initial path to the file where the dot content will be written.
  [in] | graph | const reference to the graph whose content will be exported in dot.

Exceptions

  std::runtime_error | in case no file could be opened at the given filePath.

## ◆ TPGGraphDotExporter() [2/2]

File::TPGGraphDotExporter::TPGGraphDotExporter | ( | const TPGGraphDotExporter & | other | ) |
| delete

Disable copy construction.

Until we see the need for it, there si no reason to enable copy-construction of TPGGraphDotExporter.

## ◆ ~TPGGraphDotExporter()

File::TPGGraphDotExporter::~TPGGraphDotExporter | ( |  | ) |
| inline

Destructor for the exporter.

Closes the file.

## Member Function Documentation

## ◆ operator=()

TPGGraphDotExporter & File::TPGGraphDotExporter::operator= | ( | const TPGGraphDotExporter & | other | ) |
| delete

Disable TPGGraphDotExporter default assignment operator.

Until we see the need for it, there si no reason to enable assignment operator of TPGGraphDotExporter.

## ◆ printProgram()

void File::TPGGraphDotExporter::printProgram | ( | const Program::Program & | program | ) |
| protected

Prints the dot content for the given Program.

Parameters

  [in] | program | the Program to be printed

a program is stored in the .dot file with the format : line_1&#92;nline2&#92;nline3&#92;n...&#92;nline_N&#92;n

a line is stored in the .dot file with the following format inst_idx|dest_idx&op1_param1|op1_param2#...#

inst_idx = instruction index dest_idx = destination index op = operand

## ◆ printSubGraph()

void File::TPGGraphDotExporter::printSubGraph | ( | const TPG::TPGVertex * | root | ) |

Print a sub-tree of the TPGGraph given when constructing the TPGGraphDotExporter into a dot file.

Contrary to the print() method, which prints the whole TPG, this method only prints the TPG stemming from the TPG::TPGVertex passed as a parameter. Hence, only vertices and programs connected to this TPGVertex will be printed in the file, and all others will be ignored.

Parameters

  [in] | root | The vertex used as a starting point to print a connected TPG.

## ◆ printTPGAction()

uint64_t File::TPGGraphDotExporter::printTPGAction | ( | const TPG::TPGAction & | action | ) |
| protected

Print the dot content for the given TPGAction.

Content is printed directly into the file opened by the class constructor, or by a call to setNewFilePath. This method returns the identifier associated to the printed action so that the print TPGEdge method can target this TPGAction. Indeed, contrary to TPGTeam which have a unique ID, each action is printed on the fly, with a unique ID, when a TPGEdge is targetting this action.

Parameters

  [in] | action | the TPGTeam being printed.

Returns
  the identifier associated to this action.

## ◆ printTPGEdge()

void File::TPGGraphDotExporter::printTPGEdge | ( | const TPG::TPGEdge & | edge | ) |
| protected

Prints the dot content for the given TPGEdge. Prints the program index followed by its contants if the constants are used.

the program is printed under the format : Pindex [fillcolor=#cccccc shape = point] //constant1|...|constant_n

Parameters

  [in] | edge | the TPGEdge being printed.

## ◆ printTPGGraphFooter()

void File::TPGGraphDotExporter::printTPGGraphFooter | ( |  | ) |
| protected

Prints footer content in the dot file.

This method prints finalization content that must be printed into the dot file after all vertices and edges.

## ◆ printTPGGraphHeader()

void File::TPGGraphDotExporter::printTPGGraphHeader | ( |  | ) |
| protected

Prints header content in the dot file.

This method prints preliminary content that must be printed into the dot file before any vertex or edge.

## ◆ printTPGTeam()

void File::TPGGraphDotExporter::printTPGTeam | ( | const TPG::TPGTeam & | team | ) |
| protected

Print the dot content for the given TPGTeam.

Content is printed directly into the file opened by the class constructor, or by a call to setNewFilePath.

Parameters

  [in] | team | the TPGTeam being printed.

Copyright or © or Copr. IETR/INSA - Rennes (2019 - 2025) :

Karol Desnos kdesn.nosp@m.os@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2019 - 2022) Nicolas Sourbier nsour.nosp@m.bie@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2019 - 2020) Quentin Vacher qvach.nosp@m.er@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2025) Thomas Bourgoin tbour.nosp@m.goi@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2021)

GEGELATI is an open-source reinforcement learning framework for training artificial intelligence based on Tangled Program Graphs (TPGs).

This software is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".

As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.

In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.

The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms.

## ◆ setNewFilePath()

void File::TPGGraphDotExporter::setNewFilePath | ( | const char * | newFilePath | ) |
| inline

Set a new file for the exporter.

Parameters

  [in] | newFilePath | new path to the file where the dot content will be written.

Exceptions

  std::runtime_error | in case no file could be opened at the given newFilePath.

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

- D:/a/gegelati/gegelati/gegelatilib/include/file/tpgGraphDotExporter.h
- D:/a/gegelati/gegelati/gegelatilib/src/file/tpgGraphDotExporter.cpp