GEGELATI
|
The Environment class contains all information needed to execute a Program. More...
#include <environment.h>
Public Member Functions | |
Environment (const Instructions::Set &iSet, const std::vector< std::reference_wrapper< const Data::DataHandler > > &dHandlers, const size_t nbRegs, const size_t nbConst=0) | |
Constructor with initialization of all attributes. More... | |
size_t | getNbRegisters () const |
Get the size of the number of registers of this Environment. More... | |
size_t | getNbConstant () const |
Get the number of constants used by programs. More... | |
size_t | getNbInstructions () const |
Get the size of the number of Instruction within the Instructions::Set. More... | |
size_t | getMaxNbOperands () const |
Get the size of the maximum number of operands of Instructions::Set. More... | |
size_t | getNbDataSources () const |
Get the size of the number of DataHandlers. More... | |
size_t | getLargestAddressSpace () const |
Get the size of the largestAddressSpace of DataHandlers. More... | |
const LineSize & | getLineSize () const |
Get the size of the line for this environment (in bits). More... | |
const std::vector< std::reference_wrapper< const Data::DataHandler > > & | getDataSources () const |
Get the DataHandler of the Environment. More... | |
const std::vector< std::reference_wrapper< const Data::DataHandler > > & | getFakeDataSources () const |
const Instructions::Set & | getInstructionSet () const |
Get the Instruction Set of the Environment. More... | |
Static Protected Member Functions | |
static size_t | computeLargestAddressSpace (const size_t nbRegisters, const size_t nbConstants, const std::vector< std::reference_wrapper< const Data::DataHandler > > &dHandlers) |
Static method used when constructing a new Environment to compute the largest AddressSpace of a set of DataHandler. More... | |
static const LineSize | computeLineSize (const Environment &env) |
Static method used to compute the size of Program lines based on information from the Enviroment. More... | |
static Instructions::Set | filterInstructionSet (const Instructions::Set &iSet, const size_t nbRegisters, const size_t nbConstants, const std::vector< std::reference_wrapper< const Data::DataHandler > > &dataSources) |
Filter an InstructionSet to keep only Instruction with operand types provided by the given DataHandler. More... | |
Protected Attributes | |
const Instructions::Set | instructionSet |
Set of Instruction used by Program running within this Environment. | |
const std::vector< std::reference_wrapper< const Data::DataHandler > > | dataSources |
List of DataHandler that can be accessed within this Environment. | |
const size_t | nbRegisters |
Number of registers. | |
const size_t | nbConstants |
Number of constants. | |
std::vector< std::reference_wrapper< const Data::DataHandler > > | fakeDataSources |
Vector of DataHandlers containing the environment's dataSources. | |
const Data::PrimitiveTypeArray< double > | fakeRegisters |
DataHandler whost type corresponds to registers. | |
const Data::ConstantHandler | fakeConstants |
DataHandler whost type corresponds to the programs constants. | |
const size_t | nbInstructions |
Number of Instruction in the Instructions::Set. | |
const size_t | maxNbOperands |
Maxmimum number of operands of the Instructions::Set. | |
const size_t | nbDataSources |
Number of DataHandler from which data can be accessed. | |
const size_t | largestAddressSpace |
Size of the largestAddressSpace of DataHandlers. | |
const LineSize | lineSize |
Size of lines within this Environment. | |
The Environment class contains all information needed to execute a Program.
To execute a Program, and size adequately its ProgramLine, a fixed Instruction Set, a list of available input DataHandler, and the number of available registers is needed.
To ensure viability of Program based on a given Environment, all attributes of an Environment are copied in const attributes at construction time.
|
inline |
Constructor with initialization of all attributes.
To ensure viability of Program based on a given Environment, all attributes of an Environment are copied in const attributes at construction time.
[in] | iSet | the Instructions::Set whose Instruction will be used in this Environment. |
[in] | dHandlers | the list of DataHandler that will be used in this Environment. |
[in] | nbRegs | the number of double registers in this Environment. |
[in] | nbConst | the number of program's constants in this Environment. |
|
staticprotected |
Static method used when constructing a new Environment to compute the largest AddressSpace of a set of DataHandler.
[in] | nbRegisters | the number of registers of the environment. |
[in] | nbConstants | the number of program's constants. |
[in] | dHandlers | reference to the set of DataHandler whose largest largestAddressSpace is searched. |
Copyright or © or Copr. IETR/INSA - Rennes (2019 - 2021) :
Karol Desnos kdesn.nosp@m.os@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2019 - 2020) Nicolas Sourbier nsour.nosp@m.bie@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2020) 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.
|
staticprotected |
Static method used to compute the size of Program lines based on information from the Enviroment.
The Program line size, expressed in bits, is computed with the following formula: $ ceil(log2(i)) + ceil(log2(n))+ m*(ceil(log2(nb_{src}))+ceil(log2(largestAddressSpace)) + p*32$ With bits organised (theoretically) in the same order as in the equation | Instruction | destination | operands See PROJECT/doc/instructions.md for more details.
[in] | env | The Environment whose information is used. |
std::domain_error | in cases where the given Environment is parameterized with no registers, contains no Instruction, Instruction with no operands, no DataHandler or DataHandler with no addressable Space. |
|
staticprotected |
Filter an InstructionSet to keep only Instruction with operand types provided by the given DataHandler.
[in] | iSet | the Instructions::Set to filter. |
[in] | nbRegisters | Number of registers |
[in] | nbConstants | Number of constants of the program |
[in] | dataSources | a set of DataHandler providing data. |
const std::vector< std::reference_wrapper< const Data::DataHandler > > & Environment::getDataSources | ( | ) | const |
Get the DataHandler of the Environment.
const std::vector< std::reference_wrapper< const Data::DataHandler > > & Environment::getFakeDataSources | ( | ) | const |
Get the datasource identical to the one used by programs
Getting the data sources identical to the one used by programs when executing a Program can be useful, notably when mutating a Program::Line and assessing whether a data type can be provided by the registers.
const Instructions::Set & Environment::getInstructionSet | ( | ) | const |
Get the Instruction Set of the Environment.
size_t Environment::getLargestAddressSpace | ( | void | ) | const |
Get the size of the largestAddressSpace of DataHandlers.
const LineSize & Environment::getLineSize | ( | ) | const |
Get the size of the line for this environment (in bits).
size_t Environment::getMaxNbOperands | ( | ) | const |
Get the size of the maximum number of operands of Instructions::Set.
size_t Environment::getNbConstant | ( | ) | const |
Get the number of constants used by programs.
size_t Environment::getNbDataSources | ( | ) | const |
Get the size of the number of DataHandlers.
size_t Environment::getNbInstructions | ( | ) | const |
Get the size of the number of Instruction within the Instructions::Set.
size_t Environment::getNbRegisters | ( | ) | const |
Get the size of the number of registers of this Environment.