GEGELATI
|
#include <policyStats.h>
Public Member Functions | |
PolicyStats ()=default | |
Default constructor. | |
void | clear () |
void | setEnvironment (const Environment &env) |
Set Environement used during analyses. More... | |
void | analyzeLine (const Program::Line *line) |
Analyze the given Line. More... | |
void | analyzeProgram (const Program::Program *prog) |
Analyze the given Program. More... | |
void | analyzeTPGTeam (const TPG::TPGTeam *team) |
void | analyzeTPGAction (const TPG::TPGAction *action) |
void | analyzePolicy (const TPG::TPGVertex *vertex) |
Public Attributes | |
std::map< const Program::Program *, size_t > | nbUsePerProgram |
Number of time a Program was analyzed. More... | |
std::map< const TPGTeam *, size_t > | nbUsePerTPGTeam |
Number of time a TPGTeam was analyzed. More... | |
std::map< const TPGAction *, size_t > | nbUsePerTPGAction |
Number of time a TPGAction was analyzed. More... | |
std::vector< size_t > | nbLinesPerProgram |
Number of lines of analyzed Program. | |
std::vector< size_t > | nbIntronPerProgram |
Number of intron lines of analyzed Program. | |
std::map< size_t, size_t > | nbUsagePerInstruction |
std::map< std::pair< size_t, size_t >, size_t > | nbUsagePerDataLocation |
std::vector< size_t > | nbOutgoingEdgesPerTeam |
Number of outgoing TPGEdge of per TPGTeam of the TPGGraph. | |
std::map< size_t, size_t > | nbUsagePerActionID |
size_t | maxPolicyDepth = 0 |
Depth of the analyzed policy. | |
std::map< size_t, size_t > | nbTPGVertexPerDepthLevel |
size_t | nbDistinctTeams = 0 |
Number of distinct TPGTeams per policy. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const PolicyStats &policyStats) |
Overload of the stream output operator for the PolicyStats class. | |
Utility class for extracting statistics from a policy within a TPGGraph.
The entry point for using this class is the analyzePolicy() method which updates all attribute for a "tree" starting from a given root TPGVertex.
To analyze different policies with a single PolicyStats instance, the clear() method should be called between calls to analyzePolicy().
For access simplicity, all attributes filled during the analysis are public. Tampering with them will just make the result of the analysis useless.
void TPG::PolicyStats::analyzeLine | ( | const Program::Line * | line | ) |
Analyze the given Line.
The method updates the following stats:
void TPG::PolicyStats::analyzePolicy | ( | const TPG::TPGVertex * | vertex | ) |
void TPG::PolicyStats::analyzeProgram | ( | const Program::Program * | prog | ) |
Analyze the given Program.
The method updates the following stats:
For each non-intron line, the analyzeLine() method will be called.
If a Program was already analyzed, it will not be analyzed again and only the number of use per program will be updated.
[in] | prog | the analyzed Program. |
std::runtime_error | if the given Program has incorrect lines accessing for example non existing instructions. |
void TPG::PolicyStats::analyzeTPGAction | ( | const TPG::TPGAction * | action | ) |
void TPG::PolicyStats::analyzeTPGTeam | ( | const TPG::TPGTeam * | team | ) |
Analyze the given TPGTeam.
The method updates the following stats:
If a TPGTeam was already analyzed, it will not be analyzed again and only the number of use per TPGTeam will be updated.
void TPG::PolicyStats::clear | ( | ) |
Clear all stats stored in the class attributes.
Copyright or © or Copr. IETR/INSA - Rennes (2020) :
Karol Desnos kdesn.nosp@m.os@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2020) Nicolas Sourbier nsour.nosp@m.bie@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2020)
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.
void TPG::PolicyStats::setEnvironment | ( | const Environment & | env | ) |
Set Environement used during analyses.
From the given Environment, this method sets class attributes used during the analyses of the Program and Line of the policy. If the given Environment does not correspond to the one known to the Program exceptions may be thrown during analyses.
std::map<size_t, size_t> TPG::PolicyStats::nbTPGVertexPerDepthLevel |
std::map<size_t, size_t> TPG::PolicyStats::nbUsagePerActionID |
Each entry of this map associates an action ID to the number of time it was present in the analyzed policy.
std::map<std::pair<size_t, size_t>, size_t> TPG::PolicyStats::nbUsagePerDataLocation |
Each entry of this map associates a data location with the total number of times it was accessed by non-intron lines of analyzed Programs. Each data location is itself represented with a pair consisting of the data source index, and the location within this data source.
std::map<size_t, size_t> TPG::PolicyStats::nbUsagePerInstruction |
Each entry of this map associates an Instruction identifier from an instruction set with the total number of times it was used in analyzed Programs.
std::map<const Program::Program*, size_t> TPG::PolicyStats::nbUsePerProgram |
std::map<const TPGAction*, size_t> TPG::PolicyStats::nbUsePerTPGAction |
std::map<const TPGTeam*, size_t> TPG::PolicyStats::nbUsePerTPGTeam |