Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit d196f211 authored by frey_m's avatar frey_m
Browse files

Sampler: JSON structure update #259

parent c8ac40e2
No related branches found
No related tags found
No related merge requests found
......@@ -167,9 +167,8 @@ void Sampler::createNewIndividual_m() {
void Sampler::dumpIndividualsToJSON_m() {
boost::property_tree::ptree tree;
tree.put("name", "sampler");
tree_m.put("name", "sampler");
tree_m.put("version", "1.1");
std::stringstream bounds;
DVarContainer_t::iterator itr = dvars_m.begin();
......@@ -178,30 +177,26 @@ void Sampler::dumpIndividualsToJSON_m() {
{
std::string dvar = boost::get<VAR_NAME>(itr->second);
bounds << "[ " << it->first << ", " << it->second << " ]";
tree.put("dvar-bounds." + dvar, bounds.str());
tree_m.put("dvar-bounds." + dvar, bounds.str());
bounds.str("");
}
tree.add_child("samples", samples_m);
std::ostringstream filename;
filename << resultDir_m << "/" << resultFile_m
<< "_samples.json";
boost::property_tree::write_json(filename.str(), tree);
boost::property_tree::write_json(filename.str(), tree_m);
}
void Sampler::addIndividualToJSON_m(const boost::shared_ptr<Individual_t>& ind) {
boost::property_tree::ptree sample;
sample.put("ID", ind->id);
std::string id = std::to_string(ind->id);
DVarContainer_t::iterator itr;
for(itr = dvars_m.begin(); itr != dvars_m.end(); itr++) {
std::string name = boost::get<VAR_NAME>(itr->second);
int i = ind->getIndex(name);
sample.put("dvar." + name, ind->genes[i]);
tree_m.put("samples." + id + ".dvar." + name, ind->genes[i]);
}
Expressions::Named_t::iterator expr_it;
......@@ -209,10 +204,8 @@ void Sampler::addIndividualToJSON_m(const boost::shared_ptr<Individual_t>& ind)
for(size_t i=0; i < ind->objectives.size(); i++, expr_it++) {
std::string name = expr_it->first;
sample.put("obj." + name, ind->objectives[i]);
tree_m.put("samples." + id + ".obj." + name, ind->objectives[i]);
}
samples_m.push_back(std::make_pair("", sample));
}
......
......@@ -146,7 +146,7 @@ private:
std::string resultFile_m;
std::string resultDir_m;
boost::property_tree::ptree samples_m;
boost::property_tree::ptree tree_m;
void dumpIndividualsToJSON_m();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment