private void PreScale() {
		
	
		int i;
		double tmin = 10e35;
		double tmax = -10e35;
		double tsum = 0;

		int size = Efloys[0].PopulationSize;
		for (i=0;i<size;i++) {
			Efloys[i].GetFitness();
			if (Efloys[i].fitness < tmin)
				tmin = Efloys[i].fitness;
			if (Efloys[i].fitness > tmax)
				tmax = Efloys[i].fitness;
			tsum = tsum + Efloys[i].fitness;
		}

		double tavg = tsum/size;
		// double temp = (tmax+tmin)/2;
		double factor = 1.80; //gadef.params.scale; (Default: 1.80)
		double a_coeff = 1;
		double b_coeff = 0;
		double delta;
		
		//deb.showMsg("tsum= "+tsum+" size = "+size+" tavg= "+tavg);
		//deb.showMsg("tmax= "+tmax+" tmin = "+tmin+" temp= "+temp);
		//deb.showMsg("factor= "+factor+" a = "+a_coeff+" b= "+b_coeff);

		if (factor > 1) {
				if (tmin > (factor * tavg - tmax) / (factor - 1)) {
					delta = tmax - tavg;
					if (delta != 0) {
						a_coeff = (factor - 1) * tavg / delta;
						b_coeff = tavg * (tmax - factor * tavg) / delta;
					}
				}
		}
		else {
				delta = tavg - tmin;
				if (delta != 0) {
					a_coeff = tavg / delta;
					b_coeff = -tmin * tavg / delta;
				}
		}

		//deb.showMsg("After. factor= "+factor+" a = "+a_coeff+" b= "+b_coeff);
		//deb.showMsg("Before 0 = "+Efloys[0].fitness+" 1= "+Efloys[1].fitness);

		for (i=0;i<size;i++)
			Efloys[i].fitness = (int) (Efloys[i].fitness*a_coeff + b_coeff);

		//deb.showMsg("After 0 = "+Efloys[0].fitness+" 1= "+Efloys[1].fitness);
		//deb.showMsg(" ");

		//SortFloys();
		
	}