Corrected offsets for F*Problems
This commit is contained in:
		@@ -297,7 +297,7 @@ public class GenericObjectEditor implements PropertyEditor {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		Vector<String> v;
 | 
			
		||||
		Vector<String> v=null;
 | 
			
		||||
		if (Proxy.isProxyClass(m_ClassType)) {
 | 
			
		||||
			if (TRACE) System.out.println("PROXY! original was " + ((RMIProxyLocal)Proxy.getInvocationHandler(((Proxy)m_Object))).getOriginalClass().getName());
 | 
			
		||||
			v = new Vector<String>(getClassesFromProperties(((RMIProxyLocal)Proxy.getInvocationHandler(((Proxy)m_Object))).getOriginalClass().getName()));
 | 
			
		||||
@@ -305,7 +305,7 @@ public class GenericObjectEditor implements PropertyEditor {
 | 
			
		||||
			v = new Vector<String>(getClassesFromProperties(m_ClassType.getName()));
 | 
			
		||||
		}
 | 
			
		||||
				
 | 
			
		||||
		v = new Vector<String>(getClassesFromProperties(m_ClassType.getName()));
 | 
			
		||||
//		v = new Vector<String>(getClassesFromProperties(m_ClassType.getName()));
 | 
			
		||||
		try {
 | 
			
		||||
			if (v.size() > 0)
 | 
			
		||||
				setObject((Object)Class.forName((String)v.get(0)).newInstance());
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
package eva2.server.go.problems;
 | 
			
		||||
 | 
			
		||||
import java.awt.BorderLayout;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
@@ -51,11 +50,13 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void run() {
 | 
			
		||||
			
 | 
			
		||||
//			System.out.println("Running ET " + this);
 | 
			
		||||
//			long time=System.nanoTime();
 | 
			
		||||
			prob.evaluate(ind);
 | 
			
		||||
			resultrep.add(ind);
 | 
			
		||||
			pop.incrFunctionCalls();
 | 
			
		||||
		
 | 
			
		||||
//			long duration=System.nanoTime()-time;
 | 
			
		||||
//			System.out.println("Finished ET" + this +  ", time was " + duration);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
@@ -102,8 +103,8 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
 | 
			
		||||
        evaluatePopulationStart(population);
 | 
			
		||||
        
 | 
			
		||||
        if (this.parallelthreads > 1) {
 | 
			
		||||
        	Vector<AbstractEAIndividual> queue = new Vector<AbstractEAIndividual>();
 | 
			
		||||
        	Vector<AbstractEAIndividual> finished =  new Vector<AbstractEAIndividual>();
 | 
			
		||||
        	Vector<AbstractEAIndividual> queue = new Vector<AbstractEAIndividual>(population.size());
 | 
			
		||||
        	Vector<AbstractEAIndividual> finished =  new Vector<AbstractEAIndividual>(population.size());
 | 
			
		||||
        	queue.addAll(population);
 | 
			
		||||
        	
 | 
			
		||||
        	while (finished.size() < population.size()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,9 +39,10 @@ public class F10Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        double c1 = this.calculateC(1);
 | 
			
		||||
        result[0]     = 0.;
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
            result[0]  += ((this.calculateC(x[i]))/(c1 * Math.pow(Math.abs(x[i]),2-this.m_D))) + Math.pow(x[i], 2) -1;
 | 
			
		||||
        	double xi = x[i]-m_XOffSet;
 | 
			
		||||
            result[0]  += ((this.calculateC(xi))/(c1 * Math.pow(Math.abs(xi),2-this.m_D))) + Math.pow(xi, 2) -1;
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -41,12 +41,12 @@ public class F11Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        double tmpProd = 1;
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        for (int i = 0; i < x.length; i++) {
 | 
			
		||||
            result[0]  += Math.pow(x[i], 2);
 | 
			
		||||
            tmpProd *= Math.cos((x[i])/Math.sqrt(i+1));
 | 
			
		||||
        	double xi = x[i]-m_XOffSet;
 | 
			
		||||
            result[0]  += Math.pow(xi, 2);
 | 
			
		||||
            tmpProd *= Math.cos((xi)/Math.sqrt(i+1));
 | 
			
		||||
        }
 | 
			
		||||
        result[0] = ((result[0]/this.m_D) - tmpProd + 1);
 | 
			
		||||
        result[0] = ((result[0]/this.m_D) - tmpProd + 1)+m_YOffSet;
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,11 +36,11 @@ public class F12Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        double tmp = -5;
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        for (int i = 1; i < x.length-1; i++) {
 | 
			
		||||
            tmp += Math.pow(x[i], 2);
 | 
			
		||||
            tmp += Math.pow(x[i]-m_XOffSet, 2);
 | 
			
		||||
        }
 | 
			
		||||
        result[0] = (Math.exp(-5*x[0]*x[0])+2*Math.exp(-5*Math.pow(1-x[0], 2)))*Math.exp(tmp);
 | 
			
		||||
        double x0 = x[0]-m_XOffSet;
 | 
			
		||||
        result[0] = m_YOffSet+(Math.exp(-5*x0*x0)+2*Math.exp(-5*Math.pow(1-x0, 2)))*Math.exp(tmp);
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,10 +42,11 @@ public class F13Problem extends F1Problem implements InterfaceMultimodalProblem
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0] = 0;
 | 
			
		||||
        result[0] = m_YOffSet;
 | 
			
		||||
        
 | 
			
		||||
        for (int i=0; i<x.length; i++) {
 | 
			
		||||
        	result[0] -= x[i]*Math.sin(Math.sqrt(Math.abs(x[i])));
 | 
			
		||||
        	double xi = x[i]-m_XOffSet;
 | 
			
		||||
        	result[0] -= xi*Math.sin(Math.sqrt(Math.abs(xi)));
 | 
			
		||||
        }
 | 
			
		||||
        result[0] += (418.9829 * m_ProblemDimension);
 | 
			
		||||
        return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -30,14 +30,10 @@ public class F14Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
        return (Object) new F14Problem(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** Ths method allows you to evaluate a double[] to determine the fitness
 | 
			
		||||
     * @param x     The n-dimensional input vector
 | 
			
		||||
     * @return  The m-dimensional output vector.
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        double x0 = x[0]-rotationDX;
 | 
			
		||||
        double x1 = x[1]-rotationDX;
 | 
			
		||||
        double x0 = x[0]-rotationDX-m_XOffSet;
 | 
			
		||||
        double x1 = x[1]-rotationDX-m_XOffSet;
 | 
			
		||||
        if (rotation != 0.) {
 | 
			
		||||
			double cosw = Math.cos(rotation);
 | 
			
		||||
			double sinw = Math.sin(rotation);
 | 
			
		||||
@@ -47,7 +43,7 @@ public class F14Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
			x0=tmpx0;
 | 
			
		||||
        }
 | 
			
		||||
        //matlab: 40 + (- exp(cos(5*X)+cos(3*Y)) .* exp(-X.^2) .* (-.05*Y.^2+5));
 | 
			
		||||
        result[0] = 36.9452804947;//36.945280494653247;
 | 
			
		||||
        result[0] = m_YOffSet+36.9452804947;//36.945280494653247;
 | 
			
		||||
        result[0] += (-Math.exp(Math.cos(3*x0)+Math.cos(6*x1)) * Math.exp(-x0*x0/10) * (-.05*x1*x1+5));
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -31,11 +31,14 @@ public class F2Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        double xi, xii;
 | 
			
		||||
        for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
            result[0]  += (100*(x[i+1]-x[i]*x[i])*(x[i+1]-x[i]*x[i])+(x[i]-1)*(x[i]-1));
 | 
			
		||||
        	xi=x[i]-m_XOffSet;
 | 
			
		||||
        	xii=x[i+1]-m_XOffSet;
 | 
			
		||||
            result[0]  += (100*(xii-xi*xi)*(xii-xi*xi)+(xi-1)*(xi-1));
 | 
			
		||||
        }
 | 
			
		||||
        if (result[0]<=0) result[0]=Math.sqrt(Double.MIN_VALUE); // guard for plots in log scale
 | 
			
		||||
        if (m_YOffSet==0 && (result[0]<=0)) result[0]=Math.sqrt(Double.MIN_VALUE); // guard for plots in log scale
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -32,9 +32,9 @@ public class F3Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0]     = 6*x.length;
 | 
			
		||||
        result[0]     = m_YOffSet+6*x.length;
 | 
			
		||||
        for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
            result[0]  += Math.floor(x[i]);
 | 
			
		||||
            result[0]  += Math.floor(x[i]- this.m_XOffSet);
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,9 +36,9 @@ public class F4Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
            result[0]  += (i+1)*Math.pow(x[i], 4);
 | 
			
		||||
            result[0]  += (i+1)*Math.pow((x[i]-m_XOffSet), 4);
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -37,11 +37,11 @@ public class F5Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[]    result = new double[1];
 | 
			
		||||
        double      tmp;
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
            tmp = 0;
 | 
			
		||||
            for (int j = 0; j <= i; j++) {
 | 
			
		||||
                tmp += x[j];
 | 
			
		||||
                tmp += x[j]-m_XOffSet;
 | 
			
		||||
            }
 | 
			
		||||
            result[0] += Math.pow(tmp, 2);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -58,9 +58,10 @@ public class F6Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
	    	x = resVec.getColumnPackedCopy();
 | 
			
		||||
    	}
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0]     = x.length * this.m_A;
 | 
			
		||||
        result[0]     = x.length * this.m_A + m_YOffSet;
 | 
			
		||||
        for (int i = 0; i < x.length; i++) {
 | 
			
		||||
            result[0]  += Math.pow(x[i], 2) - this.m_A * Math.cos(this.m_Omega*x[i]);
 | 
			
		||||
        	double xi = x[i]-m_XOffSet;
 | 
			
		||||
            result[0]  += Math.pow(xi, 2) - this.m_A * Math.cos(this.m_Omega*xi);
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ public class F7Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
        evaluatePopulationEnd(population);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** Ths method allows you to evaluate a double[] to determine the fitness
 | 
			
		||||
    /** This method allows you to evaluate a double[] to determine the fitness
 | 
			
		||||
     * @param x     The n-dimensional input vector
 | 
			
		||||
     * @return  The m-dimensional output vector.
 | 
			
		||||
     */
 | 
			
		||||
@@ -74,11 +74,11 @@ public class F7Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        if ((Math.floor(this.m_CurrentTimeStamp / this.m_t)%2) == 0) {
 | 
			
		||||
            for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
                result[0]  += Math.pow(x[i], 2);
 | 
			
		||||
                result[0]  += Math.pow(x[i]-m_XOffSet, 2);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            for (int i = 0; i < x.length-1; i++) {
 | 
			
		||||
                result[0]  += Math.pow(x[i]-this.m_Change, 2);
 | 
			
		||||
                result[0]  += Math.pow(x[i]-m_XOffSet-this.m_Change, 2);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,12 +41,13 @@ public class F8Problem extends F1Problem implements InterfaceMultimodalProblem,
 | 
			
		||||
        double          sum1 = 0, sum2 = 0, exp1, exp2;
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < x.length; i++) {
 | 
			
		||||
        	sum1 += (x[i] - this.m_XOffSet)*(x[i] - this.m_XOffSet);
 | 
			
		||||
        	sum2 += Math.cos(c * (x[i] - this.m_XOffSet));
 | 
			
		||||
        	double xi = x[i]-m_XOffSet;
 | 
			
		||||
        	sum1 += (xi)*(xi);
 | 
			
		||||
        	sum2 += Math.cos(c * (xi));
 | 
			
		||||
        }
 | 
			
		||||
        exp1    = -b*Math.sqrt(sum1/(double)this.m_ProblemDimension);
 | 
			
		||||
        exp2    = sum2/(double)this.m_ProblemDimension;
 | 
			
		||||
        result[0] = a +  Math.E  - a * Math.exp(exp1)- Math.exp(exp2);
 | 
			
		||||
        result[0] = m_YOffSet + a +  Math.E  - a * Math.exp(exp1)- Math.exp(exp2);
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,6 @@ package eva2.server.go.problems;
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.individuals.ESIndividualDoubleData;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by IntelliJ IDEA.
 | 
			
		||||
 * User: streiche
 | 
			
		||||
 * Date: 30.06.2005
 | 
			
		||||
 * Time: 13:59:12
 | 
			
		||||
 * To change this template use File | Settings | File Templates.
 | 
			
		||||
 */
 | 
			
		||||
public class F9Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
 | 
			
		||||
    public F9Problem() {
 | 
			
		||||
@@ -32,9 +25,9 @@ public class F9Problem extends F1Problem implements java.io.Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    public double[] eval(double[] x) {
 | 
			
		||||
        double[] result = new double[1];
 | 
			
		||||
        result[0]     = 0;
 | 
			
		||||
        result[0]     = m_YOffSet;
 | 
			
		||||
        for (int i = 0; i < x.length; i++) {
 | 
			
		||||
            result[0]  += (i+1)*Math.pow(x[i], 2);
 | 
			
		||||
            result[0]  += (i+1)*Math.pow(x[i]-m_XOffSet, 2);
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user