More problem updates

This commit is contained in:
Marcel Kronfeld 2011-05-04 11:21:14 +00:00
parent 45ffbc09d2
commit 893a742b21
3 changed files with 50 additions and 5 deletions

View File

@ -1,6 +1,15 @@
package eva2.server.go.problems; package eva2.server.go.problems;
public class F16Problem extends AbstractProblemDouble implements InterfaceMultimodalProblem, Interface2DBorderProblem { import eva2.server.go.operators.postprocess.SolutionHistogram;
/**
* The Vincent function: Multiple optima with increasing density near the lower bounds,
* therefore decreasing attractor size. All have an equal best fitness of zero.
*
* @author mkron
*
*/
public class F16Problem extends AbstractProblemDouble implements InterfaceMultimodalProblem, Interface2DBorderProblem, InterfaceInterestingHistogram {
int dim = 10; int dim = 10;
public F16Problem() { public F16Problem() {
@ -11,6 +20,10 @@ public class F16Problem extends AbstractProblemDouble implements InterfaceMultim
dim = other.dim; dim = other.dim;
} }
public F16Problem(int theDim) {
this.dim=theDim;
}
@Override @Override
public double[] eval(double[] x) { public double[] eval(double[] x) {
x = rotateMaybe(x); x = rotateMaybe(x);
@ -47,10 +60,15 @@ public class F16Problem extends AbstractProblemDouble implements InterfaceMultim
} }
public String getName() { public String getName() {
return "Vincent function"; return "Vincent";
} }
public static String globalInfo() { public static String globalInfo() {
return "Multiple optima with increasing densitiy near the lower bounds, therefore decreasing attractor size."; return "The Vincent function: Multiple optima with increasing densitiy near the lower bounds, therefore decreasing attractor size. All have an equal best fitness of zero.";
}
public SolutionHistogram getHistogram() {
return new SolutionHistogram(-0.001, 0.599, 15);
// return new SolutionHistogram(-0.001, 0.099, 5);
} }
} }

View File

@ -5,7 +5,7 @@ import eva2.server.go.operators.postprocess.SolutionHistogram;
* Bohachevsky function, numerous optima on an oval hyperparabola with similar attractor sizes * Bohachevsky function, numerous optima on an oval hyperparabola with similar attractor sizes
* but decreasing fitness towards the bounds. Described e.g. in Shir&Bäck, PPSN 2006, * but decreasing fitness towards the bounds. Described e.g. in Shir&Bäck, PPSN 2006,
* "Niche radius adaption in the CMA-ES Niching Algorithm". * "Niche radius adaption in the CMA-ES Niching Algorithm".
* * f_B(\vec{x})=\sum_{i=1}^{n-1} x_i^2+2(x_{i+1}^2)+0.7-0.3 cos (3 \pi x_i)-0.4 cos (4 \pi x_{i+1})
*/ */
public class F17Problem extends AbstractProblemDouble implements public class F17Problem extends AbstractProblemDouble implements
InterfaceMultimodalProblem, InterfaceInterestingHistogram{ InterfaceMultimodalProblem, InterfaceInterestingHistogram{

View File

@ -13,7 +13,7 @@ import eva2.tools.math.RNG;
* *
*/ */
public class F19Problem extends AbstractProblemDouble implements public class F19Problem extends AbstractProblemDouble implements
InterfaceMultimodalProblem, InterfaceInterestingHistogram { InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDerivableProblem {
int dim = 10; int dim = 10;
transient private double[] alphas, As; transient private double[] alphas, As;
transient private int[] A,B; transient private int[] A,B;
@ -58,6 +58,17 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram {
return v; return v;
} }
/**
* Calculate partial derivation of the B_i function by the j-th coordinate
* @param x
* @param i
* @return
*/
private double derivedTransform(double[] x, int i, int j) {
double v = get(A, i, j)*Math.cos(x[j])-get(B, i, j)*Math.sin(x[j]);
return v;
}
/** /**
* Get a value in row i, col j, from matrix M (represented as vector). * Get a value in row i, col j, from matrix M (represented as vector).
* @param M * @param M
@ -111,5 +122,21 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram {
if (getProblemDimension()<15) return new SolutionHistogram(0, 8, 16); if (getProblemDimension()<15) return new SolutionHistogram(0, 8, 16);
else return new SolutionHistogram(0, 40000, 16); else return new SolutionHistogram(0, 40000, 16);
} }
public double[] getFirstOrderGradients(double[] x) {
x = rotateMaybe(x);
double[] res = new double[x.length];
double[] Bs = transform(x);
for (int k=0; k<getProblemDimension(); k++) {
double sum=0;
for (int i=0; i<getProblemDimension(); i++) {
sum += (-2*As[i]*derivedTransform(x, i, k)+2*Bs[i]*derivedTransform(x, i, k));
}
res[k]=sum;
}
return res;
}
} }