Beispiel #1
0
double F7::compute(vector<double> x){
  int    m = nonSeparableGroupSize;
  int    i;
  double result;

  if(Ovector == NULL) {
	  Ovector = createShiftVector(dimension,minX,maxX);
		Pvector   = createPermVector(dimension);
  }

  for(i = 0; i < dimension; i++) {
    anotherz[i] = x[i] - Ovector[i];
  }

  for(i = 0; i < m; i++) {
    anotherz1[i] = anotherz[Pvector[i]];
  }

  for(i = m; i < dimension; i++) {
    anotherz2[i - m] = anotherz[Pvector[i]];
  }

  result = schwefel(anotherz1,m) * 1e6 + sphere(anotherz2,dimension - m);
  return(result);
}
double F17::compute(vector<double> x){
  int i,k;
  double result=0.0;

  for(i=0;i<dimension;i++){
    anotherz[i]=x[i]-Ovector[i];
  }

  for(k=1;k<=dimension/(nonSeparableGroupSize);k++){
    result+=schwefel(anotherz,nonSeparableGroupSize,k);
  }
  return(result);
}
double F19::compute(vector<double> x){
	int i;
	double result;

	if(Ovector==NULL)
	{
		Ovector=createShiftVector(dimension,minX,maxX);
	}

	for(i=0;i<dimension;i++)
	{
		anotherz[i]=x[i]-Ovector[i];
	}

	result=schwefel(anotherz, dimension);

	return(result);
}
Beispiel #4
0
double F7::compute(double*x){
  int    i;
  double result = 0.0;

  if(Ovector == NULL) {
    Ovector = readOvector();
    Pvector = readPermVector();
    r25 = readR(25);
    r50 = readR(50);
    r100 = readR(100);
    s = readS(s_size);
    w = readW(s_size);
  }

  for(i = 0; i < dimension; i++) {
    anotherz[i] = x[i] - Ovector[i];
  }

  // s_size non-separable part with rotation
  int c = 0;
  for (i = 0; i < s_size; i++)
    {
      // cout<<"c="<<c<<", i="<<i<<endl;
      anotherz1 = rotateVector(i, c);
      // cout<<"done rot"<<endl;
      result += w[i] * schwefel(anotherz1, s[i]);
      delete []anotherz1;
      // cout<<result<<endl;
    }
  
  // one separable part without rotation
  double* z = new double[dimension-c];
  for (i = c; i < dimension; i++)
    {
      // cout<<i-c<<" "<<Pvector[i]<<" "<<anotherz[Pvector[i]]<<endl;
      z[i-c] = anotherz[Pvector[i]];
    }
  
  result += sphere(z, dimension-c);
  delete []z;

  return(result);
}
double F12::compute(vector<double> x){
	int i,k;
	double result=0.0;
	if(Ovector==NULL)
	{
		Ovector=createShiftVector(dimension,minX,maxX);
		Pvector=createPermVector(dimension);
	}
	for(i=0;i<dimension;i++)
	{
		anotherz[i]=x[i]-Ovector[i];
	}
	for(k=1;k<=dimension/(2*nonSeparableGroupSize);k++)
	{
		result+=schwefel(anotherz,nonSeparableGroupSize,k);

	}
	result+=sphere(anotherz,dimension, 2);
	return(result);
}
Beispiel #6
0
double F14::compute(double*x){
  int i;
  double result=0.0;
  
  if(OvectorVec == NULL)
    {
      s = readS(s_size);
      OvectorVec = readOvectorVec();
      // // inspect OvectorVec
      // for (int i = 0; i < s_size; ++i)
      //   {
      //     for (int j=0; j< s[i]; j++)
      //       {
      //         printf("%.1f\t",OvectorVec[i][j]);
      //       }
      //     printf("\n");
      //   }
      Pvector = readPermVector();
      r25 = readR(25);
      r50 = readR(50);
      r100 = readR(100);
      w = readW(s_size);
    }

  // s_size non-separable part with rotation
  int c = 0;
  for (i = 0; i < s_size; i++)
    {
      // cout<<"c="<<c<<", i="<<i<<endl;
      anotherz1 = rotateVectorConflict(i, c, x);
      // cout<<"done rot"<<endl;
      result += w[i] * schwefel(anotherz1, s[i]);
      delete []anotherz1;
      // cout<<result<<endl;
    }

  update(result);
  return(result);
}