GEGELATI
|
Functions | |
void | initRandomProgram (Program::Program &p, const MutationParameters ¶ms, Mutator::RNG &rng) |
(Re)Initialize a program randomly. More... | |
bool | deleteRandomLine (Program::Program &p, Mutator::RNG &rng) |
Deletes a randomly selected Line of the given Program. More... | |
void | insertRandomLine (Program::Program &p, Mutator::RNG &rng) |
Insert a new Line at a randomly selected position within the given Program. More... | |
bool | swapRandomLines (Program::Program &p, Mutator::RNG &rng) |
Swap two randomly selected instructions within the given Program. More... | |
bool | alterRandomLine (Program::Program &p, Mutator::RNG &rng) |
Alter a randomly selected Line in a given Program. More... | |
bool | alterRandomConstant (Program::Program &p, const MutationParameters ¶ms, Mutator::RNG &rng) |
Alter a program's constant. More... | |
bool | mutateProgram (Program::Program &p, const MutationParameters ¶ms, Mutator::RNG &rng) |
Mutate the behavior of the Program with given probabilities. More... | |
Namespace containing all functions to apply randomness to a Program::Program
bool Mutator::ProgramMutator::alterRandomConstant | ( | Program::Program & | p, |
const MutationParameters & | params, | ||
Mutator::RNG & | rng | ||
) |
Alter a program's constant.
If the constants are used, this function selects one of them in a pseudo-random way and modifies it Random selection is based on the given Mutator::RNG.
This method does NOT update automatically the intron property of the Lines of the Program. Hence, the resulting Program may not execute correctly until Program::identifyIntrons() method is called.
[in,out] | p | the Program whose line will be altered. |
[in] | params | the mutation parameters |
[in] | rng | Random Number Generator used in the mutation process. |
bool Mutator::ProgramMutator::alterRandomLine | ( | Program::Program & | p, |
Mutator::RNG & | rng | ||
) |
Alter a randomly selected Line in a given Program.
If the given Program has more than 0 Line, this function selects a Line (pseudo)-randomly in a given Program and calls the Mutator::LineMutator:AlterCorrectLine function on it. Random selection is based on the given Mutator::RNG.
This method does NOT update automatically the intron property of the Lines of the Program. Hence, the resulting Program may not execute correctly until Program::identifyIntrons() method is called.
[in,out] | p | the Program whose line will be altered. |
[in] | rng | Random Number Generator used in the mutation process. |
bool Mutator::ProgramMutator::deleteRandomLine | ( | Program::Program & | p, |
Mutator::RNG & | rng | ||
) |
Deletes a randomly selected Line of the given Program.
Unless a single Line (or less) remains in the given Progeam, this function randomly selects a line of the Program and deletes it. Random selection is based on the given Mutator::RNG.
This method does NOT update automatically the intron property of the Lines of the Program. Hence, the resulting Program may not execute correctly until Program::identifyIntrons() method is called.
[in,out] | p | the Program whose lines will be altered. |
[in] | rng | Random Number Generator used in the mutation process. |
void Mutator::ProgramMutator::initRandomProgram | ( | Program::Program & | p, |
const MutationParameters & | params, | ||
Mutator::RNG & | rng | ||
) |
(Re)Initialize a program randomly.
Initialise a Program with a random number or Line, below the given limit. If the Program already contains lines, they will be entirely deleted by this function.
After altering the Program, its intron Line are identified with a call to Program::identifyIntrons().
[in,out] | p | the Program to initialize. |
[in] | params | MutationParameters for the mutation. |
[in] | rng | Random Number Generator used in the mutation process. |
Copyright or © or Copr. IETR/INSA - Rennes (2019 - 2020) :
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)
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 Mutator::ProgramMutator::insertRandomLine | ( | Program::Program & | p, |
Mutator::RNG & | rng | ||
) |
Insert a new Line at a randomly selected position within the given Program.
This function randomly selects a position in the Program.lines and insert a randomly initialized line (using Mutator::Line:: initRandomCorrectLine). Random selection is based on the given Mutator::RNG.
This method does NOT update automatically the intron property of the Lines of the Program. Hence, the resulting Program may not execute correctly until Program::identifyIntrons() method is called.
[in,out] | p | the Program whose lines will be altered. |
[in] | rng | Random Number Generator used in the mutation process. |
bool Mutator::ProgramMutator::mutateProgram | ( | Program::Program & | p, |
const MutationParameters & | params, | ||
Mutator::RNG & | rng | ||
) |
Mutate the behavior of the Program with given probabilities.
Following the probabilities given as arguments to the function, the Program may be modified by deleting a random line, adding a new line at a random position, modifying the line behavior, or swapping instructions within the Program.
Because of the probabilistic nature of this function, it may happen that no alteration is peformed.
After altering the Program, its intron Line are identified with a call to Program::identifyIntrons().
[in,out] | p | the Program whose line will be altered. |
[in] | params | MutationParameters for the mutation. |
[in] | rng | Random Number Generator used in the mutation process. |
bool Mutator::ProgramMutator::swapRandomLines | ( | Program::Program & | p, |
Mutator::RNG & | rng | ||
) |
Swap two randomly selected instructions within the given Program.
This function selects two lines of the program randomly and swaps them. If the given Program has less than two lines, nothing happens. Random selection is based on the given Mutator::RNG.
This method does NOT update automatically the intron property of the Lines of the Program. Hence, the resulting Program may not execute correctly until Program::identifyIntrons() method is called.
[in,out] | p | the Program whose lines will be swapped. |
[in] | rng | Random Number Generator used in the mutation process. |