Merging old MK branch rev. 214: adding 4 multimodal problems
This commit is contained in:
parent
4fd8546424
commit
5cda401398
55
src/eva2/server/go/problems/F16Problem.java
Normal file
55
src/eva2/server/go/problems/F16Problem.java
Normal file
@ -0,0 +1,55 @@
|
||||
package eva2.server.go.problems;
|
||||
|
||||
public class F16Problem extends AbstractProblemDouble implements InterfaceMultimodalProblem, Interface2DBorderProblem {
|
||||
int dim = 10;
|
||||
|
||||
public F16Problem() {
|
||||
dim=10;
|
||||
}
|
||||
|
||||
public F16Problem(F16Problem other) {
|
||||
dim = other.dim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] eval(double[] x) {
|
||||
double[] res = new double[1];
|
||||
double sum = 0;
|
||||
|
||||
for (int i=0; i<getProblemDimension(); i++) {
|
||||
sum += Math.sin(10*Math.log(x[i]));
|
||||
}
|
||||
|
||||
res[0] = 1.-((1./getProblemDimension())*sum);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProblemDimension() {
|
||||
return dim;
|
||||
}
|
||||
|
||||
public void setProblemDimension(int newDim) {
|
||||
dim = newDim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new F16Problem(this);
|
||||
}
|
||||
|
||||
public double getRangeLowerBound(int n) {
|
||||
return 0.25;
|
||||
}
|
||||
public double getRangeUpperBound(int n) {
|
||||
return 10.;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "Vincent function";
|
||||
}
|
||||
|
||||
public String globalInfo() {
|
||||
return "Multiple optima with increasing densitiy near the lower bounds, there for decreasing attractor size.";
|
||||
}
|
||||
}
|
45
src/eva2/server/go/problems/F17Problem.java
Normal file
45
src/eva2/server/go/problems/F17Problem.java
Normal file
@ -0,0 +1,45 @@
|
||||
package eva2.server.go.problems;
|
||||
|
||||
public class F17Problem extends AbstractProblemDouble implements
|
||||
InterfaceMultimodalProblem {
|
||||
int dim = 10;
|
||||
|
||||
public F17Problem() {
|
||||
dim=10;
|
||||
}
|
||||
|
||||
public F17Problem(F17Problem other) {
|
||||
dim=other.dim;
|
||||
}
|
||||
|
||||
public double[] eval(double[] x) {
|
||||
double[] res = new double[1];
|
||||
double sum = 0;
|
||||
for (int i=0; i<getProblemDimension()-1; i++) {
|
||||
sum += x[i]*x[i]+2.*(x[i+1]*x[i+1]);
|
||||
sum += 0.7 - 0.3*Math.cos(3*Math.PI*x[i]) - 0.4*Math.cos(4*Math.PI*x[i+1]);
|
||||
}
|
||||
res[0] = sum;
|
||||
return res;
|
||||
}
|
||||
|
||||
public int getProblemDimension() {
|
||||
return dim;
|
||||
}
|
||||
|
||||
public void setProblemDimension(int newDim) {
|
||||
dim = newDim;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return new F17Problem(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "F17-Problem";
|
||||
}
|
||||
|
||||
public String globalInfo() {
|
||||
return "Bohachevsky function, numerous optima on an oval hyperparabola with similar attractor sizes but decreasing fitness towards the bounds.";
|
||||
}
|
||||
}
|
67
src/eva2/server/go/problems/F18Problem.java
Normal file
67
src/eva2/server/go/problems/F18Problem.java
Normal file
@ -0,0 +1,67 @@
|
||||
package eva2.server.go.problems;
|
||||
|
||||
public class F18Problem extends AbstractProblemDouble implements
|
||||
InterfaceMultimodalProblem {
|
||||
int dim = 10;
|
||||
double alpha = 1.;
|
||||
|
||||
public F18Problem() {
|
||||
dim=10;
|
||||
}
|
||||
|
||||
public F18Problem(F18Problem other) {
|
||||
dim=other.dim;
|
||||
}
|
||||
|
||||
public double[] eval(double[] x) {
|
||||
double[] res = new double[1];
|
||||
double sum = 0;
|
||||
for (int i=0; i<getProblemDimension(); i++) {
|
||||
sum += Math.pow(Math.sin(5*Math.PI*x[i]), alpha);
|
||||
}
|
||||
res[0] = 1.-sum/getProblemDimension();
|
||||
return res;
|
||||
}
|
||||
|
||||
public double getRangeLowerBound(int n) {
|
||||
return 0.;
|
||||
}
|
||||
|
||||
public double getRangeUpperBound(int n) {
|
||||
return 1.;
|
||||
}
|
||||
|
||||
public int getProblemDimension() {
|
||||
return dim;
|
||||
}
|
||||
|
||||
public void setProblemDimension(int newDim) {
|
||||
dim = newDim;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return new F18Problem(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "F18-Problem";
|
||||
}
|
||||
|
||||
public String globalInfo() {
|
||||
return "N-Function from Shir&Baeck, PPSN 2006.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the alpha
|
||||
*/
|
||||
public double getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alpha the alpha to set
|
||||
*/
|
||||
public void setAlpha(double alpha) {
|
||||
this.alpha = alpha;
|
||||
}
|
||||
}
|
94
src/eva2/server/go/problems/F19Problem.java
Normal file
94
src/eva2/server/go/problems/F19Problem.java
Normal file
@ -0,0 +1,94 @@
|
||||
package eva2.server.go.problems;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import wsi.ra.math.RNG;
|
||||
|
||||
public class F19Problem extends AbstractProblemDouble implements
|
||||
InterfaceMultimodalProblem {
|
||||
int dim = 10;
|
||||
transient private double[] alphas, As;
|
||||
transient private int[] A,B;
|
||||
|
||||
public F19Problem() {
|
||||
alphas=null;
|
||||
dim=10;
|
||||
setDefaultRange(Math.PI);
|
||||
}
|
||||
|
||||
public F19Problem(F19Problem other) {
|
||||
dim=other.dim;
|
||||
alphas=null;
|
||||
}
|
||||
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
if (alphas==null) {
|
||||
// create static random data
|
||||
alphas = RNG.randomVector(dim, -Math.PI, Math.PI);
|
||||
A = RNG.randomVector(dim*dim, -100, 100);
|
||||
B = RNG.randomVector(dim*dim, -100, 100);
|
||||
As = transform(alphas);
|
||||
}
|
||||
}
|
||||
|
||||
private double[] transform(double[] x) {
|
||||
double[] v = new double[dim];
|
||||
Arrays.fill(v, 0.);
|
||||
for (int i=0; i<dim; i++) {
|
||||
for (int j=0; j<dim; j++) {
|
||||
v[i] += get(A, i, j)*Math.sin(x[j])+get(B, i, j)*Math.cos(x[j]);
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value in row i, col j, from matrix M (represented as vector).
|
||||
* @param M
|
||||
* @param i
|
||||
* @param j
|
||||
* @return
|
||||
*/
|
||||
private int get(int[] M, int i, int j) {
|
||||
return M[i*dim+j];
|
||||
}
|
||||
|
||||
public double[] eval(double[] x) {
|
||||
double[] res = new double[1];
|
||||
double[] Bs = transform(x);
|
||||
|
||||
double sum=0;
|
||||
for (int i=0; i<getProblemDimension(); i++) {
|
||||
sum += Math.pow(As[i]-Bs[i], 2);
|
||||
}
|
||||
res[0] = sum;
|
||||
return res;
|
||||
}
|
||||
|
||||
public int getProblemDimension() {
|
||||
return dim;
|
||||
}
|
||||
|
||||
public void setProblemDimension(int newDim) {
|
||||
dim = newDim;
|
||||
if (alphas!=null && (newDim>alphas.length)) { // only recreate if really necessary
|
||||
alphas=null;
|
||||
A=null;
|
||||
B=null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return new F19Problem(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "F19-Problem";
|
||||
}
|
||||
|
||||
public String globalInfo() {
|
||||
return "Fletcher-Powell function with up to 2^n optima from Shir&Baeck, PPSN 2006, after Bäck 1996. Alphas and Matrices A and B are randomly created but kept when the dimension is decreased.";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user