00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _make_PBILupdate_h
00027 #define _make_PBILupdate_h
00028
00029 #include <ga/eoPBILOrg.h>
00030 #include <utils/eoRNG.h>
00031 #include <utils/eoParser.h>
00032 #include <utils/eoState.h>
00033
00034
00036
00047 template <class EOT>
00048 eoDistribUpdater<EOT> & do_make_PBILupdate(eoParser & _parser, eoState& _state, EOT)
00049 {
00050
00051
00052
00053 std::string UType = _parser.createParam(std::string("PBIL"), "updateRule", "Type of update rule (only PBIL additive at the moment)", 'U', "Algorithm").value();
00054
00055 unsigned nbBest = _parser.createParam(unsigned(1), "nbBest", "Number of good guys to update from", 'B', "Algorithm").value();
00056 double LRBest = _parser.createParam(0.1, "LRBest", "Learning Rate (from best guys)", 'L', "Algorithm").value();
00057 unsigned nbWorst = _parser.createParam(unsigned(0), "nbWorst", "Number of bad guys to update from", 'W', "Algorithm").value();
00058 double LRWorst = _parser.createParam(0.01, "LRWorst", "Learning Rate (from best guys)", 'L', "Algorithm").value();
00059 double tolerance = _parser.createParam(0.0, "tolerance", "Keeping away from 0 and 1", 't', "Algorithm").value();
00060
00061
00062 eoDistribUpdater<EOT> * ptUpdate;
00063
00064 if (UType == std::string("PBIL"))
00065 {
00066 if ( (nbWorst == 0) && (nbBest == 1) )
00067 ptUpdate = new eoPBILOrg<EOT>(LRBest, tolerance);
00068 else
00069 ptUpdate = new eoPBILAdditive<EOT>(LRBest, nbBest, tolerance, LRWorst, nbWorst);
00070 }
00071 else
00072 throw std::runtime_error("Only PBIL additive update rule available at the moment");
00073
00074
00075 _state.storeFunctor(ptUpdate);
00076 return *ptUpdate;
00077 }
00078
00079 #endif