GPLIB++
GAConf.cpp
Go to the documentation of this file.
1 //============================================================================
2 // Name : GAConf.cpp
3 // Author : Apr 7, 2010
4 // Version :
5 // Copyright : 2010, mmoorkamp
6 //============================================================================
7 
8 
9 #include "GAConf.h"
10 #include <fstream>
11 #include <iostream>
12 #include <FatalException.h>
13 #include <boost/program_options.hpp>
14 
15 namespace gplib
16  {
17  using namespace std;
18  namespace po = boost::program_options;
19 
21  {
22  }
23 
25  {
26  }
27 
28  void GAConf::GetData(std::ifstream &instream)
29  {
30  po::options_description desc("");
31  desc.add_options()("popsize", po::value<int>(&popsize),
32  "The size of the GA population")("inittemp", po::value<double>(
33  &inittemp), "The initial temperature for an annealing type GA")(
34  "coolingratio",
35  po::value<double>(&coolingratio)->default_value(1.0),
36  "The ratio for the decrease in temperature in the annealing schedule")(
37  "annealinggeneration", po::value<int>(&annealinggeneration),
38  "The generation number when to apply the cooling")("generations",
39  po::value<int>(&generations),
40  "The total number of generations for the GA to run")(
41  "mutationprob", po::value<double>(&mutationprob),
42  "The probability for mutation for the whole genetic string")(
43  "crossoverprob", po::value<double>(&crossoverprob),
44  "The crossover probability")("gatype", po::value<std::string>(
45  &gatype)->default_value("anneal"),
46  "The type of genetic algorithm can be anneal or pareto")("elitist",
47  po::value<bool>(&elitist)->default_value("true"),
48  "Do we always preserve the best model from generation to generation");
49 
50  po::variables_map vm;
51  po::store(po::parse_config_file(instream, desc, true), vm);
52  po::notify(vm);
53 
54  }
55  }
void GetData(std::ifstream &instream)
Definition: GAConf.cpp:28
virtual ~GAConf()
Definition: GAConf.cpp:24