From 2767fadf90396599c25bc1f28d2c6c2cf707a0d3 Mon Sep 17 00:00:00 2001 From: tlegrand Date: Mon, 12 Nov 2007 15:41:46 +0000 Subject: [PATCH] added permutation init --- eo/src/eoInit.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 0df3de35..c329ecbd 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -32,6 +32,7 @@ #include #include #include +#include // for shuffle method /** Base (name) class for Initialization of chromosomes, used in a population @@ -146,6 +147,36 @@ private : eoInit & init; }; + +/** + Initializer for permutation (integer-based) representations. +*/ +template +class eoInitPermutation: public eoInit +{ + public: + + typedef typename EOT::AtomType AtomType; + + eoInitPermutation(unsigned _chromSize) + : chromSize(_chromSize){} + + virtual void operator()(EOT& chrom) + { + chrom.resize(chromSize); + for(unsigned idx=0;idx gen; +}; + + /** eoInitAdaptor changes the place in the hierarchy from eoInit to eoMonOp. This is mainly a type conversion,