review and update the documentation

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2352 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
boufaras 2011-08-03 09:44:15 +00:00
commit 3d7ae37f64

View file

@ -44,14 +44,15 @@ using namespace std;
#include <ga.h> #include <ga.h>
// OneMax full eval function // OneMax full eval function
#include <problems/eval/EvalOneMax.h> #include <problems/eval/EvalOneMax.h>
// OneMax increment eval function //Parallel evaluation of neighborhood on GPU
#include <eval/moGPUEvalByModif.h> #include <eval/moGPUEvalByModif.h>
// OneMax increment eval function
#include <problems/eval/OneMaxIncrEval.h> #include <problems/eval/OneMaxIncrEval.h>
// One Max solution // One Max solution
#include <GPUType/moGPUBitVector.h> #include <GPUType/moGPUBitVector.h>
// One Max neighbor // Bit neighbor
#include <neighborhood/moGPUBitNeighbor.h> #include <neighborhood/moGPUBitNeighbor.h>
// One Max ordered neighborhood // Random with replacement neighborhood
#include <neighborhood/moGPURndWithReplNeighborhoodByModif.h> #include <neighborhood/moGPURndWithReplNeighborhoodByModif.h>
// The Solution and neighbor comparator // The Solution and neighbor comparator
#include <comparator/moNeighborComparator.h> #include <comparator/moNeighborComparator.h>
@ -73,7 +74,7 @@ using namespace std;
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Define types of the representation solution, different neighbors and neighborhoods // Define types of the representation solution, different neighbors and neighborhoods
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// REPRESENTATION
typedef moGPUBitVector<eoMaximizingFitness> solution; typedef moGPUBitVector<eoMaximizingFitness> solution;
typedef moGPUBitNeighbor <eoMaximizingFitness> Neighbor; typedef moGPUBitNeighbor <eoMaximizingFitness> Neighbor;
typedef moGPURndWithReplNeighborhoodByModif<Neighbor> Neighborhood; typedef moGPURndWithReplNeighborhoodByModif<Neighbor> Neighborhood;
@ -96,16 +97,6 @@ void main_function(int argc, char **argv)
parser.processParam( seedParam ); parser.processParam( seedParam );
unsigned seed = seedParam.value(); unsigned seed = seedParam.value();
// description of genotype
eoValueParam<unsigned int> vecSizeParam(8, "vecSize", "Genotype size", 'V');
parser.processParam( vecSizeParam, "Representation" );
unsigned vecSize = vecSizeParam.value();
//Number of position to change
eoValueParam<unsigned int> nbPosParam(1, "nbPos", "X Change", 'N');
parser.processParam( nbPosParam, "Exchange" );
unsigned nbPos = nbPosParam.value();
// the name of the "status" file where all actual parameter values will be saved // the name of the "status" file where all actual parameter values will be saved
string str_status = parser.ProgramName() + ".status"; // default value string str_status = parser.ProgramName() + ".status"; // default value
eoValueParam<string> statusParam(str_status.c_str(), "status", "Status file"); eoValueParam<string> statusParam(str_status.c_str(), "status", "Status file");
@ -138,7 +129,7 @@ void main_function(int argc, char **argv)
* *
* ========================================================= */ * ========================================================= */
solution sol(vecSize); solution sol(SIZE);
/* ========================================================= /* =========================================================
* *
@ -155,7 +146,7 @@ void main_function(int argc, char **argv)
* ========================================================= */ * ========================================================= */
OneMaxIncrEval<Neighbor> incr_eval; OneMaxIncrEval<Neighbor> incr_eval;
moGPUEvalByModif<Neighbor,OneMaxIncrEval<Neighbor> > cueval(vecSize,incr_eval); moGPUEvalByModif<Neighbor,OneMaxIncrEval<Neighbor> > gpuEval(SIZE,incr_eval);
/* ========================================================= /* =========================================================
* *
@ -163,7 +154,7 @@ void main_function(int argc, char **argv)
* *
* ========================================================= */ * ========================================================= */
Neighborhood neighborhood(vecSize,cueval); Neighborhood neighborhood(SIZE,gpuEval);
/* ========================================================= /* =========================================================
* *
@ -181,7 +172,7 @@ void main_function(int argc, char **argv)
* *
* ========================================================= */ * ========================================================= */
moSA<Neighbor> SA(neighborhood, eval, cueval,coolingSchedule); moSA<Neighbor> SA(neighborhood, eval, gpuEval,coolingSchedule);
/* ========================================================= /* =========================================================
* *
@ -191,15 +182,12 @@ void main_function(int argc, char **argv)
//init(solution); //init(solution);
eval(sol); eval(sol);
std::cout << "#########################################" << std::endl;
std::cout << "initial : " << sol << std::endl; std::cout << "initial : " << sol << std::endl;
moGPUTimer timer1; moGPUTimer timer1;
timer1.start(); timer1.start();
SA(sol); SA(sol);
timer1.stop(); timer1.stop();
std::cout << "final : " << sol << std::endl; std::cout << "final : " << sol << std::endl;
std::cout << "#########################################" << std::endl;
printf("Execution time = %f ms\n",timer1.getTime()); printf("Execution time = %f ms\n",timer1.getTime());
timer1.deleteTimer(); timer1.deleteTimer();