* whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 17:15:10 +02:00
commit 70e60a50d2
195 changed files with 1763 additions and 1873 deletions

View file

@ -10,7 +10,7 @@
using namespace std;
int main(int argc, char* argv[])
{
{
try
{
@ -29,7 +29,7 @@ int main(int argc, char* argv[])
//////////////////////////////////////////////////////
// EVAL
// The evaluation fn - encapsulated into an eval counter for output
// The evaluation fn - encapsulated into an eval counter for output
eoEvalFuncPtr<EOT, double> mainEval( binary_value<EOT> );
eoEvalFuncCounter<EOT> eval(mainEval);
@ -38,7 +38,7 @@ int main(int argc, char* argv[])
eoInit<EOT>& init = make_genotype(parser, state, EOT());
// if you want to do sharing, you'll need a distance.
// here Hamming distance
// here Hamming distance
eoHammingDistance<EOT> dist;
// OPERATORS
@ -74,7 +74,7 @@ int main(int argc, char* argv[])
// evaluate intial population AFTER help and status in case it takes time
apply<EOT>(eval, pop);
// STOP
// print it out (sort witout modifying)
// print it out (sort witout modifying)
cout << "Initial Population\n";
pop.sortedPrintOn(cout);
cout << endl;
@ -82,7 +82,7 @@ int main(int argc, char* argv[])
// GENERATION
run_ea(ga, pop); // run the ga
// STOP
// print it out (sort witout modifying)
// print it out (sort witout modifying)
cout << "Final Population\n";
pop.sortedPrintOn(cout);
cout << endl;

View file

@ -21,7 +21,7 @@ EXECUTE_PROCESS(
# COMMAND ${CMAKE_COMMAND}
# ARGS -E copy_if_different
# ${EO_SOURCE_DIR}/tutorial/Lesson4/ESEA.param
# ${EO_BINARY_DIR}/tutorial/Lesson4)
# ${EO_BINARY_DIR}/tutorial/Lesson4)
#ADD_CUSTOM_TARGET(param DEPENDS ${EO_SOURCE_DIR}/tutorial/Lesson4/RealEA.param)
#ADD_CUSTOM_COMMAND(
# TARGET param
@ -29,7 +29,7 @@ EXECUTE_PROCESS(
# COMMAND ${CMAKE_COMMAND}
# ARGS -E copy_if_different
# ${EO_SOURCE_DIR}/tutorial/Lesson4/RealEA.param
# ${EO_BINARY_DIR}/tutorial/Lesson4)
# ${EO_BINARY_DIR}/tutorial/Lesson4)
######################################################################################
### 1) Include the sources
@ -44,23 +44,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/ga)
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
### 3) Define your targets
######################################################################################
# no matter what is the OS, hopefully
ADD_EXECUTABLE(BitEA BitEA.cpp)
ADD_EXECUTABLE(RealEA RealEA.cpp)
ADD_EXECUTABLE(ESEA ESEA.cpp)
ADD_EXECUTABLE(BitEA BitEA.cpp)
ADD_EXECUTABLE(RealEA RealEA.cpp)
ADD_EXECUTABLE(ESEA ESEA.cpp)
#ADD_DEPENDENCIES(BitEA es ga eo eoutils)
#ADD_DEPENDENCIES(RealEA es ga eo eoutils)
@ -96,4 +96,3 @@ INSTALL(TARGETS RealEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT e
INSTALL(TARGETS ESEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT examples)
######################################################################################

View file

@ -20,14 +20,14 @@ using namespace std;
#include "real_value.h" // the sphere fitness
// Now the main
///////////////
// Now the main
///////////////
typedef eoMinimizingFitness FitT;
template <class EOT>
void runAlgorithm(EOT, eoParser& _parser, eoState& _state);
int main_function(int argc, char *argv[])
int main_function(int argc, char *argv[])
{
// Create the command-line parser
eoParser parser(argc, argv); // for user-parameter reading
@ -55,33 +55,33 @@ int main_function(int argc, char *argv[])
cout << "Using eoEsStdev" << endl;
runAlgorithm(eoEsStdev<FitT>(), parser, state);
}
else
else
{
cout << "Using eoEsFull" << endl;
runAlgorithm(eoEsFull<FitT>(), parser, state);
}
return 0;
return 0;
}
// A main that catches the exceptions
int main(int argc, char **argv)
{
try
{
main_function(argc, argv);
main_function(argc, argv);
}
catch(exception& e)
{
cout << "Exception: " << e.what() << '\n';
cout << "Exception: " << e.what() << '\n';
}
return 1;
}
/** The templatized main (sort of)
* quite similar to the main of other genotypes
* quite similar to the main of other genotypes
* (e.g. t-eoReal and t-eoGA in test dir)
*/
template <class EOT>
@ -92,9 +92,9 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
///// FIRST, problem or representation dependent stuff
//////////////////////////////////////////////////////
// The evaluation fn - encapsulated into an eval counter for output
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
mainEval( real_value );
// The evaluation fn - encapsulated into an eval counter for output
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
mainEval( real_value );
eoEvalFuncCounter<EOT> eval(mainEval);
// the genotype - through a genotype initializer

View file

@ -1,4 +1,3 @@
###### General ######
# --help=0 # -h : Prints this message
# --stopOnUnknownParam=1 # Stop if unkown param entered
@ -17,7 +16,7 @@
--weakElitism=0 # -w : Old best parent replaces new worst offspring *if necessary*
###### Genotype Initialization ######
# --vecSize=10 # -n : The number of variables
# --vecSize=10 # -n : The number of variables
# --initBounds=10[-1,1] # -B : Bounds for initialization (MUST be bounded)
--sigmaInit=0.3% # -s : Initial value for Sigmas (with a '%' -> scaled by the range of each variable)

View file

@ -1,5 +1,5 @@
### This Makefile is part of the tutorial of the EO library
# Unlike other Makefiles in EO, it is not using the automake/autoconf
# Unlike other Makefiles in EO, it is not using the automake/autoconf
# so that it stays easy to understant (you are in the tutorial, remember!)
# MS, Oct. 2002
@ -10,11 +10,11 @@ DIR_EO = ../../src
.SUFFIXES: .cpp
# Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++
# However, if you are using this Makefile within xemacs,
# However, if you are using this Makefile within xemacs,
# and have problems with the interpretation of the output (and its colors)
# then you should use c++ instead (make CXX=c++ will do)
.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
.cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c $*.cpp
@ -22,12 +22,12 @@ ALL = BitEA RealEA ESEA
all : $(ALL)
BitEA : BitEA.o ;
$(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/ga/libga.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
BitEA : BitEA.o ;
$(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/ga/libga.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
RealEA : RealEA.o ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/es/libes.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
ESEA : ESEA.o ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/es/libes.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
clean :
clean :
@/bin/rm $(ALL) *.o *.sav *.xg *.status *~

View file

@ -20,9 +20,9 @@ int main(int argc, char* argv[])
///// FIRST, problem or representation dependent stuff
//////////////////////////////////////////////////////
// The evaluation fn - encapsulated into an eval counter for output
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
mainEval( real_value );
// The evaluation fn - encapsulated into an eval counter for output
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
mainEval( real_value );
eoEvalFuncCounter<EOT> eval(mainEval);
// the genotype - through a genotype initializer

View file

@ -1,4 +1,3 @@
###### General ######
# --help=0 # -h : Prints this message
# --stopOnUnknownParam=1 # Stop if unkown param entered
@ -12,7 +11,7 @@
--weakElitism=0 # -w : Old best parent replaces new worst offspring *if necessary*
###### Genotype Initialization ######
# --vecSize=10 # -n : The number of variables
# --vecSize=10 # -n : The number of variables
# --initBounds=10[-1,1] # -B : Bounds for initialization (MUST be bounded)
--sigmaInit=0.3% # -s : Initial value for Sigmas (with a '%' -> scaled by the range of each variable)

View file

@ -4,7 +4,7 @@
/** Just a simple function that takes binary value of a chromosome and sets
the fitnes.
@param _chrom A binary chromosome
@param _chrom A binary chromosome
*/
template <class Chrom> double binary_value(const Chrom& _chrom)

View file

@ -2,8 +2,8 @@
//-----------------------------------------------------------------------------
/** Just a simple function that takes an eoEsBase<double> and sets the fitnes
to sphere
/** Just a simple function that takes an eoEsBase<double> and sets the fitnes
to sphere
@param _ind vector<double>
*/
@ -14,6 +14,3 @@ double real_value(const std::vector<double>& _ind)
sum += _ind[i] * _ind[i];
return sqrt(sum);
}