Lots of cleanup.

This commit is contained in:
Fabian Becker 2014-01-17 10:48:42 +01:00
parent 024279899c
commit f7b31611c2
6 changed files with 100 additions and 151 deletions

View File

@ -11,6 +11,7 @@ import eva2.optimization.population.Population;
import eva2.optimization.population.SolutionSet; import eva2.optimization.population.SolutionSet;
import eva2.optimization.problems.B1Problem; import eva2.optimization.problems.B1Problem;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
/** /**
* Evolution strategies by Rechenberg and Schwefel, but please remember that * Evolution strategies by Rechenberg and Schwefel, but please remember that
@ -20,13 +21,9 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
* population size in constrast to the parameters mu and lambda used by * population size in constrast to the parameters mu and lambda used by
* Rechenberg and Schwefel. Therefore, i'm afraid that the interpretation of the * Rechenberg and Schwefel. Therefore, i'm afraid that the interpretation of the
* population size may be subject to future changes. This is a implementation of * population size may be subject to future changes. This is a implementation of
* Evolution Strategies. Copyright: Copyright (c) 2003 Company: University of * Evolution Strategies.
* Tuebingen, Computer Architecture
*
* @author Felix Streichert
* @version: $Revision: 307 $ $Date: 2007-12-04 14:31:47 +0100 (Tue, 04 Dec
* 2007) $ $Author: mkron $
*/ */
@Description(value = "This is an Evolution Strategy. Note that the population size depends on mu (number of parents) and lambda (number of offspring)")
public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializable { public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializable {
protected int mu = 5; protected int mu = 5;
@ -342,14 +339,6 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
/** /**
* These are for GUI * These are for GUI
*/ */
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "This is an Evolution Strategy. Note that the population size depends on mu (number of parents) and lambda (number of offspring).";
}
public String[] customPropertyOrder() { public String[] customPropertyOrder() {
return new String[]{"mu", "lambda"}; return new String[]{"mu", "lambda"};

View File

@ -8,39 +8,32 @@ import eva2.optimization.population.Population;
import eva2.optimization.population.SolutionSet; import eva2.optimization.population.SolutionSet;
import eva2.optimization.problems.B1Problem; import eva2.optimization.problems.B1Problem;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
/** /**
* This is a Multi-Start Hill-Climber, here the population size gives the number * This is a Multi-Start Hill-Climber, here the population size gives the number
* of multi-starts. Similar to the evolutionary programming strategy this * of multi-starts. Similar to the evolutionary programming strategy this
* strategy sets the mutation rate temporarily to 1.0. Copyright: Copyright (c) * strategy sets the mutation rate temporarily to 1.0.
* 2003 Company: University of Tuebingen, Computer Architecture
*
* @author Felix Streichert
* @version: $Revision: 307 $ $Date: 2007-12-04 14:31:47 +0100 (Tue, 04 Dec
* 2007) $ $Author: mkron $
*/ */
@Description("The Hill Climber uses the default EA mutation and initializing operators. If the population size is bigger than one a multi-start Hill Climber is performed.")
public class HillClimbing implements InterfaceOptimizer, java.io.Serializable { public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
// These variables are necessary for the simple testcase // These variables are necessary for the simple testcase
private InterfaceOptimizationProblem m_Problem = new B1Problem(); private InterfaceOptimizationProblem optimizationProblem = new B1Problem();
private InterfaceMutation mutator = null; private InterfaceMutation mutator = null;
// private int m_MultiRuns = 100;
// private int maxFitnessCalls = 100;
// private int m_FitnessCallsNeeded = 0;
// GAIndividualBinaryData m_Best, m_Test;
// These variables are necessary for the more complex LectureGUI enviroment // These variables are necessary for the more complex LectureGUI enviroment
transient private String m_Identifier = ""; transient private String identifier = "";
transient private InterfacePopulationChangedEventListener m_Listener; transient private InterfacePopulationChangedEventListener populationChangedEventListener;
private Population m_Population; private Population population;
public HillClimbing() { public HillClimbing() {
this.m_Population = new Population(); this.population = new Population();
this.m_Population.setTargetSize(10); this.population.setTargetSize(10);
} }
public HillClimbing(HillClimbing a) { public HillClimbing(HillClimbing a) {
this.m_Population = (Population) a.m_Population.clone(); this.population = (Population) a.population.clone();
this.m_Problem = (InterfaceOptimizationProblem) a.m_Problem.clone(); this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
} }
@Override @Override
@ -49,21 +42,21 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
} }
/** /**
* This method will init the HillClimber * This method will initialize the HillClimber
*/ */
@Override @Override
public void init() { public void init() {
this.m_Problem.initializePopulation(this.m_Population); this.optimizationProblem.initializePopulation(this.population);
this.m_Problem.evaluate(this.m_Population); this.optimizationProblem.evaluate(this.population);
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} }
@Override @Override
public void initByPopulation(Population pop, boolean reset) { public void initByPopulation(Population pop, boolean reset) {
this.m_Population = (Population) pop.clone(); this.population = (Population) pop.clone();
if (reset) { if (reset) {
this.m_Population.init(); this.population.init();
this.m_Problem.evaluate(this.m_Population); this.optimizationProblem.evaluate(this.population);
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} }
} }
@ -74,12 +67,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
@Override @Override
public void optimize() { public void optimize() {
AbstractEAIndividual indy; AbstractEAIndividual indy;
Population original = (Population) this.m_Population.clone(); Population original = (Population) this.population.clone();
double tmpD; double tmpD;
InterfaceMutation tmpMut; InterfaceMutation tmpMut;
for (int i = 0; i < this.m_Population.size(); i++) { for (int i = 0; i < this.population.size(); i++) {
indy = ((AbstractEAIndividual) this.m_Population.get(i)); indy = ((AbstractEAIndividual) this.population.get(i));
tmpD = indy.getMutationProbability(); tmpD = indy.getMutationProbability();
indy.setMutationProbability(1.0); indy.setMutationProbability(1.0);
if (mutator == null) { if (mutator == null) {
@ -89,17 +82,17 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
} }
indy.setMutationProbability(tmpD); indy.setMutationProbability(tmpD);
} }
this.m_Problem.evaluate(this.m_Population); this.optimizationProblem.evaluate(this.population);
for (int i = 0; i < this.m_Population.size(); i++) { for (int i = 0; i < this.population.size(); i++) {
if (((AbstractEAIndividual) original.get(i)).isDominatingDebConstraints(((AbstractEAIndividual) this.m_Population.get(i)))) { if (((AbstractEAIndividual) original.get(i)).isDominatingDebConstraints(((AbstractEAIndividual) this.population.get(i)))) {
// this.population.remove(i); // this.population.remove(i);
// throw away mutated one and replace by old one // throw away mutated one and replace by old one
this.m_Population.set(i, original.get(i)); this.population.set(i, original.get(i));
} else { } else {
// else: mutation improved the individual, so leave the new one // else: mutation improved the individual, so leave the new one
} }
} }
this.m_Population.incrGeneration(); this.population.incrGeneration();
// for (int i = 0; i < this.population.size(); i++) { // for (int i = 0; i < this.population.size(); i++) {
// indy1 = (AbstractEAIndividual) this.population.get(i); // indy1 = (AbstractEAIndividual) this.population.get(i);
// indy2 = (AbstractEAIndividual)(indy1).clone(); // indy2 = (AbstractEAIndividual)(indy1).clone();
@ -139,12 +132,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void setProblem(InterfaceOptimizationProblem problem) { public void setProblem(InterfaceOptimizationProblem problem) {
this.m_Problem = problem; this.optimizationProblem = problem;
} }
@Override @Override
public InterfaceOptimizationProblem getProblem() { public InterfaceOptimizationProblem getProblem() {
return this.m_Problem; return this.optimizationProblem;
} }
// /** This method will init the HillClimber // /** This method will init the HillClimber
@ -191,14 +184,14 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
this.m_Listener = ea; this.populationChangedEventListener = ea;
} }
@Override @Override
public boolean removePopulationChangedEventListener( public boolean removePopulationChangedEventListener(
InterfacePopulationChangedEventListener ea) { InterfacePopulationChangedEventListener ea) {
if (m_Listener == ea) { if (populationChangedEventListener == ea) {
m_Listener = null; populationChangedEventListener = null;
return true; return true;
} else { } else {
return false; return false;
@ -209,8 +202,8 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
* Something has changed * Something has changed
*/ */
protected void firePropertyChangedEvent(String name) { protected void firePropertyChangedEvent(String name) {
if (this.m_Listener != null) { if (this.populationChangedEventListener != null) {
this.m_Listener.registerPopulationStateChanged(this, name); this.populationChangedEventListener.registerPopulationStateChanged(this, name);
} }
} }
@ -223,14 +216,14 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
@Override @Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
if (this.m_Population.size() > 1) { if (this.population.size() > 1) {
result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n"; result += "Multi(" + this.population.size() + ")-Start Hill Climbing:\n";
} else { } else {
result += "Hill Climbing:\n"; result += "Hill Climbing:\n";
} }
result += "Optimization Problem: "; result += "Optimization Problem: ";
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n"; result += this.optimizationProblem.getStringRepresentationForProblem(this) + "\n";
result += this.m_Population.getStringRepresentation(); result += this.population.getStringRepresentation();
return result; return result;
} }
@ -241,26 +234,18 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void setIdentifier(String name) { public void setIdentifier(String name) {
this.m_Identifier = name; this.identifier = name;
} }
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return this.m_Identifier; return this.identifier;
} }
/** /**
* ******************************************************************************************************************** * ********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/**
* This method returns a global info string
*
* @return description
*/
public static String globalInfo() {
return "The Hill Climber uses the default EA mutation and initializing operators. If the population size is bigger than one a multi-start Hill Climber is performed.";
}
/** /**
* This method will return a naming String * This method will return a naming String
@ -274,12 +259,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
@Override @Override
public Population getPopulation() { public Population getPopulation() {
return this.m_Population; return this.population;
} }
@Override @Override
public void setPopulation(Population pop) { public void setPopulation(Population pop) {
this.m_Population = pop; this.population = pop;
} }
@Override @Override

View File

@ -9,16 +9,7 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
/** /**
* The general interface for optimizers giving the main methods necessary * The general interface for optimizers giving the main methods necessary
* to perform a population based search. * to perform a population based search.
* This is a simple implementation of Population Based Incremental Learning.
* 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 $
*/ */
public interface InterfaceOptimizer { public interface InterfaceOptimizer {
/** /**
@ -106,7 +97,7 @@ public interface InterfaceOptimizer {
* This method will set the problem that is to be optimized. The problem * This method will set the problem that is to be optimized. The problem
* should be initialized when this method is called. * should be initialized when this method is called.
* *
* @param problem * @param problem The optimization problem.
*/ */
void setProblem(InterfaceOptimizationProblem problem); void setProblem(InterfaceOptimizationProblem problem);

View File

@ -22,6 +22,7 @@ import eva2.tools.Pair;
import eva2.tools.SelectedTag; import eva2.tools.SelectedTag;
import eva2.tools.math.Mathematics; import eva2.tools.math.Mathematics;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import eva2.util.annotation.Description;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,12 +36,12 @@ import java.util.ArrayList;
* values in the reference set or as an absolute value (in both cases only the * values in the reference set or as an absolute value (in both cases only the
* first fitness criterion is regarded). * first fitness criterion is regarded).
* *
* @author mkron
* <p/> * <p/>
* [1] M.Rodiguez-Fernandez, J.Egea, J.Banga: Novel metaheuristic for parameter * [1] M.Rodiguez-Fernandez, J.Egea, J.Banga: Novel metaheuristic for parameter
* estimation in nonlinear dynamic biological systems. BMC Bioinformatics 2006, * estimation in nonlinear dynamic biological systems. BMC Bioinformatics 2006,
* 7:483. BioMed Central 2006. * 7:483. BioMed Central 2006.
*/ */
@Description("A scatter search variant after Rodiguez-Fernandez, J.Egea and J.Banga: Novel metaheuristic for parameter estimation in nonlinear dynamic biological systems, BMC Bioinf. 2006")
public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, InterfacePopulationChangedEventListener { public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable, InterfacePopulationChangedEventListener {
transient private InterfacePopulationChangedEventListener m_Listener = null; transient private InterfacePopulationChangedEventListener m_Listener = null;
@ -64,11 +65,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
private int generationCycle = 50; private int generationCycle = 50;
private int fitCrit = -1; private int fitCrit = -1;
protected boolean checkRange = true; protected boolean checkRange = true;
// private int lastLocalSearch = -1;
// // nr of generations between local searches
// protected int localSearchInterval = 10;
// below this threshold a local search will be performed
// protected double fitThreshLocalSearch = 1000.;
protected boolean doLocalSearch = false; protected boolean doLocalSearch = false;
private boolean relativeFitCriterion = false; private boolean relativeFitCriterion = false;
private double nelderMeadInitPerturbation = 0.01; private double nelderMeadInitPerturbation = 0.01;
@ -430,9 +426,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
Population hcPop = new Population(1); Population hcPop = new Population(1);
hcPop.add(cand); hcPop.add(cand);
int stepsDone = PostProcess.processWithHC(hcPop, problem, hcSteps); int stepsDone = PostProcess.processWithHC(hcPop, problem, hcSteps);
// if (TRACE) {
// System.out.println("local search result: from " + BeanInspector.toString(fitBefore) + " to " + BeanInspector.toString(hcPop.getEAIndividual(0).getFitness()));
// }
return new Pair<AbstractEAIndividual, Integer>(hcPop.getEAIndividual(0), stepsDone); return new Pair<AbstractEAIndividual, Integer>(hcPop.getEAIndividual(0), stepsDone);
} }
@ -455,7 +448,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
* *
* @param cand * @param cand
* @param popCompGeno * @param popCompGeno
* @param popCompPheno * @param popComPheno
* @return * @return
*/ */
private boolean diversityCriterionFulfilled(AbstractEAIndividual cand, Population popCompGeno, Population popComPheno) { private boolean diversityCriterionFulfilled(AbstractEAIndividual cand, Population popCompGeno, Population popComPheno) {
@ -782,10 +775,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
return "ScatterSearch"; return "ScatterSearch";
} }
public static String globalInfo() {
return "A scatter search variant after Rodiguez-Fernandez, J.Egea and J.Banga: Novel metaheuristic for parameter estimation in nonlinear dynamic biological systems, BMC Bioinf. 2006";
}
private boolean useLSHC() { private boolean useLSHC() {
return localSearchMethod.getSelectedTagID() == 0; return localSearchMethod.getSelectedTagID() == 0;
} }

View File

@ -9,8 +9,6 @@ import eva2.optimization.operator.paramcontrol.ParamAdaption;
* A thunk class preconfiguring CBN-EA to function as a sequential niching method. This * A thunk class preconfiguring CBN-EA to function as a sequential niching method. This
* is to be comparable to parallel and semi-sequential niching (esp. using the same convergence * is to be comparable to parallel and semi-sequential niching (esp. using the same convergence
* criterion). * criterion).
*
* @author mkron
*/ */
public class SqPSO extends ClusterBasedNichingEA { public class SqPSO extends ClusterBasedNichingEA {
public SqPSO() { public SqPSO() {
@ -32,12 +30,9 @@ public class SqPSO extends ClusterBasedNichingEA {
setOptimizer(new ParticleSwarmOptimization(popSize, 2.05, 2.05, PSOTopologyEnum.grid, 2)); setOptimizer(new ParticleSwarmOptimization(popSize, 2.05, 2.05, PSOTopologyEnum.grid, 2));
ParamAdaption[] defAdpt = new ParamAdaption[]{}; ParamAdaption[] defAdpt = new ParamAdaption[]{};
setParameterControl(defAdpt); setParameterControl(defAdpt);
// if (threshAdaption) addParameterControl(getDefaultThreshAdaption());
setPopulationSize(popSize); setPopulationSize(popSize);
} }
// public void hideHideable()
@Override @Override
public String getName() { public String getName() {
return "SqPSO"; return "SqPSO";

View File

@ -22,26 +22,26 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
*/ */
public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable { public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
private Population m_Population = new Population(); private Population population = new Population();
private InterfaceOptimizationProblem m_Problem = new B1Problem(); private InterfaceOptimizationProblem optimizationProblem = new B1Problem();
private InterfaceSelection m_ParentSelection = new SelectTournament(); private InterfaceSelection parentSelection = new SelectTournament();
private InterfaceSelection m_PartnerSelection = new SelectTournament(); private InterfaceSelection partnerSelection = new SelectTournament();
private InterfaceReplacement m_ReplacementSelection = new ReplaceWorst(); private InterfaceReplacement replacementSelection = new ReplaceWorst();
private int m_NumberOfPartners = 1; private int numberOfPartners = 1;
private String m_Identifier = ""; private String identifier = "";
transient private InterfacePopulationChangedEventListener m_Listener; transient private InterfacePopulationChangedEventListener populationChangedEventListener;
public SteadyStateGA() { public SteadyStateGA() {
} }
public SteadyStateGA(SteadyStateGA a) { public SteadyStateGA(SteadyStateGA a) {
this.m_Population = (Population) a.m_Population.clone(); this.population = (Population) a.population.clone();
this.m_Problem = (InterfaceOptimizationProblem) a.m_Problem.clone(); this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
this.m_Identifier = a.m_Identifier; this.identifier = a.identifier;
this.m_NumberOfPartners = a.m_NumberOfPartners; this.numberOfPartners = a.numberOfPartners;
this.m_ParentSelection = (InterfaceSelection) a.m_ParentSelection.clone(); this.parentSelection = (InterfaceSelection) a.parentSelection.clone();
this.m_PartnerSelection = (InterfaceSelection) a.m_PartnerSelection.clone(); this.partnerSelection = (InterfaceSelection) a.partnerSelection.clone();
this.m_ReplacementSelection = (InterfaceReplacement) a.m_ReplacementSelection.clone(); this.replacementSelection = (InterfaceReplacement) a.replacementSelection.clone();
} }
@Override @Override
@ -51,8 +51,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
@Override @Override
public void init() { public void init() {
this.m_Problem.initializePopulation(this.m_Population); this.optimizationProblem.initializePopulation(this.population);
this.evaluatePopulation(this.m_Population); this.evaluatePopulation(this.population);
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} }
@ -63,10 +63,10 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void initByPopulation(Population pop, boolean reset) { public void initByPopulation(Population pop, boolean reset) {
this.m_Population = (Population) pop.clone(); this.population = (Population) pop.clone();
if (reset) { if (reset) {
this.m_Population.init(); this.population.init();
this.evaluatePopulation(this.m_Population); this.evaluatePopulation(this.population);
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} }
} }
@ -77,7 +77,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
* @param population The population that is to be evaluated * @param population The population that is to be evaluated
*/ */
private void evaluatePopulation(Population population) { private void evaluatePopulation(Population population) {
this.m_Problem.evaluate(population); this.optimizationProblem.evaluate(population);
population.incrGeneration(); population.incrGeneration();
} }
@ -102,37 +102,37 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
* population of evaluated individuals. * population of evaluated individuals.
*/ */
private void generateChildren() { private void generateChildren() {
this.m_ParentSelection.prepareSelection(this.m_Population); this.parentSelection.prepareSelection(this.population);
this.m_PartnerSelection.prepareSelection(this.m_Population); this.partnerSelection.prepareSelection(this.population);
Population parents = this.m_ParentSelection.selectFrom(this.m_Population, 1); Population parents = this.parentSelection.selectFrom(this.population, 1);
AbstractEAIndividual mother = (AbstractEAIndividual) parents.get(0); AbstractEAIndividual mother = (AbstractEAIndividual) parents.get(0);
parents = this.m_PartnerSelection.findPartnerFor(mother, this.m_Population, this.m_NumberOfPartners); parents = this.partnerSelection.findPartnerFor(mother, this.population, this.numberOfPartners);
AbstractEAIndividual[] offSprings = mother.mateWith(parents); AbstractEAIndividual[] offSprings = mother.mateWith(parents);
offSprings[0].mutate(); offSprings[0].mutate();
this.m_Problem.evaluate(offSprings[0]); this.optimizationProblem.evaluate(offSprings[0]);
this.m_ReplacementSelection.insertIndividual(offSprings[0], this.m_Population, parents); this.replacementSelection.insertIndividual(offSprings[0], this.population, parents);
} }
@Override @Override
public void optimize() { public void optimize() {
for (int i = 0; i < this.m_Population.size(); i++) { for (int i = 0; i < this.population.size(); i++) {
this.generateChildren(); this.generateChildren();
} }
this.m_Population.incrFunctionCallsBy(this.m_Population.size()); this.population.incrFunctionCallsBy(this.population.size());
this.m_Population.incrGeneration(); this.population.incrGeneration();
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} }
@Override @Override
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
this.m_Listener = ea; this.populationChangedEventListener = ea;
} }
@Override @Override
public boolean removePopulationChangedEventListener( public boolean removePopulationChangedEventListener(
InterfacePopulationChangedEventListener ea) { InterfacePopulationChangedEventListener ea) {
if (m_Listener == ea) { if (populationChangedEventListener == ea) {
m_Listener = null; populationChangedEventListener = null;
return true; return true;
} else { } else {
return false; return false;
@ -140,8 +140,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
} }
protected void firePropertyChangedEvent(String name) { protected void firePropertyChangedEvent(String name) {
if (this.m_Listener != null) { if (this.populationChangedEventListener != null) {
this.m_Listener.registerPopulationStateChanged(this, name); this.populationChangedEventListener.registerPopulationStateChanged(this, name);
} }
} }
@ -152,12 +152,12 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void setProblem(InterfaceOptimizationProblem problem) { public void setProblem(InterfaceOptimizationProblem problem) {
this.m_Problem = problem; this.optimizationProblem = problem;
} }
@Override @Override
public InterfaceOptimizationProblem getProblem() { public InterfaceOptimizationProblem getProblem() {
return this.m_Problem; return this.optimizationProblem;
} }
/** /**
@ -171,8 +171,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
String result = ""; String result = "";
result += "Genetic Algorithm:\n"; result += "Genetic Algorithm:\n";
result += "Optimization Problem: "; result += "Optimization Problem: ";
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n"; result += this.optimizationProblem.getStringRepresentationForProblem(this) + "\n";
result += this.m_Population.getStringRepresentation(); result += this.population.getStringRepresentation();
return result; return result;
} }
@ -183,12 +183,12 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
*/ */
@Override @Override
public void setIdentifier(String name) { public void setIdentifier(String name) {
this.m_Identifier = name; this.identifier = name;
} }
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return this.m_Identifier; return this.identifier;
} }
/** /**
@ -215,20 +215,20 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
} }
/** /**
* Assuming that all optimizer will store thier data in a population we will * Assuming that all optimizers will store their data in a population we will
* allow acess to this population to query to current state of the * allow access to this population to query to current state of the
* optimizer. * optimizer.
* *
* @return The population of current solutions to a given problem. * @return The population of current solutions to a given problem.
*/ */
@Override @Override
public Population getPopulation() { public Population getPopulation() {
return this.m_Population; return this.population;
} }
@Override @Override
public void setPopulation(Population pop) { public void setPopulation(Population pop) {
this.m_Population = pop; this.population = pop;
} }
public String populationTipText() { public String populationTipText() {
@ -246,11 +246,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
* @param selection * @param selection
*/ */
public void setParentSelection(InterfaceSelection selection) { public void setParentSelection(InterfaceSelection selection) {
this.m_ParentSelection = selection; this.parentSelection = selection;
} }
public InterfaceSelection getParentSelection() { public InterfaceSelection getParentSelection() {
return this.m_ParentSelection; return this.parentSelection;
} }
public String parentSelectionTipText() { public String parentSelectionTipText() {
@ -267,11 +267,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
if (partners < 0) { if (partners < 0) {
partners = 0; partners = 0;
} }
this.m_NumberOfPartners = partners; this.numberOfPartners = partners;
} }
public int getNumberOfPartners() { public int getNumberOfPartners() {
return this.m_NumberOfPartners; return this.numberOfPartners;
} }
public String numberOfPartnersTipText() { public String numberOfPartnersTipText() {
@ -285,11 +285,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
* @param selection * @param selection
*/ */
public void setPartnerSelection(InterfaceSelection selection) { public void setPartnerSelection(InterfaceSelection selection) {
this.m_PartnerSelection = selection; this.partnerSelection = selection;
} }
public InterfaceSelection getPartnerSelection() { public InterfaceSelection getPartnerSelection() {
return this.m_PartnerSelection; return this.partnerSelection;
} }
public String partnerSelectionTipText() { public String partnerSelectionTipText() {
@ -302,11 +302,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
* @param selection * @param selection
*/ */
public void setReplacementSelection(InterfaceReplacement selection) { public void setReplacementSelection(InterfaceReplacement selection) {
this.m_ReplacementSelection = selection; this.replacementSelection = selection;
} }
public InterfaceReplacement getReplacementSelection() { public InterfaceReplacement getReplacementSelection() {
return this.m_ReplacementSelection; return this.replacementSelection;
} }
public String replacementSelectionTipText() { public String replacementSelectionTipText() {