// simulated annealing
// 
import java.io.*;
import javax.swing.JOptionPane;


class fa extends f_xj
{
//çözümü istenen fonksiyon	
 double func(double x[])
 {
    double ff=10.0-Math.cos(Math.PI*(x[0]-3.0))*Math.cos(2.0*Math.PI*(x[1]-2.0))/
    (1+(x[0]-3.0)*(x[0]-3.0)+(x[1]-2.0)*(x[1]-2.0));
    return ff; //maksimum testi;
  }
}

class OPO21A
{
    public static void main(String args[]) throws IOException
    {
    int N=40;
	int POPSIZE=1;
    int MAXGENS=600;
    int NVARS=2;
    fa fax=new fa();
    fb fbx=new fb();
    simulatedannealing xx=new simulatedannealing(POPSIZE,NVARS,N,30);
    double low[]=new double[NVARS];
    double high[]=new double[NVARS];
    low[0]=-10.0;high[0]=10.0;
    low[1]=-10.0;high[1]=10.0;
    double a[]=xx.calculate(low,high,fax,false);
    double x0[]=new double[NVARS];
    for(int i=0;i<NVARS;i++) x0[i]=a[i];
    String s="simulated annealing (tavlama simulasyonu)metodu sonucu =\n"+Matrix.toStringT(a);
     String s2="simulated annealing çok değişkenli fonksiyon optimizasyonu:";
     JOptionPane.showMessageDialog(null,s,s2,JOptionPane.PLAIN_MESSAGE);     
    }
}
