This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/eo/tutorial/ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp
kuepper 3cb80bc73b update build process to include paradiseo tutorial,
fix paradiseo headers for sstream
2004-09-22 12:38:28 +00:00

51 lines
841 B
C++

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <stdexcept> // runtime_error
#ifdef HAVE_SSTREAM
#include <sstream>
#else
#include <strstream>
#endif
#include <paradiseo.h>
#include <ga.h>
typedef eoBit<double> Indi; // A bitstring with fitness double
#include "binary_value.h"
using namespace std;
void main_function(int argc, char **argv) {
eoEvalFuncPtr <Indi, double, const vector <bool> & > eval (binary_value) ;
eoListener <Indi> listen (argc, argv) ;
eoEvaluator <Indi> evaluator ("Mars",
listen,
eval) ;
// Runs
evaluator () ;
}
// A main that catches the exceptions
int main(int argc, char **argv)
{
try
{
main_function(argc, argv);
}
catch(exception& e)
{
cout << "Exception: " << e.what() << '\n';
}
return 1;
}