import java.io.*;

class fa extends f_xj
{
public double func(double x[]) 
{
//çözümü istenen fonksiyon	
double ff;
double mu1=100.0;
double mu2=100.0;
ff=(x[0]-1.0)*(x[0]-1.0)+(x[1]-2.0)*(x[1]-2.0)+(x[2]-3.0)*(x[2]-3.0)+mu1*P(x)+mu2*Q(x);
return 400-ff; 
}
public double P(double x[])
{// p(x)=0 sınırlama durumu
int n=x.length;
 return (x[0]+x[1]-2.0)*(x[0]+x[1]-2.0);
}
public double Q(double x[])
{// p(x)=0 sınırlama durumu
double eps=1.0e-6;
int n=x.length;
double ax=x[1]-x[2]-3.0-eps;
double bx=0;
if(ax<0) bx=ax*ax; 
 return bx;
}
}

class OPO17H
{
    public static void main(String args[]) throws IOException
    {
    int N=18;
	int POPSIZE=200;
    int MAXGENS=200;
    int NVARS=3;
    double PXOVER=0.3;
    double PMUTATION=0.02;
    fa fx=new fa();
    Genetic1 xx=new Genetic1(POPSIZE,MAXGENS,NVARS,N,PXOVER,PMUTATION);
    double low[]=new double[NVARS];
    double high[]=new double[NVARS];
    low[0]=0.0;high[0]=10.0;
    low[1]=0.0;high[1]=10.0;
    low[2]=0.0;high[2]=10.0;
    xx.setPopulation(low,high,fx);
    System.out.println("best=\n"+Matrix.toStringT(xx.calculate(fx,false))); 
    }
}
