Removed NamingBox class

Added Description annotation for several classes and removed the globalInfo functions
This commit is contained in:
Fabian Becker 2013-10-11 22:25:11 +02:00
parent 8229b145ee
commit 691f3d06d9
28 changed files with 152 additions and 505 deletions

View File

@ -18,13 +18,6 @@ public class EvAComAdapter {
private EvAMainAdapterImpl localMainAdapter;
private static EvAComAdapter instance;
/**
*
*/
public void setLogPanel(LoggingPanel loggingPanel) {
this.loggingPanel = loggingPanel;
}
/**
*
*/

View File

@ -6,6 +6,7 @@ import eva2.tools.Pair;
import eva2.tools.SelectedTag;
import eva2.tools.StringTools;
import eva2.tools.Tag;
import eva2.util.annotation.Description;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
@ -637,7 +638,14 @@ public class BeanInspector {
if (ret != null) {
infoBf.append("\t");
infoBf.append((String) ret);
} else {
Description description = obj.getClass().getAnnotation(Description.class);
if(description != null) {;
infoBf.append("\t");
infoBf.append(description.text());
}
}
}
return infoBf.toString();

View File

@ -595,6 +595,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
}
return infoPanel;
} catch (Exception ex) {
LOGGER.severe(ex.getMessage());
}
}
return null;

View File

@ -417,9 +417,9 @@ public class GraphPointSet {
m_Area = Area;
m_Area.addDElement(m_ConnectedPointSet);
((FunctionArea) m_Area).addGraphPointSet(this);
// m_Area.addDElement(m_PointSet_1);
// m_Area.addDElement(m_PointSet_2);
// m_Area.addDElement(m_PointSet_3);
// gpArea.addDElement(m_PointSet_1);
// gpArea.addDElement(m_PointSet_2);
// gpArea.addDElement(m_PointSet_3);
// DPointIcon icon1 = new DPointIcon(){
// public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0);

View File

@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.Date;
import javax.swing.*;
@eva2.util.annotation.Description(text="This is a simple example framework for Evolutionary Algorithms.")
public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopulationChangedEventListener, java.io.Serializable {
// Interface GUI Stuff
@ -645,14 +646,6 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
* ********************************************************************************************************************
* These are for GUI
*/
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a simple example framework for Evolutionary Algorithms.";
}
/**
* This method allows you to set the number of mulitruns that are to be

View File

@ -13,12 +13,6 @@ import eva2.optimization.strategies.InterfaceOptimizer;
* To change this template use Options | File Templates.
*/
public interface InterfaceOptimizationParameters {
/** This method returns a global info string
* @return description
*/
// public String globalInfo();
/**
* This method allows you to serialize the current parameters into a *.ser file
*/

View File

@ -19,6 +19,7 @@ import java.util.Comparator;
* @author mkron
* @see #AbstractEAIndividual().isDominatingFitness(double[], double[])
*/
@eva2.util.annotation.Description(text="A comparator class for general EA individuals. Compares individuals based on their fitness in context of minimization.")
public class AbstractEAIndividualComparator implements Comparator<Object>, Serializable {
// flag whether a data field should be used.
private String indyDataKey = "";
@ -205,10 +206,6 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
return "Activate preference of feasible individuals in any comparison acc. to Deb's rules.";
}
public static String globalInfo() {
return "A comparator class for general EA individuals. Compares individuals based on their fitness in context of minimization.";
}
public String getName() {
return "IndividualComparator";
}

View File

@ -13,12 +13,8 @@ import java.util.BitSet;
/**
* This individual uses a real-valued genotype to code for binary values, either
* by using a threshold value of by interpreting the double value as probability.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 02.07.2003
* Time: 10:37:43
* To change this template use Options | File Templates.
*/
@eva2.util.annotation.Description(text="This is an ES individual adopted to optimize binary values.")
public class ESIndividualBinaryData extends AbstractEAIndividual implements InterfaceESIndividual, InterfaceDataTypeBinary, java.io.Serializable {
private BitSet m_Phenotype = new BitSet();
@ -340,15 +336,6 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return "ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is an ES individual adopted to optimize binary values.";
}
/**
* This method will toggle between genotype interpretation as bit probability and
* fixed switch.

View File

@ -10,15 +10,12 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR;
import eva2.tools.math.Mathematics;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual uses a real-valued genotype to code for double values.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 24.03.2003
* Time: 16:00:03
* To change this template use Options | File Templates.
*/
@Description(text="This is an ES individual suited to optimize double values.")
public class ESIndividualDoubleData extends AbstractEAIndividual implements InterfaceESIndividual, InterfaceDataTypeDouble, java.io.Serializable {
private double[] genotype;
@ -410,9 +407,6 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
}
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -423,13 +417,4 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
public String getName() {
return "ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is an ES individual suited to optimize double values.";
}
}

View File

@ -6,15 +6,12 @@ import eva2.optimization.operator.mutation.MutateESGlobal;
import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual uses a real-valued genotype to code for integer values.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 15.04.2004
* Time: 17:18:58
* To change this template use File | Settings | File Templates.
*/
@Description(text="This is an ES individual suited to optimize integer values.")
public class ESIndividualIntegerData extends AbstractEAIndividual implements InterfaceESIndividual, InterfaceDataTypeInteger, java.io.Serializable {
private double[] genotype;
@ -349,9 +346,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
this.genotype[i] = RNG.randomInt(range[i][0], range[i][1]);
}
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -362,13 +357,4 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
public String getName() {
return "ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is an ES individual suited to optimize integer values.";
}
}

