Bitflip mutation operator. More...
#include <shark/Algorithms/DirectSearch/Operators/Mutation/BitflipMutator.h>
| Public Member Functions | |
| BitflipMutator () | |
| Default c'tor. | |
| template<typename Function > | |
| void | init (const Function &f) | 
| Initializes the operator for the supplied fitness function. | |
| template<typename Rng , typename IndividualType > | |
| void | operator() (Rng &rng, IndividualType &ind) | 
| Mutates the supplied individual. | |
| template<typename Archive > | |
| void | serialize (Archive &archive, const unsigned int version) | 
| Serializes this instance to the supplied archive. | |
| Public Attributes | |
| double | m_mutationStrength | 
Bitflip mutation operator.
Given a binary vector, a coin is flipped for every element. If it is heads, the element of the vector is flipped. By initializing the mutator with the objective function, this strength is set to a dfault value of 1/dimensions, thus in the mean one element is flipped.
Definition at line 44 of file BitflipMutator.h.
| 
 | inline | 
Default c'tor.
Definition at line 47 of file BitflipMutator.h.
| 
 | inline | 
Initializes the operator for the supplied fitness function.
| [in] | f | Instance of the objective function to initialize the operator for. | 
Definition at line 53 of file BitflipMutator.h.
References m_mutationStrength.
| 
 | inline | 
Mutates the supplied individual.
| [in] | rng | Random number generator. | 
| [in,out] | ind | Individual to be mutated. | 
Definition at line 62 of file BitflipMutator.h.
References shark::random::coinToss(), m_mutationStrength, and shark::Individual< PointType, FitnessTypeT, Chromosome >::searchPoint().
| 
 | inline | 
Serializes this instance to the supplied archive.
| [in,out] | archive | The archive to serialize to. | 
| [in] | version | Version information (optional and not used here). | 
Definition at line 76 of file BitflipMutator.h.
References m_mutationStrength.
| double shark::BitflipMutator::m_mutationStrength | 
Definition at line 80 of file BitflipMutator.h.
Referenced by init(), operator()(), and serialize().