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));
    return -ff; //maksimum test;
  }
}

public class particleswarmtest
{
public static void main(String arg[])
{
fa ff=new fa();
double xmin[]={-10.0,-10.0};
double xmax[]={10.0,10.0};
particle_swarm ps=new particle_swarm(ff,500,xmin,xmax,2.0,2.0,500);
     ps.plot();
double r1[]= particle_swarm.nelder(ff,ps.gmin());
String s="Particle swarm optimisation  : \n"+ps.toString()+"\n Nelder-Mead: \n"+ps.toString(r1);     
     String s2="Particle swarm-Nelder-Mead simplex optimization method ";
     JOptionPane.showMessageDialog(null,s,s2,JOptionPane.PLAIN_MESSAGE);

}
}