View File

@ -6,16 +6,13 @@ import eva2.optimization.operator.mutation.MutateESGlobal;
import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual uses a real-valued genotype to code for a permutations,
* the sorting of the real-valued genotype gives the permutation.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 21.10.2004
* Time: 17:02:53
* To change this template use File | Settings | File Templates.
*/
@Description(text="This is an ES individual suited to optimize permutations.")
public class ESIndividualPermutationData extends AbstractEAIndividual implements InterfaceESIndividual, InterfaceDataTypePermutation, java.io.Serializable {
private double[][] m_Genotype;
@ -409,9 +406,6 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return res;
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -422,14 +416,4 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
public String getName() {
return "ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is an ES individual suited to optimize permutations.";
}
}

View File

@ -5,17 +5,14 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 13.05.2003
* Time: 11:35:48
* To change this template use Options | File Templates.
*/
@Description(text="This is a mixed data type combining a BitSet and a real-valued vector.")
public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual implements InterfaceDataTypeBinary, InterfaceDataTypeDouble, java.io.Serializable {
private InterfaceDataTypeDouble m_Numbers = new ESIndividualDoubleData();
@ -385,15 +382,6 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return "GA/ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a mixed data type combining a BitSet and a real-valued vector.";
}
/**
* This method will allow you to set the inner constants
*

View File

@ -7,17 +7,14 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGANBit;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* This individual uses a binary genotype to code for binary values.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 24.03.2003
* Time: 14:08:24
* To change this template use Options | File Templates.
*/
@Description(text="This is a GA individual suited to optimize binary values.")
public class GAIndividualBinaryData extends AbstractEAIndividual implements InterfaceDataTypeBinary, InterfaceGAIndividual, java.io.Serializable {
protected BitSet m_Genotype = new BitSet();
@ -306,9 +303,6 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
this.m_Genotype = (BitSet) binaryData.clone();
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -319,13 +313,4 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
public String getName() {
return "GA binary individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GA individual suited to optimize binary values.";
}
}

View File

@ -9,18 +9,15 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGAUniform;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* This individual uses a binary genotype to code for double values
* using two alternative encodings.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 24.03.2003
* Time: 16:00:30
* To change this template use Options | File Templates.
*/
@Description(text="This is a GA individual suited to optimize double values.")
public class GAIndividualDoubleData extends AbstractEAIndividual implements InterfaceGAIndividual, InterfaceDataTypeDouble, java.io.Serializable {
private double[] m_Phenotype;
@ -382,15 +379,6 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return "GA individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GA individual suited to optimize double values.";
}
/**
* This method allows you to set the Coding that is to be used, currently either standard binary
* coding or Gray coding.

View File

@ -8,18 +8,15 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGANBit;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.BitSet;
/**
* This individual uses a binary genotype to code for binary values using
* two alternative encodings.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 13.05.2004
* Time: 11:16:33
* To change this template use File | Settings | File Templates.
*/
@Description(text="This is a GA individual suited to optimize int values.")
public class GAIndividualIntegerData extends AbstractEAIndividual implements InterfaceGAIndividual, InterfaceDataTypeInteger, java.io.Serializable {
private int[] phenotype;
@ -456,9 +453,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
}
System.out.println(tmp + "}");
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -470,15 +465,6 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return "GA individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GA individual suited to optimize int values.";
}
/**
* This method allows you to set the Coding that is to be used, currently either standard binary
* coding or Gray coding.

View File

@ -9,6 +9,7 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateDefault;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.ArrayList;
import java.util.BitSet;
@ -16,12 +17,8 @@ import java.util.BitSet;
/**
* This individual uses a binary genotype to code for a tree-based representation
* using a BNF grammar, see also Grammatical Evolution.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 28.07.2004
* Time: 10:43:39
* To change this template use File | Settings | File Templates.
*/
@Description(text="This is a GE individual suited to optimize programs.")
public class GEIndividualProgramData extends AbstractEAIndividual implements InterfaceGAIndividual, InterfaceDataTypeProgram, java.io.Serializable {
protected GPArea[] m_Area;
@ -154,7 +151,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
this.m_Rules = null;
return;
}
//this.m_Rules = new Object[this.m_Area.length][];
//this.m_Rules = new Object[this.gpArea.length][];
for (int t = 0; t < this.m_Area.length; t++) {
// first lets find out what kind of elements are available
int arity, maxArity = 0;
@ -695,9 +692,6 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
//if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor());
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -709,15 +703,6 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return "GE individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GE individual suited to optimize programs.";
}
/**
* This method allows you to set the length of the binary genotype
*

View File

@ -6,15 +6,12 @@ import eva2.optimization.operator.mutation.MutateDefault;
import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual uses a integer genotype to code for integer values.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 18.05.2005
* Time: 16:55:23
* To change this template use File | Settings | File Templates.
*/
@Description(text="This is a GI individual suited to optimize int values.")
public class GIIndividualIntegerData extends AbstractEAIndividual implements InterfaceGIIndividual, InterfaceDataTypeInteger, java.io.Serializable {
private int[] m_Phenotype;
@ -361,10 +358,6 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
}
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -375,14 +368,4 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
public String getName() {
return "GI individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GI individual suited to optimize int values.";
}
}

