// This file is a part of Framsticks SDK. http://www.framsticks.com/ // Copyright (C) 1999-2017 Maciej Komosinski and Szymon Ulatowski. // See LICENSE.txt for details. // Copyright (C) 1999,2000 Adam Rotaru-Varga (adam_rotaru@yahoo.com), GNU LGPL // Copyright (C) since 2001 Maciej Komosinski #ifndef _GENO_F4_H_ #define _GENO_F4_H_ #include #include "f4_general.h" #include "common/nonstd.h" #include "../oper_fx.h" #include /** @name Codes for general mutation types */ //@{ #define F4_ADD 0 /// neulist) const; /** * Changes connection to an existing neuron or creates an additional * sensor for neuron. * @param nn neuron connection node * @param neuid id of a neuron * @param neulist list of genotype neuron classes */ void linkNodeChangeRandom(f4_node *nn, int neuid, std::vector neulist) const; /** * Introduces a random modification to the neuron node. * @param nn neuron node */ void nparNodeMakeRandom(f4_node *nn) const; /** * Increases or decreases the amount of repetitions in the repetition node. * @param nn repetition node */ void repeatNodeChangeRandom(f4_node *nn) const; /** * Tries to perform a mutation until success. There is a maximum of 20 tries. Returns GENOPER_OK or GENOPER_OPFAIL. * @param g genotype tree * @param method reference to the variable that will get the selected method of mutation * @return GENOPER_OK if performed successful mutation, GENOPER_FAIL otherwise */ int MutateOneValid(f4_node *&g, int &method) const; /** * Performs crossover of two creatures. The 'chg' parameter determines approximately what * percentage of the first creature should form the offspring. '1-chg' is the percentage * of the second creature in the offspring. * @param g1 first parent * @param g2 second parent * @param chg percentage of the first parent in offspring (the second parent has the rest) */ int CrossOverOne(f4_node *g1, f4_node *g2, float chg) const; }; #endif