CLeaned up the comments in files related to Sharing (added t-eoSharing in test)
This commit is contained in:
parent
e7643ccc10
commit
57881e56c4
2 changed files with 13 additions and 23 deletions
|
|
@ -24,7 +24,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef eoSharing_h
|
||||
#define eoPerf2Worth_h
|
||||
#define eoSharing_h
|
||||
|
||||
#include <eoPerf2Worth.h>
|
||||
#include <utils/eoDistance.h>
|
||||
|
|
@ -33,8 +33,7 @@
|
|||
* Goldberg and Richardson's basic sharing
|
||||
*/
|
||||
|
||||
// First a helper class
|
||||
// helper class to hold distances
|
||||
/** A helper class for Sharing - to hold distances */
|
||||
class dMatrix : public std::vector<double>
|
||||
{
|
||||
public:
|
||||
|
|
@ -71,7 +70,11 @@
|
|||
};
|
||||
|
||||
|
||||
// template <class EOT, class Dist = eoQuadDistance<EOT> >
|
||||
/** Sharing is a perf2worth class that implements
|
||||
* Goldberg and Richardson's basic sharing
|
||||
* see eoSharingSelect for how to use it
|
||||
* and test/t-eoSharing.cpp for a sample use of both
|
||||
*/
|
||||
template <class EOT>
|
||||
class eoSharing : public eoPerf2Worth<EOT>
|
||||
{
|
||||
|
|
@ -107,28 +110,13 @@ class eoSharing : public eoPerf2Worth<EOT>
|
|||
}
|
||||
}
|
||||
|
||||
// cout << "Matrice des similarités\n";
|
||||
// for (i=0; i<pSize; i++)
|
||||
// {
|
||||
// for (j=0; j<pSize; j++)
|
||||
// {
|
||||
// cout << distMatrix(i,j) << " ";
|
||||
// }
|
||||
// cout << "\n";
|
||||
// }
|
||||
// cout << endl;
|
||||
|
||||
// cout << "Les similarités cumulées\n";
|
||||
// compute the cumulated similarities
|
||||
for (i=0; i<pSize; i++)
|
||||
{
|
||||
double sum=0.0;
|
||||
for (j=0; j<pSize; j++)
|
||||
sum += distMatrix(i,j);
|
||||
sim[i] = sum;
|
||||
// cout << sim[i] << " ";
|
||||
}
|
||||
// cout << endl;
|
||||
|
||||
// now set the worthes values
|
||||
for (i = 0; i < _pop.size(); ++i)
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@
|
|||
#include <eoSelectFromWorth.h>
|
||||
#include <eoSharing.h>
|
||||
|
||||
/** eoRankingSelect: select an individual by roulette wheel on its rank
|
||||
* is an eoRouletteWorthSelect, i.e. a selector using a std::vector of worthes
|
||||
* rather than the raw fitness (see eoSelectFromWorth.h)
|
||||
* uses an internal eoRanking object which is an eoPerf2Worth<EOT, double>
|
||||
/** eoSharingSelect: select an individual by roulette wheel
|
||||
* on its SHARED fitness. It is an eoRouletteWorthSelect,
|
||||
* i.e. a selector using a std::vector of worthes
|
||||
* rather than the raw fitness (see eoSelectFromWorth.h)
|
||||
* It uses an internal eoSharing object which is
|
||||
* an eoPerf2Worth<EOT, double>
|
||||
*/
|
||||
|
||||
template <class EOT>
|
||||
|
|
|
|||
Reference in a new issue