View File

@ -4,15 +4,12 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 13.05.2003
* Time: 11:35:48
* To change this template use Options | File Templates.
*/
@Description(text="This is a mixed data type combining an integer vector with a permutation vector.")
public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual implements InterfaceDataTypeInteger, InterfaceDataTypePermutation, java.io.Serializable {
private InterfaceDataTypeInteger m_Integer = new GIIndividualIntegerData();
@ -369,9 +366,6 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.m_Permutation.setFirstindex(firstindex);
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -383,15 +377,6 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return "GA/ES individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a mixed data type combining an integer vector with a permutation vector.";
}
/**
* This method will allow you to set the inner constants
*

View File

@ -10,59 +10,56 @@ import eva2.optimization.operator.mutation.MutateDefault;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/**
* This individual uses a tree-based genotype to code for program trees.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 04.04.2003
* Time: 16:27:55
* To change this template use Options | File Templates.
*/
@Description(text="This is a GP individual suited to optimize Koza style program trees.")
public class GPIndividualProgramData extends AbstractEAIndividual implements InterfaceGPIndividual, InterfaceDataTypeProgram, java.io.Serializable {
protected AbstractGPNode[] m_Genotype;
protected AbstractGPNode[] m_Phenotype;
protected GPArea[] m_Area;
protected double m_InitFullGrowRatio = 0.5;
protected int m_InitDepth = 4;
protected int m_maxAllowedDepth = 8;
protected boolean m_CheckMaxDepth = true;
protected AbstractGPNode[] genotype;
protected AbstractGPNode[] phenotype;
protected GPArea[] gpArea;
protected double initFullGrowRatio = 0.5;
protected int initDepth = 4;
protected int maxAllowedDepth = 8;
protected boolean checkMaxDepth = true;
public GPIndividualProgramData() {
this.m_Area = new GPArea[1];
m_Area[0] = new GPArea();
this.m_Genotype = new AbstractGPNode[1];
this.gpArea = new GPArea[1];
gpArea[0] = new GPArea();
this.genotype = new AbstractGPNode[1];
this.mutationOperator = new MutateDefault();
this.crossoverOperator = new CrossoverGPDefault();
}
public GPIndividualProgramData(GPIndividualProgramData individual) {
if (individual.m_Phenotype != null) {
this.m_Phenotype = new AbstractGPNode[individual.m_Phenotype.length];
for (int i = 0; i < individual.m_Phenotype.length; i++) {
if (individual.m_Phenotype[i] != null) {
this.m_Phenotype[i] = (AbstractGPNode) individual.m_Phenotype[i].clone();
if (individual.phenotype != null) {
this.phenotype = new AbstractGPNode[individual.phenotype.length];
for (int i = 0; i < individual.phenotype.length; i++) {
if (individual.phenotype[i] != null) {
this.phenotype[i] = (AbstractGPNode) individual.phenotype[i].clone();
}
}
}
if (individual.m_Genotype != null) {
this.m_Genotype = new AbstractGPNode[individual.m_Genotype.length];
this.m_Area = new GPArea[individual.m_Area.length];
for (int i = 0; i < individual.m_Genotype.length; i++) {
if (individual.m_Genotype[i] != null) {
this.m_Genotype[i] = (AbstractGPNode) individual.m_Genotype[i].clone();
this.m_Genotype[i].connect(null);
if (individual.genotype != null) {
this.genotype = new AbstractGPNode[individual.genotype.length];
this.gpArea = new GPArea[individual.gpArea.length];
for (int i = 0; i < individual.genotype.length; i++) {
if (individual.genotype[i] != null) {
this.genotype[i] = (AbstractGPNode) individual.genotype[i].clone();
this.genotype[i].connect(null);
}
if (individual.m_Area[i] != null) {
this.m_Area[i] = (GPArea) individual.m_Area[i].clone();
if (individual.gpArea[i] != null) {
this.gpArea[i] = (GPArea) individual.gpArea[i].clone();
}
}
}
this.m_InitFullGrowRatio = individual.m_InitFullGrowRatio;
this.m_InitDepth = individual.m_InitDepth;
this.m_maxAllowedDepth = individual.m_maxAllowedDepth;
this.m_CheckMaxDepth = individual.m_CheckMaxDepth;
this.initFullGrowRatio = individual.initFullGrowRatio;
this.initDepth = individual.initDepth;
this.maxAllowedDepth = individual.maxAllowedDepth;
this.checkMaxDepth = individual.checkMaxDepth;
// cloning the members of AbstractEAIndividual
this.age = individual.age;
@ -97,14 +94,14 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
if (individual instanceof GPIndividualProgramData) {
GPIndividualProgramData indy = (GPIndividualProgramData) individual;
//@todo Eigendlich k<EFBFBD>nnte ich noch die Areas vergleichen
if (this.m_maxAllowedDepth != indy.m_maxAllowedDepth) {
if (this.maxAllowedDepth != indy.maxAllowedDepth) {
return false;
}
if ((this.m_Genotype == null) || (indy.m_Genotype == null)) {
if ((this.genotype == null) || (indy.genotype == null)) {
return false;
} else {
for (int i = 0; i < this.m_Genotype.length; i++) {
if ((this.m_Genotype[i] == null) || (indy.m_Genotype[i] == null) || (!this.m_Genotype[i].equals(indy.m_Genotype[i]))) {
for (int i = 0; i < this.genotype.length; i++) {
if ((this.genotype[i] == null) || (indy.genotype[i] == null) || (!this.genotype[i].equals(indy.genotype[i]))) {
return false;
}
}
@ -125,17 +122,17 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public void setProgramDataLength(int length) {
GPArea[] oldArea = this.m_Area;
AbstractGPNode[] oldProg = this.m_Genotype;
this.m_Area = new GPArea[length];
this.m_Genotype = new AbstractGPNode[length];
for (int i = 0; ((i < this.m_Area.length) && (i < oldArea.length)); i++) {
this.m_Area[i] = oldArea[i];
this.m_Genotype[i] = oldProg[i];
GPArea[] oldArea = this.gpArea;
AbstractGPNode[] oldProg = this.genotype;
this.gpArea = new GPArea[length];
this.genotype = new AbstractGPNode[length];
for (int i = 0; ((i < this.gpArea.length) && (i < oldArea.length)); i++) {
this.gpArea[i] = oldArea[i];
this.genotype[i] = oldProg[i];
}
for (int i = oldArea.length; i < this.m_Area.length; i++) {
this.m_Area[i] = oldArea[oldArea.length - 1];
this.m_Genotype[i] = oldProg[oldProg.length - 1];
for (int i = oldArea.length; i < this.gpArea.length; i++) {
this.gpArea[i] = oldArea[oldArea.length - 1];
this.genotype[i] = oldProg[oldProg.length - 1];
}
}
@ -146,20 +143,20 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public InterfaceProgram[] getProgramData() {
this.m_Phenotype = new AbstractGPNode[this.m_Genotype.length];
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Phenotype[i] = (AbstractGPNode) this.m_Genotype[i].clone();
this.phenotype = new AbstractGPNode[this.genotype.length];
for (int i = 0; i < this.genotype.length; i++) {
this.phenotype[i] = (AbstractGPNode) this.genotype[i].clone();
// if (!phenotype[0].checkDepth(0)) {
// System.err.println("error... " + genotype[0].checkDepth(0));
// }
if ((this.m_CheckMaxDepth) && (this.m_Phenotype[i].isMaxDepthViolated(this.m_maxAllowedDepth))) {
System.err.println("Trying to meet the Target Depth! " + this.m_Phenotype[i].isMaxDepthViolated(this.m_maxAllowedDepth) + " " + m_Phenotype[i].getMaxDepth());
this.m_Phenotype[i].repairMaxDepth(this.m_Area[i], this.m_maxAllowedDepth);
if ((this.checkMaxDepth) && (this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth))) {
System.err.println("Trying to meet the Target Depth! " + this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth) + " " + phenotype[i].getMaxDepth());
this.phenotype[i].repairMaxDepth(this.gpArea[i], this.maxAllowedDepth);
//System.out.println("TragetDepth: " + this.m_TargetDepth + " : " + this.m_Program.getMaxDepth());
}
}
return this.m_Phenotype;
return this.phenotype;
}
/**
@ -170,10 +167,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public InterfaceProgram[] getProgramDataWithoutUpdate() {
if (this.m_Phenotype == null) {
if (this.phenotype == null) {
return getProgramData();
} else {
return this.m_Phenotype;
return this.phenotype;
}
}
@ -185,9 +182,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
@Override
public void SetProgramPhenotype(InterfaceProgram[] program) {
if (program instanceof AbstractGPNode[]) {
this.m_Phenotype = new AbstractGPNode[program.length];
for (int i = 0; i < this.m_Phenotype.length; i++) {
this.m_Phenotype[i] = (AbstractGPNode) ((AbstractGPNode) program[i]).clone();
this.phenotype = new AbstractGPNode[program.length];
for (int i = 0; i < this.phenotype.length; i++) {
this.phenotype[i] = (AbstractGPNode) ((AbstractGPNode) program[i]).clone();
}
}
}
@ -201,9 +198,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
public void SetProgramGenotype(InterfaceProgram[] program) {
this.SetProgramPhenotype(program);
if (program instanceof AbstractGPNode[]) {
this.m_Genotype = new AbstractGPNode[program.length];
for (int i = 0; i < this.m_Genotype.length; i++) {
this.m_Genotype[i] = (AbstractGPNode) ((AbstractGPNode) program[i]).clone();
this.genotype = new AbstractGPNode[program.length];
for (int i = 0; i < this.genotype.length; i++) {
this.genotype[i] = (AbstractGPNode) ((AbstractGPNode) program[i]).clone();
}
}
}
@ -216,7 +213,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
@Override
public void SetFunctionArea(Object[] area) {
if (area instanceof GPArea[]) {
this.m_Area = (GPArea[]) area;
this.gpArea = (GPArea[]) area;
}
}
@ -227,7 +224,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public Object[] getFunctionArea() {
return this.m_Area;
return this.gpArea;
}
/************************************************************************************
@ -271,11 +268,11 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
result += this.selectionProbability[i] + ";";
}
result += "})\n Value: ";
for (int i = 0; i < this.m_Genotype.length; i++) {
if (this.m_Genotype[i] != null) {
result += this.m_Genotype[i].getStringRepresentation();
for (int i = 0; i < this.genotype.length; i++) {
if (this.genotype[i] != null) {
result += this.genotype[i].getStringRepresentation();
}
result += "\nUsing " + this.m_Genotype[i].getNumberOfNodes() + " nodes.";
result += "\nUsing " + this.genotype[i].getNumberOfNodes() + " nodes.";
}
return result;
}
@ -291,7 +288,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public AbstractGPNode[] getPGenotype() {
return this.m_Genotype;
return this.genotype;
}
/**
@ -301,8 +298,8 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public void setPGenotype(AbstractGPNode[] b) {
this.m_Genotype = b;
this.m_Phenotype = null;
this.genotype = b;
this.phenotype = null;
}
/**
@ -313,10 +310,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public void setPGenotype(AbstractGPNode b, int i) {
this.m_Genotype[i] = b;
m_Genotype[i].updateDepth(0);
this.genotype[i] = b;
genotype[i].updateDepth(0);
// System.out.println("Setting pheno of depth " + b.getMaxDepth() + " " + b.getStringRepresentation());
this.m_Phenotype = null;
this.phenotype = null;
}
/**
@ -324,52 +321,49 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
*/
@Override
public void defaultMutate() {
for (int i = 0; i < this.m_Genotype.length; i++) {
AbstractGPNode nodeToMutate = this.m_Genotype[i].getRandomNode();
for (int i = 0; i < this.genotype.length; i++) {
AbstractGPNode nodeToMutate = this.genotype[i].getRandomNode();
if (nodeToMutate.getParent() == null) { // mutate at root
this.defaultInit(null);
} else {
AbstractGPNode parent = nodeToMutate.getParent();
if (m_CheckMaxDepth && (nodeToMutate.getDepth() == m_maxAllowedDepth)) { // mutate with a constant
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.m_Area[i].getRandomNodeWithArity(0).clone()));
if (checkMaxDepth && (nodeToMutate.getDepth() == maxAllowedDepth)) { // mutate with a constant
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.gpArea[i].getRandomNodeWithArity(0).clone()));
newNode.setDepth(nodeToMutate.getDepth());
parent.setNode(newNode, nodeToMutate);
} else {
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.m_Area[i].getRandomNode().clone()));
AbstractGPNode newNode = (AbstractGPNode) (((AbstractGPNode) this.gpArea[i].getRandomNode().clone()));
newNode.setDepth(nodeToMutate.getDepth());
newNode.initGrow(this.m_Area[i], this.m_maxAllowedDepth);
newNode.initGrow(this.gpArea[i], this.maxAllowedDepth);
parent.setNode(newNode, nodeToMutate);
}
//if (!genotype[i].checkDepth(0) || (genotype[i].isMaxDepthViolated(m_maxAllowedDepth))) {
//if (!genotype[i].checkDepth(0) || (genotype[i].isMaxDepthViolated(maxAllowedDepth))) {
// System.err.println("Error in GPIndividualProgramData.defaultMutate!");
//}
}
}
m_Phenotype = null; // reset pheno
phenotype = null; // reset pheno
}
@Override
public void defaultInit(InterfaceOptimizationProblem prob) {
m_Phenotype = null; // reset pheno
for (int i = 0; i < this.m_Area.length; i++) {
if (this.m_Area[i] == null) {
phenotype = null; // reset pheno
for (int i = 0; i < this.gpArea.length; i++) {
if (this.gpArea[i] == null) {
EVAERROR.errorMsgOnce("Error in GPIndividualProgramData.defaultInit(): Area[" + i + "] == null !!");
} else {
this.m_Genotype[i] = (AbstractGPNode) (this.m_Area[i].getRandomNonTerminal()).clone();
this.m_Genotype[i].setDepth(0);
int targetDepth = RNG.randomInt(1, this.m_InitDepth);
if (RNG.flipCoin(this.m_InitFullGrowRatio)) {
this.m_Genotype[i].initFull(this.m_Area[i], targetDepth);
this.genotype[i] = (AbstractGPNode) (this.gpArea[i].getRandomNonTerminal()).clone();
this.genotype[i].setDepth(0);
int targetDepth = RNG.randomInt(1, this.initDepth);
if (RNG.flipCoin(this.initFullGrowRatio)) {
this.genotype[i].initFull(this.gpArea[i], targetDepth);
} else {
this.m_Genotype[i].initGrow(this.m_Area[i], targetDepth);
this.genotype[i].initGrow(this.gpArea[i], targetDepth);
}
}
}
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -381,26 +375,17 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return "GP individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GP individual suited to optimize Koza style program trees.";
}
/**
* This method will toggle between checking for max depth or not.
*
* @param b the Switch.
*/
public void setCheckMaxDepth(boolean b) {
this.m_CheckMaxDepth = b;
this.checkMaxDepth = b;
}
public boolean getCheckMaxDepth() {
return this.m_CheckMaxDepth;
return this.checkMaxDepth;
}
public String checkMaxDepthTipText() {
@ -419,11 +404,11 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
if (b > 1) {
b = 1;
}
this.m_InitFullGrowRatio = b;
this.initFullGrowRatio = b;
}
public double getInitFullGrowRatio() {
return this.m_InitFullGrowRatio;
return this.initFullGrowRatio;
}
public String initFullGrowRatioTipText() {
@ -436,15 +421,15 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* @param b The new init Depth of the GP Tree.
*/
public void setInitDepth(int b) {
if (b > this.m_maxAllowedDepth) {
if (b > this.maxAllowedDepth) {
System.out.println("Waring Init Depth will be set to Target Depth!");
b = this.m_maxAllowedDepth;
b = this.maxAllowedDepth;
}
this.m_InitDepth = b;
this.initDepth = b;
}
public int getInitDepth() {
return this.m_InitDepth;
return this.initDepth;
}
public String initDepthTipText() {
@ -457,12 +442,12 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* @param b The new target Depth of the GP Tree.
*/
public void setMaxAllowedDepth(int b) {
this.m_maxAllowedDepth = b;
this.maxAllowedDepth = b;
}
@Override
public int getMaxAllowedDepth() {
return this.m_maxAllowedDepth;
return this.maxAllowedDepth;
}
public String maxAllowedDepthTipText() {
@ -474,14 +459,14 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
}
public void updateDepth() {
for (int i = 0; i < m_Genotype.length; i++) {
m_Genotype[i].updateDepth(0);
for (int i = 0; i < genotype.length; i++) {
genotype[i].updateDepth(0);
}
}
public void checkDepth() {
for (int i = 0; i < m_Genotype.length; i++) {
m_Genotype[i].checkDepth(0);
for (int i = 0; i < genotype.length; i++) {
genotype[i].checkDepth(0);
}
}
}

View File

@ -6,21 +6,15 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateOBGAFlip;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.ArrayList;
/**
* This individual uses a permutation based genotype to code for
* permutations.
* <p>Title: EvA2</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
*
* @author planatsc
* @version 1.0
*/
@Description(text="This is a GA individual coding permutations.")
public class OBGAIndividualPermutationData extends AbstractEAIndividual implements InterfaceDataTypePermutation, InterfaceOBGAIndividual, java.io.Serializable {
int[][] phenotype;
@ -306,13 +300,4 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
public String getName() {
return "OBGA individual";
}
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a GA individual coding permutations.";
}
}

View File

@ -259,8 +259,6 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
return "Set the individual properties for the optimization";
}
/////////// for GUI
/**
* This method returns a string describing the optimization problem.
*

View File

@ -6,6 +6,7 @@ import java.io.Serializable;
import java.util.List;
import javax.swing.JButton;
@eva2.util.annotation.Description(text="Select statistical values to be calculated and tests to be performed.")
public class EvAStatisticalEvaluationParams implements Serializable {
private StringSelection singleStats = new StringSelection(StatsOnSingleDataSetEnum.mean, StatsOnSingleDataSetEnum.getInfoStrings());
@ -44,10 +45,6 @@ public class EvAStatisticalEvaluationParams implements Serializable {
return "Statistical evaluation parameters";
}
public String globalInfo() {
return "Select statistical values to be calculated and tests to be performed.";
}
public List<JButton> getAdditionalButtons() {
return additionalButtons;
}

View File

@ -27,9 +27,8 @@ import javax.swing.JOptionPane;
/**
* A selectable list of EvAJobs. Each job contains a OptimizationParameters instance and potentially
* statistical data.
*
* @author mkron
*/
@eva2.util.annotation.Description(text="Display a set of jobs consisting of a multi-run experiment.")
public class OptimizationJobList extends PropertySelectableList<OptimizationJob> implements Serializable, InterfaceTextListener {
List<InterfaceTextListener> listeners = null;
@ -42,11 +41,6 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
public String getName() {
return "Job Set";
}
public String globalInfo() {
return "Display a set of jobs consisting of a multi-run experiment.";
}
/**
* This adds a new job to the list.
*

View File

@ -8,6 +8,7 @@ import eva2.tools.EVAERROR;
import eva2.tools.SelectedTag;
import eva2.tools.Serializer;
import eva2.tools.StringSelection;
import eva2.util.annotation.Description;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -26,9 +27,9 @@ import java.util.logging.Logger;
* There is a switch called "output full data as text" which will be interpreted by AbstractStatistics showing
* all or only the selected entities.
*
* @author mkron
* @see AbstractStatistics
*/
@Description(text="Configure statistics and output of the optimization run. Changes to the data selection state will not take effect during a run.")
public class StatisticsParameter implements InterfaceStatisticsParameter, InterfaceNotifyOnInformers, Serializable {
private static final long serialVersionUID = -8681061379203108390L;
private static final Logger LOGGER = Logger.getLogger(StatisticsParameter.class.getName());
@ -147,10 +148,6 @@ public class StatisticsParameter implements InterfaceStatisticsParameter, Interf
return m_Name;
}
public static String globalInfo() {
return "Configure statistics and output of the optimization run. Changes to the data selection state will not take effect during a run.";
}
/**
*
*/

View File

@ -16,6 +16,7 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.Pair;
import eva2.tools.math.BayNet;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.io.BufferedWriter;
import java.io.File;
@ -41,9 +42,8 @@ import java.util.logging.Logger;
*
* @author seitz
*/
@Description(text="Basic implementation of the Bayesian Optimization Algorithm based on the works by Martin Pelikan and David E. Goldberg.")
public class BOA implements InterfaceOptimizer, java.io.Serializable {
// private static boolean TRACE = false;
private static final Logger LOGGER = Logger.getLogger(BOA.class.getName());
transient private InterfacePopulationChangedEventListener m_Listener = null;
private String m_Identifier = "BOA";
@ -81,16 +81,12 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
this.learningSetRatio = learningSetRatio;
this.resampleRatio = resampleRatio;
this.netFolder = outputFolder;
// this.printExtraOutput = printExtraOutput;
this.upperProbLimit = upperProbLimit;
this.lowerProbLimit = lowerProbLimit;
this.printEdgeRate = printEdgeRate;
this.printNetworks = printNetworks;
this.printMetrics = printMetrics;
this.printTimestamps = printTimestamps;
// if (printEdgeRate || printNetworks || printMetrics || printTimestamps) {
// this.printExtraOutput = true;
// }
}
public BOA(BOA b) {
@ -135,23 +131,6 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
return "Bayesian Optimization Algorithm";
}
public static String globalInfo() {
return "Basic implementation of the Bayesian Optimization Algorithm based on the works by Martin Pelikan and David E. Goldberg.";
}
public void hideHideable() {
// GenericObjectEditor
// .setHideProperty(this.getClass(), "population", true);
// GenericObjectEditor.setHideProperty(getClass(), "printNetworks",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printEdgeRate",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printMetrics",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printTimestamps",
// !printExtraOutput);
}
@Override
public void addPopulationChangedEventListener(
InterfacePopulationChangedEventListener ea) {
@ -715,23 +694,6 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
return new String[]{"learningRatio", "resamplingRatio"};
}
// public boolean isPrintExtraOutput() {
// return this.printExtraOutput;
// }
// public void setPrintExtraOutput(boolean b) {
// this.printExtraOutput = b;
// GenericObjectEditor.setHideProperty(getClass(), "printNetworks",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printEdgeRate",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printMetrics",
// !printExtraOutput);
// GenericObjectEditor.setHideProperty(getClass(), "printTimestamps",
// !printExtraOutput);
// }
// public String printExtraOutputTipText() {
// return "do you want to print extra output files";
// }
public boolean isPrintNetworks() {
return this.printNetworks;
}

View File

@ -18,6 +18,7 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR;
import eva2.tools.math.Mathematics;
import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import eva2.util.annotation.Parameter;
import java.util.Vector;
@ -30,6 +31,7 @@ import java.util.Vector;
* dynamically changing problems. If an individual reaches the age limit, it is
* doomed and replaced by the next challenge vector, even if its worse.
*/
@Description(text="Differential Evolution using a steady-state population scheme.")
public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serializable {
protected Population population = new Population();
@ -45,7 +47,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
@Parameter(name = "CR", description = "Crossover Rate")
private double crossoverRate = 0.6; // AKA CR
@Parameter(name = "Lambda", description = "Lambda")
@Parameter(name = "Lambda", description = "Enhance greediness through amplification of the differential vector to the best individual for DE2.")
private double lambda = 0.6;
private double m_Mt = 0.05;
@ -739,19 +741,6 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
return this.m_Identifier;
}
/**
* ********************************************************************************************************************
* These are for GUI
*/
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "Differential Evolution using a steady-state population scheme.";
}
/**
* This method will return a naming String
*
@ -845,10 +834,6 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
return this.lambda;
}
public String lambdaTipText() {
return "Enhance greediness through amplification of the differential vector to the best individual for DE2.";
}
/**
* In case of trig. mutation DE, the TMO is applied wit probability Mt
*

View File

@ -18,11 +18,7 @@ import eva2.util.annotation.Description;
* here it the plague factor which reduces the population size to tune from a
* global to a more local search. But you have to be careful with that else the
* GA might not converge. This is a implementation of Genetic Algorithms.
* Copyright: Copyright (c) 2003 Company: University of Tuebingen, Computer
* Architecture
*
*/
@Description(text="This is a basic generational Genetic Algorithm.")
public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializable {
@ -52,7 +48,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
@Override
public Object clone() {
return (Object) new GeneticAlgorithm(this);
return new GeneticAlgorithm(this);
}
@Override

View File

@ -1,80 +0,0 @@
package eva2.optimization.tools;
import eva2.tools.math.RNG;
/**
* Created by IntelliJ IDEA.
* User: streiche
* Date: 26.11.2004
* Time: 13:34:42
* To change this template use File | Settings | File Templates.
*/
public class GONamingBox {
static String[] m_Names = {"Aleksei",
"Aleksandr",
"Andrei",
"Shurik",
"Andryusha",
"Tolyar",
"Anton",
"Arkadiy",
"Artur",
"Averiy",
"Borya",
"Boris",
"Dmitriy",
"Edik",
"Filipp",
"Fyodor",
"Gennadiy",
"Georgiy",
"Grigoriy",
"Igor",
"Il'ya",
"Innokentiy",
"Kirill",
"Ivan",
"Kirill",
"Konstantin",
"Leonid",
"Lev",
"Maksim",
"Mark",
"Mihail",
"Nikolai",
"Kolya",
"Oleg",
"Pavel",
"Pasha",
"Pyotr",
"Rodion",
"Rodya",
"Roman",
"Ruslan",
"Rustam",
"Semyon",
"Sergei",
"Stanislav",
"Stepan",
"Svyatoslav",
"Timofei",
"Vadim",
"Seryoga",
"Valentin",
"Valeriy",
"Vasiliy",
"Viktor",
"Vitaliy",
"Vladimir",
"Vladislav",
"Vyacheslav",
"Yaroslav",
"Yegor",
"Yevgeniy",
"Yuriy"};
public static String getRandomName() {
return new String(m_Names[RNG.randomInt(0, m_Names.length - 1)]);
}
}