* whitespace cleanup
This commit is contained in:
parent
56c6edab04
commit
70e60a50d2
195 changed files with 1763 additions and 1873 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// t-eoFitnessAssembledEA.cpp
|
||||
// Marc Wintermantel & Oliver Koenig
|
||||
|
|
@ -11,19 +11,19 @@
|
|||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||
Marc.Schoenauer@inria.fr
|
||||
mak@dhi.dk
|
||||
Marc.Schoenauer@inria.fr
|
||||
mak@dhi.dk
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
#include <es/eoReal.h> // Definition of representation
|
||||
#include <es/eoRealInitBounded.h> // Uniformly initializes real vector in bounds
|
||||
#include <es/make_genotype_real.h> // Initialization of a genotype
|
||||
#include <eoEvalFunc.h> // Base class for fitness evaluation
|
||||
#include <eoEvalFunc.h> // Base class for fitness evaluation
|
||||
#include <es/make_op_real.h> // Variation operators using standard Real operators
|
||||
#include <eoScalarFitnessAssembled.h> // The fitness class
|
||||
typedef eoReal<eoAssembledMinimizingFitness> Indi;
|
||||
|
|
@ -51,7 +51,7 @@ typedef eoReal<eoAssembledMinimizingFitness> Indi;
|
|||
#include <do/make_continue.h> // The stopping criterion
|
||||
#include <do/make_checkpoint_assembled.h> // Outputs (stats, population dumps, ...)
|
||||
#include <do/make_algo_scalar.h> // Evolution engine (selection and replacement)
|
||||
#include <do/make_run.h> // simple call to the algo.stays there for consistency reasons
|
||||
#include <do/make_run.h> // simple call to the algo.stays there for consistency reasons
|
||||
|
||||
// Define a fitness class
|
||||
template <class EOT>
|
||||
|
|
@ -59,9 +59,9 @@ class eoAssembledEvalFunc : public eoEvalFunc<EOT>{
|
|||
public:
|
||||
// Constructor defining number and descriptions of fitness terms
|
||||
eoAssembledEvalFunc() {
|
||||
|
||||
|
||||
// Define a temporary fitness object to have access to its static traits
|
||||
typename EOT::Fitness tmpfit(3, 0.0);
|
||||
typename EOT::Fitness tmpfit(3, 0.0);
|
||||
tmpfit.setDescription(0,"Fitness");
|
||||
tmpfit.setDescription(1,"Some Value");
|
||||
tmpfit.setDescription(2,"Other Value");
|
||||
|
|
@ -70,27 +70,27 @@ public:
|
|||
|
||||
void operator()(EOT& _eo){
|
||||
|
||||
// Define temporary fitness object
|
||||
// Define temporary fitness object
|
||||
// (automatically gets initialized with size given in constructor)
|
||||
typename EOT::Fitness tmpfit;
|
||||
|
||||
|
||||
// Eval some dummy fitness
|
||||
double sum1=0.0, sum2=0.0;
|
||||
for (unsigned i=0; i < _eo.size(); ++i){
|
||||
sum1 += _eo[i]*_eo[i];
|
||||
sum2 += fabs(_eo[i]) + fabs(_eo[i]);
|
||||
}
|
||||
|
||||
|
||||
// Store some fitness terms
|
||||
tmpfit[1]= sum1;
|
||||
tmpfit[2]= sum2;
|
||||
|
||||
|
||||
// Store the fitness
|
||||
tmpfit = (sum1 + sum2)/_eo.size();
|
||||
|
||||
// Pass it
|
||||
_eo.fitness( tmpfit );
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -99,14 +99,14 @@ void make_help(eoParser & _parser);
|
|||
|
||||
// now use all of the above, + representation dependent things
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
|
||||
std::cout << "-----------------------------------" << std::endl;
|
||||
std::cout << "START t-eoFitnessAssembledEA" << std::endl;
|
||||
|
||||
try{
|
||||
|
||||
// Parser & State
|
||||
eoParser parser(argc, argv); // for user-parameter reading
|
||||
eoParser parser(argc, argv); // for user-parameter reading
|
||||
eoState state; // keeps all things allocated
|
||||
|
||||
////
|
||||
|
|
@ -120,7 +120,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
// The genotype
|
||||
eoRealInitBounded<Indi>& init = do_make_genotype(parser, state, Indi() );
|
||||
|
||||
|
||||
// The variation operators
|
||||
eoGenOp<Indi>& op = do_make_op(parser, state, init);
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ int main(int argc, char* argv[]){
|
|||
std::cout << "Final Population\n";
|
||||
pop.sortedPrintOn(std::cout);
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue