Added more @Description annotations in favor of globalInfo.

refs #9
This commit is contained in:
Fabian Becker 2014-01-21 21:06:29 +01:00
parent d8a169eb10
commit 652c5d49cc
14 changed files with 46 additions and 158 deletions

View File

@ -5,6 +5,7 @@ import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.ArrayList;
@ -12,13 +13,14 @@ import java.util.ArrayList;
/**
*
*/
@Description("This meta-mutation operator allows you to combine multiple alternative mutation operators.")
public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluatingCrossoverOperator, java.io.Serializable {
public static final String CROSSOVER_EA_MIXER_OPERATOR_KEY = "CrossoverEAMixerOperatorKey";
protected PropertyCrossoverMixer m_Crossers;
protected boolean m_UseSelfAdaption = false;
protected double m_Tau1 = 0.15;
protected double m_LowerLimitChance = 0.05;
protected boolean useSelfAdaption = false;
protected double tau1 = 0.15;
protected double lowerLimitChance = 0.05;
protected int lastOperatorIndex = -1;
public CrossoverEAMixer() {
@ -61,9 +63,9 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
public CrossoverEAMixer(CrossoverEAMixer mutator) {
this.m_Crossers = (PropertyCrossoverMixer) mutator.m_Crossers.clone();
this.m_UseSelfAdaption = mutator.m_UseSelfAdaption;
this.m_Tau1 = mutator.m_Tau1;
this.m_LowerLimitChance = mutator.m_LowerLimitChance;
this.useSelfAdaption = mutator.useSelfAdaption;
this.tau1 = mutator.tau1;
this.lowerLimitChance = mutator.lowerLimitChance;
}
/**
@ -118,11 +120,11 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) {
this.m_Crossers.normalizeWeights();
double[] probs = this.m_Crossers.getWeights();
if (this.m_UseSelfAdaption) {
if (this.useSelfAdaption) {
for (int i = 0; i < probs.length; i++) {
probs[i] *= Math.exp(this.m_Tau1 * RNG.gaussianDouble(1));
if (probs[i] <= this.m_LowerLimitChance) {
probs[i] = this.m_LowerLimitChance;
probs[i] *= Math.exp(this.tau1 * RNG.gaussianDouble(1));
if (probs[i] <= this.lowerLimitChance) {
probs[i] = this.lowerLimitChance;
}
if (probs[i] >= 1) {
probs[i] = 1;
@ -189,15 +191,6 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
return "EA mutation mixer";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This meta-mutation operator allows you to combine multiple alternative mutation operators.";
}
/**
* Choose the set of crossers.
*
@ -221,11 +214,11 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
* @param d The mutation operator.
*/
public void setUseSelfAdaption(boolean d) {
this.m_UseSelfAdaption = d;
this.useSelfAdaption = d;
}
public boolean getUseSelfAdaption() {
return this.m_UseSelfAdaption;
return this.useSelfAdaption;
}
public String useSelfAdaptionTipText() {
@ -241,11 +234,11 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
if (d < 0) {
d = 0;
}
this.m_LowerLimitChance = d;
this.lowerLimitChance = d;
}
public double getLowerLimitChance() {
return this.m_LowerLimitChance;
return this.lowerLimitChance;
}
public String lowerLimitChanceTipText() {
@ -261,11 +254,11 @@ public class CrossoverEAMixer implements InterfaceCrossover, InterfaceEvaluating
if (d < 0) {
d = 0;
}
this.m_Tau1 = d;
this.tau1 = d;
}
public double getTau1() {
return this.m_Tau1;
return this.tau1;
}
public String tau1TipText() {

View File

@ -3,21 +3,15 @@ package eva2.optimization.population;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.individuals.InterfaceGAIndividual;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* This implementation of Population Based Incremental Learning is only
* suited for a BitString based genotype representation.
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
*
* @author Felix Streichert
* @version: $Revision: 306 $
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
* $Author: mkron $
*/
@Description("This is a PBIL-population, using a probability vector for Bit-String based individuals.")
public class PBILPopulation extends Population implements Cloneable, java.io.Serializable {
private double[] probabilityVector = new double[1];
@ -187,15 +181,4 @@ public class PBILPopulation extends Population implements Cloneable, java.io.Ser
//}
return result;
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a PBIL-population, using a probability vector for Bit-String based individuals.";
}
}

View File

@ -15,6 +15,7 @@ import eva2.tools.math.Jama.Matrix;
import eva2.tools.math.Mathematics;
import eva2.tools.math.RNG;
import eva2.tools.math.StatisticUtils;
import eva2.util.annotation.Description;
import java.util.*;
import java.util.logging.Level;
@ -29,6 +30,7 @@ import java.util.logging.Logger;
* For initialization, the default individual initialization method may be used, as well as a
* random latin hypercube implementation for InterfaceDataTypeDouble individuals.
*/
@Description("A population stores the individuals of a generation.")
public class Population extends ArrayList implements PopulationInterface, Cloneable, java.io.Serializable {
private static final Logger LOGGER = Logger.getLogger(Population.class.getName());
@ -1631,15 +1633,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
return sb.toString();
}
/**
* This method returns a global info string.
*
* @return description
*/
public static String globalInfo() {
return "A population stores the individuals of a generation.";
}
/**
* This method allows you to set the population size. Be aware that this
* will not directly alter the number of individuals stored. The actual size

View File

@ -501,6 +501,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
* @return description
*/
public static String globalInfo() {
// ToDo: WTF?
return "The programmer did not give further details.";
}

View File

@ -93,6 +93,7 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
* @return description
*/
public static String globalInfo() {
// ToDo: WTF?
return "The programmer did not give further details.";
}

View File

@ -7,17 +7,14 @@ import eva2.optimization.operator.mutation.MutateEAMixer;
import eva2.optimization.operator.mutation.MutateGAGISwapBits;
import eva2.optimization.operator.mutation.MutateGAUniform;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* The minimize bits problem for binary optimization.
* <p/>
* User: streiche
* Date: 21.03.2003
* Time: 13:05:33
* To change this template use Options | File Templates.
*/
@Description("The task in this problem is to maximize the number of false bits in a BitSet.")
public class B1Problem extends AbstractProblemBinary implements java.io.Serializable {
public int m_ProblemDimension = 30;
@ -113,15 +110,6 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
return "Maximize number of bits";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "The task in this problem is to maximize the number of false bits in a BitSet.";
}
/**
* Set the problem dimension.
*

View File

@ -2,6 +2,7 @@ package eva2.optimization.problems;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.util.annotation.Description;
import java.io.FileWriter;
import java.io.IOException;
@ -10,11 +11,8 @@ import java.io.Writer;
/**
* A dynamically "jumping" problem. The severity gives the length of one jump in problem space, occurring
* with the given frequency.
*
* @author Geraldine Hopf
* @date 25.06.2007
*/
@Description("A real valued problem jumping dynamically.")
public class DynJumpProblem extends AbstractDynTransProblem {
private static final long serialVersionUID = 2693154860448970283L;
@ -181,10 +179,6 @@ public class DynJumpProblem extends AbstractDynTransProblem {
return "DynJumpProblem";
}
public static String globalInfo() {
return "A real valued problem jumping dynamically.";
}
public String severityTipText() {
return "length of the jump";
}

View File

@ -16,7 +16,10 @@ import java.io.Serializable;
* <p/>
* For gnuplot: x *sin(sqrt(abs(-x+y+1)))*cos(sqrt(abs(x+y+1)))+(y+1)*cos(sqrt(abs(-x+y+1)))*sin(sqrt(abs(x+y+1)))
*/
@Description("Rana function")
@Description("The Rana function is non-separable, highly multi-modal and multi-funnel." +
" There are diagonal ridges across the search space and the optima are close to the bounds." +
"The minimum fitness f(x*) is close to (n-1)*r for dimension n and default range r, by which " +
"this implementation may be shifted to the positive domain.")
public class F20Problem extends AbstractProblemDouble implements Serializable, InterfaceInterestingHistogram {
private int dim = 10;
private boolean shiftFit = false;
@ -86,13 +89,6 @@ public class F20Problem extends AbstractProblemDouble implements Serializable, I
return "Rana" + (isDoRotation() ? "-rot" : "");
}
public static String globalInfo() {
return "The Rana function is non-separable, highly multi-modal and multi-funnel." +
" There are diagonal ridges across the search space and the optima are close to the bounds." +
"The minimum fitness f(x*) is close to (n-1)*r for dimension n and default range r, by which " +
"this implementation may be shifted to the positive domain.";
}
public void setShiftFit(boolean shiftFit) {
this.shiftFit = shiftFit;
}

View File

@ -1,29 +1,19 @@
package eva2.optimization.problems;
import eva2.optimization.individuals.ESIndividualDoubleData;
import eva2.util.annotation.Description;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* User: streiche
* Date: 23.04.2003
* Time: 11:10:43
* To change this template use Options | File Templates.
* ToDo: Document
*/
@Description("M0(x) = sin(2*x - 0.5*PI) + 1 + 2*cos(y) + 0.5*x is to be maximized, two optima.")
public class FM0Problem extends AbstractMultiModalProblemKnown implements InterfaceOptimizationProblem, Interface2DBorderProblem, InterfaceMultimodalProblemKnown, Serializable {
public FM0Problem() {
this.problemDimension = 2;
this.template = new ESIndividualDoubleData();
// this.m_Extrema = new double[2];
// this.range = new double [this.problemDimension][2];
// this.range[0][0] = -2.0;
// this.range[0][1] = 2.0;
// this.range[1][0] = -2.8;
// this.range[1][1] = 2.8;
// this.m_Extrema[0] = -2;
// this.m_Extrema[1] = 6;
}
@Override
@ -82,10 +72,6 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf
this.add2DOptimum(-1.44445618316078, 0.00000000700284);
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -97,12 +83,4 @@ public class FM0Problem extends AbstractMultiModalProblemKnown implements Interf
return "M0 Problem";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "M0(x) = sin(2*x - 0.5*PI) + 1 + 2*cos(y) + 0.5*x is to be maximized, two optima.";
}
}

View File

@ -2,12 +2,12 @@ package eva2.optimization.problems;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.util.annotation.Description;
/**
* The integer hyper-sphere problem.
* <p/>
* User: streiche, mkron
*/
@Description("A hyper parabola on integer values x with I1(x) = x^2 is to be minimized.")
public class I1Problem extends AbstractProblemInteger implements java.io.Serializable {
public I1Problem() {
@ -71,8 +71,4 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali
public String getName() {
return "I1 Problem";
}
public static String globalInfo() {
return "A hyper parabola on integer values x with I1(x) = x^2 is to be minimized.";
}
}

View File

@ -15,6 +15,7 @@ import eva2.optimization.operator.terminators.PopulationMeasureTerminator.Stagna
import eva2.optimization.population.Population;
import eva2.optimization.stat.InterfaceTextListener;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.util.annotation.Description;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@ -28,9 +29,8 @@ import java.util.BitSet;
* problem implementation. However internally, every evaluation "asks" a mediator instance for
* the result which waits for Matlab to evaluate the x value. When Matlab is finished, the mediator
* returns to the evaluate method and the optimization can continue.
*
* @author mkron
*/
@Description("Interface problem class for optimization in Matlab, only usable from within Matlab")
public class MatlabProblem extends AbstractOptimizationProblem implements InterfaceHasInitRange, InterfaceTextListener, Serializable {
private static final long serialVersionUID = 4913310869887420815L;
public static boolean TRACE = false;
@ -578,10 +578,6 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
}
}
public static String globalInfo() {
return "Interface problem class for optimization in Matlab, only usable from within Matlab";
}
@Override
public void print(String str) {
if (verbosityLevel > 0) {

View File

@ -11,16 +11,13 @@ import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.tools.EVAERROR;
import eva2.tools.ToolBox;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* User: streiche
* Date: 04.04.2003
* Time: 16:44:25
* To change this template use Options | File Templates.
*/
@Description("The task is to infer the equation of a system that can only be observed at a number of checkpoints.")
public class PSymbolicRegression extends AbstractOptimizationProblem implements InterfaceProgramProblem, InterfaceAdditionalPopulationInformer, Serializable {
private double[] m_X = new double[1];
@ -383,15 +380,6 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
return "Symbolic Regression problem";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "The task is to infer the equation of a system that can only be observed at a number of checkpoints.";
}
/**
* This method allows you to choose how much noise is to be added to the
* fitness. This can be used to make the optimization problem more difficult.

View File

@ -7,6 +7,7 @@ import eva2.optimization.individuals.*;
import eva2.optimization.population.Population;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import simpleprobs.InterfaceSimpleProblem;
import simpleprobs.SimpleF1;
import simpleprobs.SimpleProblemBinary;
@ -14,6 +15,7 @@ import simpleprobs.SimpleProblemDouble;
import java.util.BitSet;
@Description("Wrapping simple problem implementations.")
public class SimpleProblemWrapper extends AbstractOptimizationProblem {
InterfaceSimpleProblem<?> simProb = new SimpleF1();
protected double defaultRange = 10;
@ -281,16 +283,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
return "SimpleProblemWrapper";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "Wrapping simple problem implementations.";
}
public String[] getGOEPropertyUpdateLinks() {
return new String[]{"globalInfo", "simpleProblem"};
return new String[]{"simpleProblem"};
}
}

View File

@ -10,18 +10,15 @@ import eva2.optimization.operator.paretofrontmetrics.InterfaceParetoFrontMetric;
import eva2.optimization.population.Population;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
* User: streiche
* Date: 10.05.2004
* Time: 17:22:37
* To change this template use File | Settings | File Templates.
*/
@Description("T1 is to be minimized.")
public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implements java.io.Serializable {
protected int m_ProblemDimension = 30;
protected int m_OutputDimension = 2;
@ -274,15 +271,6 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
return "T1 Problem";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "T1 is to be minimized.";
}
/**
* This method allows you to choose how much noise is to be added to the
* fitness. This can be used to make the optimization problem more difficult.