* whitespace cleanup

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

View file

@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils)
### 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(FirstBitGA FirstBitGA.cpp)
ADD_EXECUTABLE(FirstRealGA FirstRealGA.cpp)
ADD_EXECUTABLE(exercise1.3 exercise1.3.cpp)
ADD_EXECUTABLE(FirstBitGA FirstBitGA.cpp)
ADD_EXECUTABLE(FirstRealGA FirstRealGA.cpp)
ADD_EXECUTABLE(exercise1.3 exercise1.3.cpp)
ADD_DEPENDENCIES(FirstBitGA ga eo eoutils)
ADD_DEPENDENCIES(FirstRealGA ga eo eoutils)

View file

@ -78,10 +78,10 @@ void main_function(int argc, char **argv)
{
Indi v; // void individual, to be filled
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
{
bool r = rng.flip(); // new value, random in {0,1}
v.push_back(r); // append that random value to v
}
{
bool r = rng.flip(); // new value, random in {0,1}
v.push_back(r); // append that random value to v
}
eval(v); // evaluate it
pop.push_back(v); // and put it in the population
}
@ -138,7 +138,7 @@ void main_function(int argc, char **argv)
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
eval, continuator);
eval, continuator);
// Apply algo to pop - that's it!
gga(pop);
@ -156,11 +156,11 @@ 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;

View file

@ -78,10 +78,10 @@ void main_function(int argc, char **argv)
{
Indi v; // void individual, to be filled
for (unsigned ivar=0; ivar<VEC_SIZE; ivar++)
{
double r = 2*rng.uniform() - 1; // new value, random in [-1,1)
v.push_back(r); // append that random value to v
}
{
double r = 2*rng.uniform() - 1; // new value, random in [-1,1)
v.push_back(r); // append that random value to v
}
eval(v); // evaluate it
pop.push_back(v); // and put it in the population
}
@ -133,7 +133,7 @@ void main_function(int argc, char **argv)
eoSGA<Indi> gga(select, xover, CROSS_RATE, mutation, MUT_RATE,
eval, continuator);
eval, continuator);
// Apply algo to pop - that's it!
gga(pop);
@ -151,11 +151,11 @@ 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;

View file

@ -5,11 +5,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 -pg -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 -pg -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 -pg $*.cpp
@ -21,5 +21,5 @@ lesson1 : $(firstGA)
all : $(ALL)
clean :
clean :
@/bin/rm $(ALL) *.o *~

View file

@ -18,7 +18,7 @@
//-----------------------------------------------------------------------------
// Include the corresponding file
#include <ga.h> // bitstring representation & operators
#include <ga.h> // bitstring representation & operators
// define your individuals
typedef eoBit<double> Indi; // A bitstring with fitness double
@ -151,11 +151,11 @@ 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;

View file

@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils)
### 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(FirstBitEA FirstBitEA.cpp)
ADD_EXECUTABLE(FirstRealEA FirstRealEA.cpp)
ADD_EXECUTABLE(exercise2.3 exercise2.3.cpp)
ADD_EXECUTABLE(FirstBitEA FirstBitEA.cpp)
ADD_EXECUTABLE(FirstRealEA FirstRealEA.cpp)
ADD_EXECUTABLE(exercise2.3 exercise2.3.cpp)
######################################################################################
### 4) Optionnal

View file

@ -182,11 +182,11 @@ 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;

View file

@ -52,7 +52,7 @@ void main_function(int argc, char **argv)
const float P_MUT = 0.5; // mutation probability
const double EPSILON = 0.01; // range for real uniform mutation
double SIGMA = 0.3; // std dev. for normal mutation
double SIGMA = 0.3; // std dev. for normal mutation
// some parameters for chosing among different operators
const double hypercubeRate = 0.5; // relative weight for hypercube Xover
const double segmentRate = 0.5; // relative weight for segment Xover
@ -181,11 +181,11 @@ 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;

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 -pg -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 -pg -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 -pg $*.cpp
@ -26,7 +26,7 @@ lesson2 : $(firstEA)
all : $(ALL)
clean :
clean :
@/bin/rm $(ALL) *.o *~
FirstRealEA : real_value.h

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
*/
// INIT
double binary_value(const std::vector<bool>& _chrom)
@ -14,4 +14,3 @@ double binary_value(const std::vector<bool>& _chrom)
sum += _chrom[i];
return sum;
}

