@Test public void testEllipsoidal(){ for (int i = 0; i < 1000; i++){ BBOBenchmarks instance = new BBOBenchmarks(); params.set(BASE.push(BBOBenchmarks.P_WHICH_PROBLEM), "ellipsoidal"); instance.setup(state, BASE); final DoubleVectorIndividual ind = new DoubleVectorIndividual(); ind.setGenome(new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.0 }); ind.fitness = new SimpleFitness(); instance.evaluate(state, ind, 0, 0); assertTrue(instance.problemType == 1); assertTrue(ind.fitness.fitness() <= -instance.fOpt); } }
void ellipsoidal(double fAdd, double condition, double[] tmx, int genomeSize, double[] genome, double tmp, double fPen, double value, double fit, Individual ind, EvolutionState state, int threadnum) { int i, j; fAdd = fOpt; if (noise == NONE) { condition = 1e6; for (i = 0; i < genomeSize; i++) { tmx[i] = genome[i] - xOpt[i]; } } else { condition = 1e4; fAdd = fOpt; for (i = 0; i < genomeSize; i++) { tmp = Math.abs(genome[i]) - 5.; if (tmp > 0.) { fPen += tmp * tmp; } } fAdd += 100. * fPen; for (i = 0; i < genomeSize; i++) { tmx[i] = 0.; for (j = 0; j < genomeSize; j++) { tmx[i] += rotation[i][j] * (genome[j] - xOpt[j]); } } } monotoneTFosc(tmx); for (i = 0; i < genomeSize; i++) { value += Math.pow(condition, ((double) i) / ((double) (genomeSize - 1))) * tmx[i] * tmx[i]; } switch (noise) { case NONE: break; case GAUSSIAN: value = fGauss(value, 1.0, state.random[threadnum]); break; case UNIFORM: value = fUniform(value, 0.49 + 1.0 / genomeSize, 1.0, state.random[threadnum]); break; case CAUCHY: value = fCauchy(value, 1.0, 0.2, state.random[threadnum]); break; default: String outputStr = "Invalid value for parameter, or parameter not found.\n" + "Acceptable values are:\n"; for (i = 0; i < 4; i++) outputStr += noiseTypes[i] + "\n"; state.output.fatal(outputStr, new Parameter(P_NOISE)); break; } value += fAdd; fit = (-value); ((SimpleFitness) (ind.fitness)).setFitness(state, fit, fit == 0.0); }
BBOBenchmarks extends Problem implements SimpleProblemForm { void ellipsoidal(double fAdd, double condition, double[] tmx, int genomeSize, double[] genome, double tmp, double fPen, double value, double fit, Individual ind, EvolutionState state, int threadnum) { int i, j; fAdd = fOpt; if (noise == NONE) { condition = 1e6; for (i = 0; i < genomeSize; i++) { tmx[i] = genome[i] - xOpt[i]; } } else { condition = 1e4; fAdd = fOpt; for (i = 0; i < genomeSize; i++) { tmp = Math.abs(genome[i]) - 5.; if (tmp > 0.) { fPen += tmp * tmp; } } fAdd += 100. * fPen; for (i = 0; i < genomeSize; i++) { tmx[i] = 0.; for (j = 0; j < genomeSize; j++) { tmx[i] += rotation[i][j] * (genome[j] - xOpt[j]); } } } monotoneTFosc(tmx); for (i = 0; i < genomeSize; i++) { value += Math.pow(condition, ((double) i) / ((double) (genomeSize - 1))) * tmx[i] * tmx[i]; } switch (noise) { case NONE: break; case GAUSSIAN: value = fGauss(value, 1.0, state.random[threadnum]); break; case UNIFORM: value = fUniform(value, 0.49 + 1.0 / genomeSize, 1.0, state.random[threadnum]); break; case CAUCHY: value = fCauchy(value, 1.0, 0.2, state.random[threadnum]); break; default: String outputStr = "Invalid value for parameter, or parameter not found.\n" + "Acceptable values are:\n"; for (i = 0; i < 4; i++) outputStr += noiseTypes[i] + "\n"; state.output.fatal(outputStr, new Parameter(P_NOISE)); break; } value += fAdd; fit = (-value); ((SimpleFitness) (ind.fitness)).setFitness(state, fit, fit == 0.0); } }
BBOBenchmarks extends Problem implements SimpleProblemForm { void ellipsoidal(double fAdd, double condition, double[] tmx, int genomeSize, double[] genome, double tmp, double fPen, double value, double fit, Individual ind, EvolutionState state, int threadnum) { int i, j; fAdd = fOpt; if (noise == NONE) { condition = 1e6; for (i = 0; i < genomeSize; i++) { tmx[i] = genome[i] - xOpt[i]; } } else { condition = 1e4; fAdd = fOpt; for (i = 0; i < genomeSize; i++) { tmp = Math.abs(genome[i]) - 5.; if (tmp > 0.) { fPen += tmp * tmp; } } fAdd += 100. * fPen; for (i = 0; i < genomeSize; i++) { tmx[i] = 0.; for (j = 0; j < genomeSize; j++) { tmx[i] += rotation[i][j] * (genome[j] - xOpt[j]); } } } monotoneTFosc(tmx); for (i = 0; i < genomeSize; i++) { value += Math.pow(condition, ((double) i) / ((double) (genomeSize - 1))) * tmx[i] * tmx[i]; } switch (noise) { case NONE: break; case GAUSSIAN: value = fGauss(value, 1.0, state.random[threadnum]); break; case UNIFORM: value = fUniform(value, 0.49 + 1.0 / genomeSize, 1.0, state.random[threadnum]); break; case CAUCHY: value = fCauchy(value, 1.0, 0.2, state.random[threadnum]); break; default: String outputStr = "Invalid value for parameter, or parameter not found.\n" + "Acceptable values are:\n"; for (i = 0; i < 4; i++) outputStr += noiseTypes[i] + "\n"; state.output.fatal(outputStr, new Parameter(P_NOISE)); break; } value += fAdd; fit = (-value); ((SimpleFitness) (ind.fitness)).setFitness(state, fit, fit == 0.0); }  }
BBOBenchmarks extends Problem implements SimpleProblemForm { void ellipsoidal(double fAdd, double condition, double[] tmx, int genomeSize, double[] genome, double tmp, double fPen, double value, double fit, Individual ind, EvolutionState state, int threadnum) { int i, j; fAdd = fOpt; if (noise == NONE) { condition = 1e6; for (i = 0; i < genomeSize; i++) { tmx[i] = genome[i] - xOpt[i]; } } else { condition = 1e4; fAdd = fOpt; for (i = 0; i < genomeSize; i++) { tmp = Math.abs(genome[i]) - 5.; if (tmp > 0.) { fPen += tmp * tmp; } } fAdd += 100. * fPen; for (i = 0; i < genomeSize; i++) { tmx[i] = 0.; for (j = 0; j < genomeSize; j++) { tmx[i] += rotation[i][j] * (genome[j] - xOpt[j]); } } } monotoneTFosc(tmx); for (i = 0; i < genomeSize; i++) { value += Math.pow(condition, ((double) i) / ((double) (genomeSize - 1))) * tmx[i] * tmx[i]; } switch (noise) { case NONE: break; case GAUSSIAN: value = fGauss(value, 1.0, state.random[threadnum]); break; case UNIFORM: value = fUniform(value, 0.49 + 1.0 / genomeSize, 1.0, state.random[threadnum]); break; case CAUCHY: value = fCauchy(value, 1.0, 0.2, state.random[threadnum]); break; default: String outputStr = "Invalid value for parameter, or parameter not found.\n" + "Acceptable values are:\n"; for (i = 0; i < 4; i++) outputStr += noiseTypes[i] + "\n"; state.output.fatal(outputStr, new Parameter(P_NOISE)); break; } value += fAdd; fit = (-value); ((SimpleFitness) (ind.fitness)).setFitness(state, fit, fit == 0.0); }  static void main(String[] args); void setup(final EvolutionState state, final Parameter base); void evaluate(EvolutionState state, Individual ind, int subpopulation, int threadnum); }
BBOBenchmarks extends Problem implements SimpleProblemForm { void ellipsoidal(double fAdd, double condition, double[] tmx, int genomeSize, double[] genome, double tmp, double fPen, double value, double fit, Individual ind, EvolutionState state, int threadnum) { int i, j; fAdd = fOpt; if (noise == NONE) { condition = 1e6; for (i = 0; i < genomeSize; i++) { tmx[i] = genome[i] - xOpt[i]; } } else { condition = 1e4; fAdd = fOpt; for (i = 0; i < genomeSize; i++) { tmp = Math.abs(genome[i]) - 5.; if (tmp > 0.) { fPen += tmp * tmp; } } fAdd += 100. * fPen; for (i = 0; i < genomeSize; i++) { tmx[i] = 0.; for (j = 0; j < genomeSize; j++) { tmx[i] += rotation[i][j] * (genome[j] - xOpt[j]); } } } monotoneTFosc(tmx); for (i = 0; i < genomeSize; i++) { value += Math.pow(condition, ((double) i) / ((double) (genomeSize - 1))) * tmx[i] * tmx[i]; } switch (noise) { case NONE: break; case GAUSSIAN: value = fGauss(value, 1.0, state.random[threadnum]); break; case UNIFORM: value = fUniform(value, 0.49 + 1.0 / genomeSize, 1.0, state.random[threadnum]); break; case CAUCHY: value = fCauchy(value, 1.0, 0.2, state.random[threadnum]); break; default: String outputStr = "Invalid value for parameter, or parameter not found.\n" + "Acceptable values are:\n"; for (i = 0; i < 4; i++) outputStr += noiseTypes[i] + "\n"; state.output.fatal(outputStr, new Parameter(P_NOISE)); break; } value += fAdd; fit = (-value); ((SimpleFitness) (ind.fitness)).setFitness(state, fit, fit == 0.0); }  static void main(String[] args); void setup(final EvolutionState state, final Parameter base); void evaluate(EvolutionState state, Individual ind, int subpopulation, int threadnum); static final String P_GENOME_SIZE; static final String P_WHICH_PROBLEM; static final String P_NOISE; static final String P_REEVALUATE_NOISY_PROBLEMS; static final String P_ZERO_IS_BEST; static final String P_XOPT; final public String[] problemTypes; final static public int SPHERE; final static public int ELLIPSOIDAL; final static public int RASTRIGIN; final static public int BUCHE_RASTRIGIN; final static public int LINEAR_SLOPE; final static public int ATTRACTIVE_SECTOR; final static public int STEP_ELLIPSOIDAL; final static public int ROSENBROCK; final static public int ROSENBROCK_ROTATED; final static public int ELLIPSOIDAL_2; final static public int DISCUS; final static public int BENT_CIGAR; final static public int SHARP_RIDGE; final static public int DIFFERENT_POWERS; final static public int RASTRIGIN_2; final static public int WEIERSTRASS; final static public int SCHAFFERS_F7; final static public int SCHAFFERS_F7_2; final static public int GRIEWANK_ROSENBROCK; final static public int SCHWEFEL; final static public int GALLAGHER_GAUSSIAN_101ME; final static public int GALLAGHER_GAUSSIAN_21HI; final static public int KATSUURA; final static public int LUNACEK; final public String[] noiseTypes; final static public int NONE; final static public int GAUSSIAN; final static public int UNIFORM; final static public int CAUCHY; final static public int GAUSSIAN_MODERATE; final static public int UNIFORM_MODERATE; final static public int CAUCHY_MODERATE; public int problemType; public int noise; public boolean reevaluateNoisyProblems; public boolean zeroIsBest; static final int NHIGHPEAKS21; static final int NHIGHPEAKS22; final static public double TOL; }