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

public class gibbsF1
{
//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 s[]={"co","o2","co2"};
      double Tproduct=3000.0;//degree K
      double Treactant=3000.0;//degree K
      double n0[]={1,1,0};
      double P=1.01325;//bar
	  f_G fe=new f_G(n0,s,Treactant,Tproduct,P);
	  double x[]={0.3350816779903834,0.6675408389952318,0.6649183220096443,0.0,0.0};
         //double x[]=fax.setX();
         //System.out.println(fax.func(x));
                  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=10000; 
	     int N=5; 
	     teaching_learning_based_optimization tlbo=new teaching_learning_based_optimization(fe,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");
     //System.exit(0);
     } 
}