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

class fa extends f_xj
{
//çözümü istenen fonksiyon	
 double func(double x[])
 {
    //double ff= 1.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));
    double fx=Math.sin(x[0]);
    double fy=Math.sin(x[1]);
    double ff=x[0]*x[0]+x[1]*x[1]+25*(fx*fx+fy*fy);
    return ff; 
  }
}
public class Harmonytest2 {

	public static void main(String[] args) {

		fa ff=new fa();
		double xmin[]={-2*Math.PI,-2*Math.PI};
        double xmax[]={2*Math.PI,2*Math.PI};
        int maxIter=1000000;
        double BW=0.2;
        double HMCR=0.9;
        int HMS=50;
        double PAR=0.4;
		HarmonySearch hs=new HarmonySearch(ff,xmin,xmax,maxIter,BW,HMCR,HMS,PAR);
		String s="Harmony search : \n"+hs.toString()  ;  
        String s2="Harmony search optimization method ";
        JOptionPane.showMessageDialog(null,s,s2,JOptionPane.PLAIN_MESSAGE);
        ContourPlot pp = new ContourPlot(ff,xmin[0],xmax[0],100,xmin[1],xmax[1],100,40, false,"Harmony search optimisation", "x", "y");
		pp.plot();hs.plot();
	}

}
