Commit 63f27815 authored by Jean-Baptiste Mouret's avatar Jean-Baptiste Mouret
Browse files

misc

parent 56ad2a3c
......@@ -28,6 +28,8 @@ struct Params {
#ifdef DIM6
#define ZDT_DIM 6
#elif defined (DIM2)
#define ZDT_DIM 2
#else
#define ZDT_DIM 30
#endif
......@@ -132,8 +134,24 @@ namespace limbo {
<< std::endl;
for (auto x : p_data)
pareto_data << std::get<1>(x).transpose() << std::endl;
for (auto x : opt.observations())
obs << x.transpose() << std::endl;
for (int i = 0; i < opt.observations().size(); ++i)
obs << opt.observations()[i].transpose() << " "
<< opt.samples()[i].transpose()
<< std::endl;
std::string m1 = "model_" + it + ".dat";
std::ofstream m1f(m1.c_str());
for (float x = 0; x < 1; x += 0.01)
for (float y = 0; y < 1; y += 0.01) {
Eigen::VectorXd v(2);
v << x, y;
m1f << x << " " << y << " "
<< opt.models()[0].mu(v) << " "
<< opt.models()[0].sigma(v) << " "
<< opt.models()[1].mu(v) << " "
<< opt.models()[1].sigma(v) << std::endl;
}
}
};
}
......
......@@ -14,6 +14,7 @@ def build(bld):
'PAREGO ZDT3 DIM6',
'NS_EGO ZDT1 DIM30',
'NS_EGO ZDT2 DIM30',
'NS_EGO ZDT2 DIM2',
'NS_EGO ZDT3 DIM30',
'NS_EGO ZDT1 DIM6',
'NS_EGO ZDT2 DIM6',
......
......@@ -57,8 +57,8 @@ namespace limbo {
v[j] = indiv.data(j);
// we protect against overestimation because this has some spurious effect
for (size_t i = 0; i < _models.size(); ++i)
this->_objs[i] = _models[i].mu(v);//std::min(_models[i].mu(v), _models[i].max_observation());
}
this->_objs[i] = _models[i].mu(v);//std::min(_models[i].mu(v), _models[i].max_observation());
}
protected:
std::vector<M> _models;
std::vector<float> _objs;
......@@ -97,8 +97,10 @@ namespace limbo {
const pareto_t& pareto_data() const {
return _pareto_data;
}
const std::vector<model_t>& models() const { return _models; }
const std::vector<model_t>& models() const {
return _models;
}
// will be called at the end of the algo
void update_pareto_data() {
......
......@@ -72,7 +72,9 @@ namespace limbo {
const MeanFunction& mean_function() const {
return _mean_function;
}
double max_observation() const { return _observations.maxCoeff(); }
double max_observation() const {
return _observations.maxCoeff();
}
protected:
int _dim;
KernelFunction _kernel_function;
......
......@@ -33,7 +33,7 @@ namespace limbo {
auto p_variance = pareto::pareto_set<2>(pareto);
auto best = p_variance[rand() % p_variance.size()];
Eigen::VectorXd best_v = std::get<0>(best);
this->add_new_sample(best_v, feval(best_v));
this->_iteration++;
std::cout << this->_iteration << " | " << best_v.transpose()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment