13 #include <boost/program_options.hpp>
18 namespace po = boost::program_options;
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")(
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");
51 po::store(po::parse_config_file(instream, desc,
true), vm);
void GetData(std::ifstream &instream)