Adjust Crossover/Selection classes to annotations

This commit is contained in:
Fabian Becker 2014-01-24 00:42:58 +01:00
parent c4a3f41924
commit c84cd9e014
2 changed files with 8 additions and 33 deletions

View File

@ -5,24 +5,21 @@ import eva2.optimization.individuals.InterfaceESIndividual;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/** /**
* Default 1-point-Crossover on InterfaceESIndividual instances. * Default 1-point-Crossover on InterfaceESIndividual instances.
* <p/>
* User: streiche
* Date: 25.03.2003
* Time: 11:16:39
* To change this template use Options | File Templates.
*/ */
@Description("This is a discrete one-point crossover between m ES individuals.")
public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializable { public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializable {
private InterfaceOptimizationProblem m_OptimizationProblem; private InterfaceOptimizationProblem optimizationProblem;
public CrossoverESDefault() { public CrossoverESDefault() {
} }
public CrossoverESDefault(CrossoverESDefault c) { public CrossoverESDefault(CrossoverESDefault c) {
this.m_OptimizationProblem = c.m_OptimizationProblem; this.optimizationProblem = c.optimizationProblem;
} }
/** /**
@ -121,7 +118,7 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa
*/ */
@Override @Override
public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) {
this.m_OptimizationProblem = opt; this.optimizationProblem = opt;
} }
@Override @Override
@ -129,9 +126,6 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa
return this.getName(); return this.getName();
} }
/**********************************************************************************************************************
* These are for GUI
*/
/** /**
* This method allows the CommonJavaObjectEditorPanel to read the * This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
@ -141,13 +135,4 @@ public class CrossoverESDefault implements InterfaceCrossover, java.io.Serializa
public String getName() { public String getName() {
return "ES discrete one-point crossover"; return "ES discrete one-point crossover";
} }
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is a discrete one-point crossover between m ES individuals.";
}
} }

View File

@ -5,12 +5,15 @@ import eva2.optimization.operator.selection.probability.InterfaceSelectionProbab
import eva2.optimization.operator.selection.probability.SelProbStandard; import eva2.optimization.operator.selection.probability.SelProbStandard;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
/** /**
* The RouletteWheel selection requires a selection probability calculator. * The RouletteWheel selection requires a selection probability calculator.
* In case of multiple fitness values the selection * In case of multiple fitness values the selection
* criteria is selected randomly for each selection event. * criteria is selected randomly for each selection event.
*/ */
@Description("This method chooses individuals similar to the roulette wheel. The chance for each individual to be selected depends on the selection probability." +
"This is a single objective selecting method, it select with respect to a random criterion.")
public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Serializable { public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Serializable {
private transient TreeElement[] treeRoot = null; private transient TreeElement[] treeRoot = null;
@ -152,9 +155,6 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser
return this.selectFrom(avaiablePartners, size); return this.selectFrom(avaiablePartners, size);
} }
/**********************************************************************************************************************
* These are for GUI
*/
/** /**
* This method allows the CommonJavaObjectEditorPanel to read the * This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
@ -165,16 +165,6 @@ public class SelectXProbRouletteWheel implements InterfaceSelection, java.io.Ser
return "Roulette Wheel Selection"; return "Roulette Wheel Selection";
} }
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This method chooses individuals similar to the roulette wheel. The chance for each individual to be selected depends on the selection probability." +
"This is a single objective selecting method, it select with respect to a random criterion.";
}
/** /**
* This method will set the normation method that is to be used. * This method will set the normation method that is to be used.
* *