View file

@ -20,7 +20,7 @@
// REPRESENTATION
//-----------------------------------------------------------------------------
// Include the corresponding file
#include <ga.h> // bitstring representation & operators
#include <ga.h> // bitstring representation & operators
// define your individuals
typedef eoBit<double> Indi; // A bitstring with fitness double
@ -186,11 +186,11 @@ 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;

View file

@ -1,8 +1,8 @@
#include <vector>
//-----------------------------------------------------------------------------
/** Just a simple function that takes an vector<double> and sets the fitnes
/** Just a simple function that takes an vector<double> and sets the fitnes
to the sphere function. Please use doubles not float!!!
@param _ind A floatingpoint vector
@param _ind A floatingpoint vector
*/
// INIT
@ -15,6 +15,3 @@ double real_value(const std::vector<double>& _ind)
}
return -sum;
}

View file

@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils)
### 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(SecondBitEA SecondBitEA.cpp)
ADD_EXECUTABLE(SecondRealEA SecondRealEA.cpp)
ADD_EXECUTABLE(exercise3.1 exercise3.1.cpp)
ADD_EXECUTABLE(SecondBitEA SecondBitEA.cpp)
ADD_EXECUTABLE(SecondRealEA SecondRealEA.cpp)
ADD_EXECUTABLE(exercise3.1 exercise3.1.cpp)
ADD_DEPENDENCIES(SecondBitEA ga eoutils eo)
ADD_DEPENDENCIES(SecondRealEA ga eoutils eo)
@ -62,4 +62,3 @@ INSTALL(TARGETS SecondRealEA RUNTIME DESTINATION share/eo/examples/Lesson3 COMPO
INSTALL(TARGETS exercise3.1 RUNTIME DESTINATION share/eo/examples/Lesson3 COMPONENT examples)
######################################################################################

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 -pg -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 -pg -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 -pg $*.cpp
@ -29,5 +29,5 @@ all : $(ALL)
SecondBitEA : binary_value.h
SecondRealEA : real_value.h
clean :
clean :
@/bin/rm $(ALL) *.o *.sav *.xg *.status *~

View file

@ -126,8 +126,8 @@ void main_function(int argc, char **argv)
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
exit(1);
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != "")
{
@ -337,11 +337,11 @@ 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;

View file

@ -104,8 +104,8 @@ void main_function(int argc, char **argv)
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
exit(1);
parser.printHelp(cout);
exit(1);
}
if (statusName != "")
{
@ -318,11 +318,11 @@ 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;

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
*/
// INIT
double binary_value(const std::vector<bool>& _chrom)
@ -14,4 +14,3 @@ double binary_value(const std::vector<bool>& _chrom)
sum += _chrom[i];
return sum;
}

View file

@ -24,7 +24,7 @@
// REPRESENTATION
//-----------------------------------------------------------------------------
// Include the corresponding file
#include <ga.h> // bitstring representation & operators
#include <ga.h> // bitstring representation & operators
// define your genotype and fitness types
typedef eoBit<eoMinimizingFitness> Indi;
@ -126,8 +126,8 @@ void main_function(int argc, char **argv)
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
exit(1);
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != "")
{
@ -393,11 +393,11 @@ 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;

View file

@ -1,8 +1,8 @@
#include <vector>
//-----------------------------------------------------------------------------
/** Just a simple function that takes an vector<double> and sets the fitnes
/** Just a simple function that takes an vector<double> and sets the fitnes
to the sphere function. Please use doubles not float!!!
@param _ind A floatingpoint vector
@param _ind A floatingpoint vector
*/
// INIT
@ -15,6 +15,3 @@ double real_value(const std::vector<double>& _ind)
}
return sum;
}

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;

Some files were not shown because too many files have changed in this diff Show more