From ef34af74938eb0a54ce8fd9454003dce233da5ca Mon Sep 17 00:00:00 2001 From: LPTK Date: Thu, 13 Jun 2013 16:06:14 +0200 Subject: [PATCH] test for stddevest --- eo/src/eo | 1 + .../moStdDevEstimator.h | 2 +- mo/test/t-moStdDevEstimator.cpp | 76 +++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) rename mo/src/{continuator => sampling}/moStdDevEstimator.h (98%) diff --git a/eo/src/eo b/eo/src/eo index 8196e2b14..5057371d3 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -35,6 +35,7 @@ // general purpose #include #include +#include #include #include #include diff --git a/mo/src/continuator/moStdDevEstimator.h b/mo/src/sampling/moStdDevEstimator.h similarity index 98% rename from mo/src/continuator/moStdDevEstimator.h rename to mo/src/sampling/moStdDevEstimator.h index e517240db..338984f3b 100644 --- a/mo/src/continuator/moStdDevEstimator.h +++ b/mo/src/sampling/moStdDevEstimator.h @@ -4,7 +4,7 @@ #include #include -#include // TODO rm +#include // TODO rm #include // TODO rm // TODO make tests diff --git a/mo/test/t-moStdDevEstimator.cpp b/mo/test/t-moStdDevEstimator.cpp index e69de29bb..43f51cb8c 100644 --- a/mo/test/t-moStdDevEstimator.cpp +++ b/mo/test/t-moStdDevEstimator.cpp @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// t-moStdDevEstimator.cpp +//----------------------------------------------------------------------------- + +#include +#include "es/eoReal.h" +#include "continuator/moFitnessVarianceStat.h" +#include "neighborhood/moRealNeighbor.h" +#include "neighborhood/moRealNeighborhood.h" + +//Representation and initializer +#include +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include + +//Algorithm and its components +#include +#include + +//comparator +#include + + +#include + + +//----------------------------------------------------------------------------- +// Define types of the representation solution, different neighbors and neighborhoods +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moRndWithReplNeighborhood rndShiftNeighborhood; //rnd shift Neighborhood (Indexed) + +//----------------------------------------------------------------------------- + +typedef eoReal< eoMinimizingFitness > EOT; +typedef moRealNeighbor< EOT > Neighbor; + +int main(int ac, char** av) +{ + + + unsigned vecSize = 8; + + + queenEval fullEval; + + + eoInitPermutation init(vecSize); + + //moFullEvalByCopy shiftEval(fullEval); /// by default + + rndShiftNeighborhood rndShiftNH((vecSize-1) * (vecSize-1)); + + Queen solution; + + init(solution); + + fullEval(solution); + + moStdDevEstimator initTemp (500, rndShiftNH, fullEval); + + + std::cout << "temp: " << initTemp(solution) << std::endl; + //assert(stat.value() == 625); +}