import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import javax.swing.*;

class fa extends f_xj//Rosenbrock function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff;
ff=(1.0-x[0])*(1.0-x[0])+100*(x[1]-x[0]*x[0])*(x[1]-x[0]*x[0]);
return ff; 
}
} 

class fb extends f_xj // De Jongs first function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;

for(int i=0;i<n;i++)
{ff+=x[i]*x[i];}
return ff;

 
}
} 

class fc extends f_xj //Axis parallel hyper-ellipsoid
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;

for(int i=0;i<n;i++)
{ff+=i*x[i]*x[i];}
return ff;

}
} 

class fd extends f_xj //Rotated hyper-ellipsoid function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;

for(int i=0;i<n;i++)
{
  for(int j=0;j<i;j++)
  {ff+=x[j]*x[j];}	
	
}
return ff;
}
} 

class fe extends f_xj //Rastrigins function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;
double nn=10.0;
double r=Math.PI/180;

for(int i=0;i<n;i++)
{
  ff+=x[i]*x[i]-10*Math.cos(r*2.0*Math.PI*x[i]);
}
return ff+10*n;

 
}
} 

class fg extends f_xj //Griewangks function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;
double nn=10.0;
double r=Math.PI/180;

double itop=1;
double dtop=0;
for(int i=0;i<n;i++)
{
	for(int k=0;k<n;k++)
	{
	itop*=Math.cos(r*x[k]/Math.sqrt(k+1))+1;	
    }
	dtop+=x[i]*x[i]-itop;
	
}

return dtop/4000;


}
} 


class fj extends f_xj //sum of a different function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff=0;
int n=x.length;

double r=Math.PI/180;
double top=0;
for(int i=0;i<n;i++)
{top+=Math.pow(Math.abs(x[i]),(i+2));}
return top;
}
} 

class fk extends f_xj //Ackleys function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double a=20.0;
double b=0.2;
double c=2.*Math.PI;

int n=x.length;

double r=Math.PI/180;
double top1=0.0;
for(int i=0;i<n;i++)
{top1+=x[i]*x[i];}
top1=Math.sqrt(top1/n);

double top2=0.0;

for(int i=0;i<n;i++)
{top2+=Math.cos(r*c*x[i]);}
top2=top2/n;
double top=-a*Math.exp(-b*top1)-Math.exp(top2)+a+Math.exp(1);
return top;
}
} 

class fl extends f_xj //Michalewiczs function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
int n=x.length;
double r=Math.PI/180;
double top1=0.0;
for(int i=0;i<n;i++)
{top1+=Math.sin(r*x[i])*Math.pow(Math.sin(r*((i+1)*x[i]*x[i]/Math.PI)),20);   }
return -top1;
}
} 

class fm extends f_xj //Braninss function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double a=1.0;
double b=5.1/(4.0*Math.PI*Math.PI);
double c=5.0/Math.PI;
double d=6.0;
double e=10.0;
double f=1/(8*Math.PI);
double r=Math.PI/180;

double top1=(a*(x[1]-b*x[0]*x[0]+c*x[0]-d)*(x[1]-b*x[0]*x[0]+c*x[0]-d))+e*(1-f)*Math.cos(r*x[0])+e;



return top1;

 
}
} 

class fn extends f_xj //Easoms function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;

double top1=-Math.cos(r*x[0])*Math.cos(r*x[1])*Math.exp(-(x[0]-3.1415)*(x[0]-3.1415)-(x[1]-3.1415)*(x[1]-3.1415));
 

return top1;

 
}
} 

class fo extends f_xj //Goldstein-Prices function
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;

double top1=(1+(x[0]+x[1]+1)*(x[0]+x[1]+1)*(19-14*x[0]+3*x[0]*x[0]-14*x[1]+6*x[0]*x[1]+3*x[1]*x[1]))*(30+(2*x[0]-3*x[1])*(2*x[0]-3*x[1])*(18-32*x[0]+12*x[0]*x[0]+48*x[1]-36*x[0]*x[1]+27*x[1]*x[1]));
  

return top1;

}
} 

class fp extends f_xj //Fifth function of De Jong
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;

double top1=0.0;

for(int i=-2;i<=2;i++)
{
    for(int j=-2;j<=2;j++)
    {
	top1+=1/(5*(i+2)+j+3+Math.pow((x[0]-16*j),6)+Math.pow((x[1]-16*i),6));    
	}	
}
top1=1.0/(0.002+top1);  

return top1;

 
}
} 

class fr extends f_xj //Drop wave function ++
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;

double top1=-(1+Math.cos(r*(12*Math.sqrt(x[0]*x[0]+x[1]*x[1]))))/(0.5*(x[0]*x[0]+x[1]*x[1])+2);

return top1;

 
}
} 

class fs extends f_xj //Shuberts function  ++
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;
double top1=0;
double top2=0;
for(int i=1;i<=5;i++)     
{top1+=i*Math.cos((i+1)*x[0]+1);}
for(int i=1;i<=5;i++)     
{top2+=i*Math.cos((i+1)*x[1]+1);}
return -top1*top2;
}
} 

class ft extends f_xj //Six-hump camel back ++
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	

double r=Math.PI/180;

double top=((4.0-2.1*x[0]*x[0]+x[0]*x[0]*x[0]*x[0]/3)*x[0]*x[0])+(x[0]*x[1])+((-4+4*x[1]*x[1])*x[1]*x[1]);

return top;

}
} 


public class galaxy_based_search_test
{
	
       public static void main(String args[])
       {
	    fa ff=new fa();   
	    int dim=2;
	    int discardcount=2000;  
	    double xmin[]={0,0};
	    double xmax[]={2,2};
	    int maxiter=100000;   
	    galaxy_based_search gbs= new galaxy_based_search(ff,discardcount,xmin,xmax,maxiter);    
	   }	
	
	
	
}