import java.io.*;


class fa extends f_xj
{
   double func (double x[])
   {
    return -((x[0]-0.5)*(x[0]-0.5)+(x[1]-0.75)*(x[1]-0.75)+(x[2]-0.3)*(x[2]-0.3));
   }
}

class GeneticTest
{
    public static void main(String args[]) throws IOException
    {
    int POPSIZE=500;
    int MAXGENS=2000;
    int NVARS=3;
    double PXOVER=0.2;
    double PMUTATION=0.03;
    fa fx=new fa();
    Genetic xx=new Genetic(POPSIZE,MAXGENS,NVARS,PXOVER,PMUTATION);
    double low[]=new double[NVARS];
    double high[]=new double[NVARS];
    low[0]=-1.0;high[0]=1.0;
    low[1]=-1.0;high[1]=1.0;
    low[2]=-1.0;high[2]=1.0;
    xx.setPopulation(low,high);
    System.out.println("best="+Matrix.toStringT(xx.calculate(fx,true))); 
    }
}
