void GeneticConfig::init(ParseBlock& block) { Checker *check = getChecker(); init(); try { block.checkUsing(check); resolution::CostConfig::init(block); if (block.hasProperty("initializer_type")) { initializer_type = block("initializer_type").value; } if (block.hasProperty("crossover_type")) { crossover_type = block("crossover_type").as<string>(); } if (block.hasProperty("custom_evolution")) { custom_evolution = block("custom_evolution").as<bool>(); } if (block.hasProperty("mutator_type")) { mutator_type = block("mutator_type").as<string>(); } if (block.hasProperty("search_ratio")) { search_ratio = block("search_ratio").as<double>(); } if (block.hasProperty("max_checks")) { max_checks = block("max_checks").as<int>(); } if (block.hasProperty("mutation_probability")) { pMutation = block("mutation_probability").as<double>(); } if (block.hasProperty("mutation_deviation")) { mutation_dev = block("mutation_deviation").as<double>(); } if (block.hasProperty("crossover_probability")) { pCrossover = block("crossover_probability").as<double>(); } } catch (std::exception &e) { std::cerr << "GeneticConfig::init() --> error while loading data from block\n"; throw(e); } delete check; }
TemporalConstrain::TemporalConstrain(ParseBlock& data) { Checker *check = TemporalConstrain::getChecker(); try { data.checkUsing(check); max_time = data("max_time").as<double>(); min_time = data("min_time").as<double>(); updraft_id = data("updraft_id").as<int>(); uav_id = data("uav_id").as<int>(); } catch (std::exception &e) { std::cerr << "AlgorithmConfig (initializer) --> failed to get the data from block. Content: "; std::cerr << e.what() << "\n"; } delete check; }
void ThermalModelSimple::init(ParseBlock &b) { Checker *check = getChecker(); try { b.checkUsing(check); // Get updraft info ParseBlock::Blocks *updrafts = b.getBlocks("updraft"); updraft_vector.clear(); ParseBlock::Blocks::iterator it = updrafts->begin(); for ( ; it != updrafts->end(); it++) { Updraft aux(**it); updraft_vector.push_back(aux); } } catch (exception &e) { cerr << "ThermalModelSimple::ThermalModelSimple --> Error: could not load the data.\n"; throw(e); } delete check; }