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	
 public 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[])
{
	   String iLK[]={ "co","o2","co2" };  	             
    	 double[] n0={1,1,0};
    	 double[] n1={0.33983299388703814,0.6699164969435277,0.6601670061129574};
		 double Te[]={1000,1000,1000};	    
		 double T1=3000;
		 double P1=1.01325;

         f1gibbs fax=new f1gibbs(iLK,n0,Te,T1,P1);
         int NVARS=5;
      double low[]=new double[NVARS];
    double high[]=new double[NVARS];
    low[0]=0;high[0]=1.0;
    low[1]=0.0;high[1]=1.0;
    low[2]=0.0;high[2]=1.0;
    low[3]=0.0;high[3]=1.0;
    low[4]=0.0;high[4]=1.0;
particle_swarm ps=new particle_swarm(fax,500,low,high,2.0,2.0,500);
     //ps.plot();
double r1[]= particle_swarm.nelder(fax,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);

}
}