예제 #1
0
  void eval(Indiv& ind) {
    this->_objs.resize(3);// resize for div
    float f1 = ind.data(0);
    float g = _g(ind);
    float h = 1.0f - pow((f1 / g), 2.0);
    float f2 = g * h;

    this->_objs[0] = -f1;
    this->_objs[1] = -f2;
    this->_v = Eigen::VectorXf(ind.data().size());
    for (size_t i = 0; i < this->_v.size(); ++i)
      this->_v(i) = ind.data()[i];
  }
예제 #2
0
float _g(const Indiv &ind) {
  float g = 0.0f;
  assert(ind.size() == 30);
  for (size_t i = 1; i < 30; ++i)
    g += ind.data(i);
  g = 9.0f * g / 29.0f;
  g += 1.0f;
  return g;
}
예제 #3
0
 void eval(Indiv& ind) {
   this->_objs.resize(2);
   float f1 = ind.data(0);
   float g = _g(ind);
   float h = 1.0f - pow((f1 / g), 2.0);
   float f2 = g * h;
   this->_objs[0] = -f1;
   this->_objs[1] = -f2;
 }
예제 #4
0
static void filter_indiv(statinfos_map &filter, Indiv &oInd,
		TransformationType fTransf) {
	DbValueMap oRes;
	DbValueMap &src = const_cast<DbValueMap &>(oInd.data());
	typedef std::pair<IntType, StatInfo> MyPair;
	std::for_each(filter.begin(), filter.end(), [&](const MyPair &oPair) {
		DbValue v;
		IntType key = oPair.first;
		auto it = src.find(key);
		if (it != src.end()) {
			DbValue vx = (*it).second;
			if (vx.empty()) {
				const StatInfo &info = oPair.second;
				double vm, vv, vs;
				info.get_mean_var_std(vm, vv, vs);
				v = DbValue(vm);
			}
			else {
				v = DbValue(vx.double_value());
			}
		}
		else {
			const StatInfo &info = oPair.second;
			double vm, vv, vs;
			info.get_mean_var_std(vm, vv, vs);
			v = DbValue(vm);
		}
		switch (fTransf) {
			case TransformationType::normalized:
			{
				const StatInfo &info = oPair.second;
				double vm, vv, vs = 0;
				info.get_mean_var_std(vm, vv, vs);
				if (vs != 0) {
					v = DbValue((v.double_value() - vm) / vs);
				}
			}
			break;
			case TransformationType::recoded:
			{
				const StatInfo &info = oPair.second;
				double vmin, vmax;
				info.get_min_max(vmin, vmax);
				v = DbValue((v.double_value() - vmin) / (vmax - vmin));
			}
			break;
			default:
			break;
		} // fTransf
			oRes[key] = v;
		});
	oInd.set_data(oRes);
} //filter_indiv
예제 #5
0
   void eval(Indiv& ind) 
 {
   assert(this == _this);
   this->_objs.resize(2);
   float f1 = ind.data(0);
   float g = _g(ind);
   float h = 1.0f - pow((f1 / g), 2.0);
   float f2 = g * h;
   this->_objs[0] = -f1;
   this->_objs[1] = -f2;
   this->_value = -f1 -f2;
 }
예제 #6
0
bool NumericIndivProvider::find_indiv(const IntType aIndex,
		doubles_vector &data) {
	assert(this->is_valid());
	data.clear();
	Indiv oInd;
	VariableMode mode = VariableMode::modeNumeric;
	if (!this->find_indiv(aIndex, oInd, mode)) {
		return (false);
	}
	const DbValueMap &oMap = oInd.data();
	const ints_vector &vv = this->m_ids;
	const size_t n = vv.size();
	data.resize(n);
	for (size_t i = 0; i < n; ++i) {
		const IntType key = vv[i];
		auto it = oMap.find(key);
		assert(it != oMap.end());
		DbValue v = (*it).second;
		data[i] = v.double_value();
	} // i
	return (true);
} //find_indiv
예제 #7
0
 void eval(Indiv& ind) {
   this->_value = -felli(ind.data());
 }