import java.io.*;
import visad.*;
import visad.java3d.DisplayImplJ3D;
import visad.java2d.DisplayImplJ2D;
import java.rmi.RemoteException;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class fa extends f_xj
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff;
ff=21.5+x[0]*Math.sin(4.0*Math.PI*x[0])+x[1]*Math.sin(20.0*Math.PI*x[0]);
return ff; //maksimum testi
}
}


class OPO17B
{
    public static void main(String args[]) throws IOException,RemoteException, VisADException
    {
    int N=18;
	int POPSIZE=200;
    int MAXGENS=200;
    int NVARS=2;
    double PXOVER=0.3;
    double PMUTATION=0.02;
    fa fx=new fa();
    Genetic1 xx=new Genetic1(POPSIZE,MAXGENS,NVARS,N,PXOVER,PMUTATION);
    double low[]=new double[NVARS];
    double high[]=new double[NVARS];
    low[0]=-3.0;high[0]=12.1;
    low[1]=4.1;high[1]=5.8;
    xx.setPopulation(low,high,fx);
    System.out.println("best=\n"+Matrix.toStringT(xx.calculate(fx,false))); 
    Plot3D.plot3D_CD1(fx,-3.0,12.1,4.1,5.8,300,300,40,"x","y","z=f(x,y)");
    }
}
