00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <iostream>
00022 using namespace std;
00023
00024
00025 #include "eo"
00026
00027 #include "utils/eoRealVectorBounds.h"
00028
00029
00030
00031
00035 #include "eoMyStruct.h"
00036
00040 #include "eoMyStructInit.h"
00041
00047 #include "eoMyStructEvalFunc.h"
00048
00049
00050
00051
00052
00053
00054 typedef eoMinimizingFitness MyFitT ;
00055
00056
00057
00058
00059 typedef eoMyStruct<MyFitT> Indi;
00060
00061
00062 #include "make_genotype_MyStruct.h"
00063 eoInit<Indi> & make_genotype(eoParser& _parser, eoState&_state, Indi _eo)
00064 {
00065 return do_make_genotype(_parser, _state, _eo);
00066 }
00067
00068
00069 #include "make_op_MyStruct.h"
00070 eoGenOp<Indi>& make_op(eoParser& _parser, eoState& _state, eoInit<Indi>& _init)
00071 {
00072 return do_make_op(_parser, _state, _init);
00073 }
00074
00075
00076
00077
00078
00079
00080 #include <make_pop.h>
00081 eoPop<Indi >& make_pop(eoParser& _parser, eoState& _state, eoInit<Indi> & _init)
00082 {
00083 return do_make_pop(_parser, _state, _init);
00084 }
00085
00086
00087 #include <make_continue.h>
00088 eoContinue<Indi>& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi> & _eval)
00089 {
00090 return do_make_continue(_parser, _state, _eval);
00091 }
00092
00093
00094 #include <make_checkpoint.h>
00095 eoCheckPoint<Indi>& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi>& _eval, eoContinue<Indi>& _continue)
00096 {
00097 return do_make_checkpoint(_parser, _state, _eval, _continue);
00098 }
00099
00100
00101 #include <make_algo_scalar.h>
00102 eoAlgo<Indi>& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<Indi>& _eval, eoContinue<Indi>& _continue, eoGenOp<Indi>& _op)
00103 {
00104 return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
00105 }
00106
00107
00108
00109 #include <make_run.h>
00110
00111 #include <eoScalarFitness.h>
00112 void run_ea(eoAlgo<Indi>& _ga, eoPop<Indi>& _pop)
00113 {
00114 do_run(_ga, _pop);
00115 }
00116
00117
00118
00119 void make_help(eoParser & _parser);
00120
00121
00122 int main(int argc, char* argv[])
00123 {
00124
00125 try
00126 {
00127 eoParser parser(argc, argv);
00128
00129 eoState state;
00130
00131
00133 eoMyStructEvalFunc<Indi> plainEval;
00134
00135 eoEvalFuncCounter<Indi> eval(plainEval);
00136
00137
00138 eoInit<Indi>& init = make_genotype(parser, state, Indi());
00139
00140
00141 eoGenOp<Indi>& op = make_op(parser, state, init);
00142
00143
00145
00146
00147
00149
00150
00151
00152 eoPop<Indi>& pop = make_pop(parser, state, init);
00153
00154
00155 eoContinue<Indi> & term = make_continue(parser, state, eval);
00156
00157 eoCheckPoint<Indi> & checkpoint = make_checkpoint(parser, state, eval, term);
00158
00159 eoAlgo<Indi>& ga = make_algo_scalar(parser, state, eval, checkpoint, op);
00160
00162
00164
00165 make_help(parser);
00166
00169
00170 apply<Indi>(eval, pop);
00171
00172
00173
00174
00175
00176 run_ea(ga, pop);
00177
00178 cout << "Final Population\n";
00179 pop.sortedPrintOn(cout);
00180 cout << endl;
00181
00182 }
00183 catch(exception& e)
00184 {
00185 cout << e.what() << endl;
00186 }
00187 return 0;
00188 }