// Newton metodu ile optimizasyon
// 
import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import javax.swing.*;

public class gibbsTLBO
{
//2. Nelder ve Mead metodu (simpleks arama metodu)

   // veri giriş çıkış metodu
   //________________________________________________________________
     public static double[] verigir(String s)
     {
     String s1=JOptionPane.showInputDialog(s);        
     StringTokenizer token=new StringTokenizer(s1);
     int n=token.countTokens()-1;
     int m=n+1;
     double a[]=new double[m];
     int j=0;           
     while(token.hasMoreTokens())
     {
     Double ax=new Double(token.nextToken());
     a[j++]=ax.doubleValue();
     }
     return a; 
     }
	 public static void main (String args[])  
     {
	     String iLK[]={ "co","o2","co2" };  	             
    	 double[] n0={1,1,0};
    	 double[] n1={0.33983299388703814,0.6699164969435277,0.6601670061129574};
		 double T1=3000;	    
		 double T2=3000;
		 double P1=1.01325;
    f_G fax=new f_G(n1,iLK,T1,T2,P1);
    //fgibbs fax=new fgibbs(iLK,n0,Te,T1,P1); 
	 //String s="kök tahmin değerlerini arada bir boşluk bırakarak giriniz: ";
     //double [] x0=verigir(s);
         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;
         int maxiter=100000; 
	     int N=3; 
	     teaching_learning_based_optimization tlbo=new teaching_learning_based_optimization(fax,N,low,high,maxiter);   
         long startTime = System.currentTimeMillis();
         tlbo.toStringneww();
         long endTime   = System.currentTimeMillis();
         long totalTime = endTime - startTime;
         System.out.println("time="+(totalTime/1000.0)+" sec");
     //double [] x0={0.3398329938870405,0.6699164969435255,0.6601670061129572,.01,.01};
     //double [] dx0=new double[x0.length];
     //for(int i=0;i<x0.length;i++) dx0[i]=0.1*x0[i];     
     //double [] r1= nelder(f,x0,dx0);
     //Text.print(r1);     
     //String s2="Nelder-Mead metodu ile lineer olmıyan çok değişkenli fonksiyon optimizasyonu:";
     //JOptionPane.showMessageDialog(null,s,s2,JOptionPane.PLAIN_MESSAGE);
     System.exit(0);
     } 
}