public static double getFitness(GTree tree,Polynomial f,DoubleObj[] outputVector,int linearFactors,int quadraticFactors){
		setAll(outputVector,0);
		Polynomial[] factors = new Polynomial[1 + linearFactors + quadraticFactors];
		tree.getValue();
		int j=0;
		double[] scalar={outputVector[j].value};
		factors[j]=new Polynomial(scalar);
		j++;
		for (int i=0;i<linearFactors;j++,i++){
			double[] root={outputVector[j].value,1};
			factors[j]=new Polynomial(root);
		}
		for (int k=j;k<outputVector.length;k+=2,j++){
			double[] root={outputVector[k].value,outputVector[k+1].value,1};
			factors[j]=new Polynomial(root);
		}
		double fitness=0;
		for (int i=0;i<20;i++){
			double rand=i*50-500;
			double goal=f.evaluate(rand);
			double value=1;
			for (int k=0;k<factors.length;k++){
				value*=factors[k].evaluate(rand);
			}
			fitness+=Math.pow(Math.abs(goal-value),2);
		}
		return fitness;	
	}