Lots of cleanup.
This commit is contained in:
parent
024279899c
commit
f7b31611c2
@ -11,6 +11,7 @@ import eva2.optimization.population.Population;
|
||||
import eva2.optimization.population.SolutionSet;
|
||||
import eva2.optimization.problems.B1Problem;
|
||||
import eva2.optimization.problems.InterfaceOptimizationProblem;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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
|
||||
* Evolution Strategies. Copyright: Copyright (c) 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 $
|
||||
* Evolution Strategies.
|
||||
*/
|
||||
@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 {
|
||||
|
||||
protected int mu = 5;
|
||||
@ -342,14 +339,6 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
|
||||
/**
|
||||
* 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() {
|
||||
return new String[]{"mu", "lambda"};
|
||||
|
@ -8,39 +8,32 @@ import eva2.optimization.population.Population;
|
||||
import eva2.optimization.population.SolutionSet;
|
||||
import eva2.optimization.problems.B1Problem;
|
||||
import eva2.optimization.problems.InterfaceOptimizationProblem;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* This is a Multi-Start Hill-Climber, here the population size gives the number
|
||||
* of multi-starts. Similar to the evolutionary programming strategy this
|
||||
* strategy sets the mutation rate temporarily to 1.0. Copyright: Copyright (c)
|
||||
* 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 $
|
||||
* strategy sets the mutation rate temporarily to 1.0.
|
||||
*/
|
||||
@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 {
|
||||
// These variables are necessary for the simple testcase
|
||||
|
||||
private InterfaceOptimizationProblem m_Problem = new B1Problem();
|
||||
private InterfaceOptimizationProblem optimizationProblem = new B1Problem();
|
||||
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
|
||||
transient private String m_Identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener m_Listener;
|
||||
private Population m_Population;
|
||||
transient private String identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener populationChangedEventListener;
|
||||
private Population population;
|
||||
|
||||
public HillClimbing() {
|
||||
this.m_Population = new Population();
|
||||
this.m_Population.setTargetSize(10);
|
||||
this.population = new Population();
|
||||
this.population.setTargetSize(10);
|
||||
}
|
||||
|
||||
public HillClimbing(HillClimbing a) {
|
||||
this.m_Population = (Population) a.m_Population.clone();
|
||||
this.m_Problem = (InterfaceOptimizationProblem) a.m_Problem.clone();
|
||||
this.population = (Population) a.population.clone();
|
||||
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
||||
}
|
||||
|
||||
@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
|
||||
public void init() {
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
this.optimizationProblem.evaluate(this.population);
|
||||
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initByPopulation(Population pop, boolean reset) {
|
||||
this.m_Population = (Population) pop.clone();
|
||||
this.population = (Population) pop.clone();
|
||||
if (reset) {
|
||||
this.m_Population.init();
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
this.population.init();
|
||||
this.optimizationProblem.evaluate(this.population);
|
||||
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||
}
|
||||
}
|
||||
@ -74,12 +67,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
@Override
|
||||
public void optimize() {
|
||||
AbstractEAIndividual indy;
|
||||
Population original = (Population) this.m_Population.clone();
|
||||
Population original = (Population) this.population.clone();
|
||||
double tmpD;
|
||||
InterfaceMutation tmpMut;
|
||||
|
||||
for (int i = 0; i < this.m_Population.size(); i++) {
|
||||
indy = ((AbstractEAIndividual) this.m_Population.get(i));
|
||||
for (int i = 0; i < this.population.size(); i++) {
|
||||
indy = ((AbstractEAIndividual) this.population.get(i));
|
||||
tmpD = indy.getMutationProbability();
|
||||
indy.setMutationProbability(1.0);
|
||||
if (mutator == null) {
|
||||
@ -89,17 +82,17 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
}
|
||||
indy.setMutationProbability(tmpD);
|
||||
}
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
for (int i = 0; i < this.m_Population.size(); i++) {
|
||||
if (((AbstractEAIndividual) original.get(i)).isDominatingDebConstraints(((AbstractEAIndividual) this.m_Population.get(i)))) {
|
||||
this.optimizationProblem.evaluate(this.population);
|
||||
for (int i = 0; i < this.population.size(); i++) {
|
||||
if (((AbstractEAIndividual) original.get(i)).isDominatingDebConstraints(((AbstractEAIndividual) this.population.get(i)))) {
|
||||
// this.population.remove(i);
|
||||
// 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: 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++) {
|
||||
// indy1 = (AbstractEAIndividual) this.population.get(i);
|
||||
// indy2 = (AbstractEAIndividual)(indy1).clone();
|
||||
@ -139,12 +132,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void setProblem(InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.optimizationProblem = problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.optimizationProblem;
|
||||
}
|
||||
|
||||
// /** This method will init the HillClimber
|
||||
@ -191,14 +184,14 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||
this.m_Listener = ea;
|
||||
this.populationChangedEventListener = ea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePopulationChangedEventListener(
|
||||
InterfacePopulationChangedEventListener ea) {
|
||||
if (m_Listener == ea) {
|
||||
m_Listener = null;
|
||||
if (populationChangedEventListener == ea) {
|
||||
populationChangedEventListener = null;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -209,8 +202,8 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
* Something has changed
|
||||
*/
|
||||
protected void firePropertyChangedEvent(String name) {
|
||||
if (this.m_Listener != null) {
|
||||
this.m_Listener.registerPopulationStateChanged(this, name);
|
||||
if (this.populationChangedEventListener != null) {
|
||||
this.populationChangedEventListener.registerPopulationStateChanged(this, name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,14 +216,14 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
@Override
|
||||
public String getStringRepresentation() {
|
||||
String result = "";
|
||||
if (this.m_Population.size() > 1) {
|
||||
result += "Multi(" + this.m_Population.size() + ")-Start Hill Climbing:\n";
|
||||
if (this.population.size() > 1) {
|
||||
result += "Multi(" + this.population.size() + ")-Start Hill Climbing:\n";
|
||||
} else {
|
||||
result += "Hill Climbing:\n";
|
||||
}
|
||||
result += "Optimization Problem: ";
|
||||
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.m_Population.getStringRepresentation();
|
||||
result += this.optimizationProblem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.population.getStringRepresentation();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -241,26 +234,18 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void setIdentifier(String name) {
|
||||
this.m_Identifier = name;
|
||||
this.identifier = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.m_Identifier;
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* ********************************************************************************************************************
|
||||
* 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
|
||||
@ -274,12 +259,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public Population getPopulation() {
|
||||
return this.m_Population;
|
||||
return this.population;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPopulation(Population pop) {
|
||||
this.m_Population = pop;
|
||||
this.population = pop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,16 +9,7 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
|
||||
/**
|
||||
* The general interface for optimizers giving the main methods necessary
|
||||
* 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 {
|
||||
|
||||
/**
|
||||
@ -106,7 +97,7 @@ public interface InterfaceOptimizer {
|
||||
* This method will set the problem that is to be optimized. The problem
|
||||
* should be initialized when this method is called.
|
||||
*
|
||||
* @param problem
|
||||
* @param problem The optimization problem.
|
||||
*/
|
||||
void setProblem(InterfaceOptimizationProblem problem);
|
||||
|
||||
|
@ -22,6 +22,7 @@ import eva2.tools.Pair;
|
||||
import eva2.tools.SelectedTag;
|
||||
import eva2.tools.math.Mathematics;
|
||||
import eva2.tools.math.RNG;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
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
|
||||
* first fitness criterion is regarded).
|
||||
*
|
||||
* @author mkron
|
||||
* <p/>
|
||||
* [1] M.Rodiguez-Fernandez, J.Egea, J.Banga: Novel metaheuristic for parameter
|
||||
* estimation in nonlinear dynamic biological systems. BMC Bioinformatics 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 {
|
||||
|
||||
transient private InterfacePopulationChangedEventListener m_Listener = null;
|
||||
@ -64,11 +65,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
||||
private int generationCycle = 50;
|
||||
private int fitCrit = -1;
|
||||
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;
|
||||
private boolean relativeFitCriterion = false;
|
||||
private double nelderMeadInitPerturbation = 0.01;
|
||||
@ -430,9 +426,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
||||
Population hcPop = new Population(1);
|
||||
hcPop.add(cand);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -455,7 +448,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
||||
*
|
||||
* @param cand
|
||||
* @param popCompGeno
|
||||
* @param popCompPheno
|
||||
* @param popComPheno
|
||||
* @return
|
||||
*/
|
||||
private boolean diversityCriterionFulfilled(AbstractEAIndividual cand, Population popCompGeno, Population popComPheno) {
|
||||
@ -782,10 +775,6 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
||||
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() {
|
||||
return localSearchMethod.getSelectedTagID() == 0;
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ import eva2.optimization.operator.paramcontrol.ParamAdaption;
|
||||
* 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
|
||||
* criterion).
|
||||
*
|
||||
* @author mkron
|
||||
*/
|
||||
public class SqPSO extends ClusterBasedNichingEA {
|
||||
public SqPSO() {
|
||||
@ -32,12 +30,9 @@ public class SqPSO extends ClusterBasedNichingEA {
|
||||
setOptimizer(new ParticleSwarmOptimization(popSize, 2.05, 2.05, PSOTopologyEnum.grid, 2));
|
||||
ParamAdaption[] defAdpt = new ParamAdaption[]{};
|
||||
setParameterControl(defAdpt);
|
||||
// if (threshAdaption) addParameterControl(getDefaultThreshAdaption());
|
||||
setPopulationSize(popSize);
|
||||
}
|
||||
|
||||
// public void hideHideable()
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "SqPSO";
|
||||
|
@ -22,26 +22,26 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
|
||||
*/
|
||||
public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
|
||||
private Population m_Population = new Population();
|
||||
private InterfaceOptimizationProblem m_Problem = new B1Problem();
|
||||
private InterfaceSelection m_ParentSelection = new SelectTournament();
|
||||
private InterfaceSelection m_PartnerSelection = new SelectTournament();
|
||||
private InterfaceReplacement m_ReplacementSelection = new ReplaceWorst();
|
||||
private int m_NumberOfPartners = 1;
|
||||
private String m_Identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener m_Listener;
|
||||
private Population population = new Population();
|
||||
private InterfaceOptimizationProblem optimizationProblem = new B1Problem();
|
||||
private InterfaceSelection parentSelection = new SelectTournament();
|
||||
private InterfaceSelection partnerSelection = new SelectTournament();
|
||||
private InterfaceReplacement replacementSelection = new ReplaceWorst();
|
||||
private int numberOfPartners = 1;
|
||||
private String identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener populationChangedEventListener;
|
||||
|
||||
public SteadyStateGA() {
|
||||
}
|
||||
|
||||
public SteadyStateGA(SteadyStateGA a) {
|
||||
this.m_Population = (Population) a.m_Population.clone();
|
||||
this.m_Problem = (InterfaceOptimizationProblem) a.m_Problem.clone();
|
||||
this.m_Identifier = a.m_Identifier;
|
||||
this.m_NumberOfPartners = a.m_NumberOfPartners;
|
||||
this.m_ParentSelection = (InterfaceSelection) a.m_ParentSelection.clone();
|
||||
this.m_PartnerSelection = (InterfaceSelection) a.m_PartnerSelection.clone();
|
||||
this.m_ReplacementSelection = (InterfaceReplacement) a.m_ReplacementSelection.clone();
|
||||
this.population = (Population) a.population.clone();
|
||||
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
||||
this.identifier = a.identifier;
|
||||
this.numberOfPartners = a.numberOfPartners;
|
||||
this.parentSelection = (InterfaceSelection) a.parentSelection.clone();
|
||||
this.partnerSelection = (InterfaceSelection) a.partnerSelection.clone();
|
||||
this.replacementSelection = (InterfaceReplacement) a.replacementSelection.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,8 +51,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||
}
|
||||
|
||||
@ -63,10 +63,10 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void initByPopulation(Population pop, boolean reset) {
|
||||
this.m_Population = (Population) pop.clone();
|
||||
this.population = (Population) pop.clone();
|
||||
if (reset) {
|
||||
this.m_Population.init();
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.population.init();
|
||||
this.evaluatePopulation(this.population);
|
||||
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
|
||||
*/
|
||||
private void evaluatePopulation(Population population) {
|
||||
this.m_Problem.evaluate(population);
|
||||
this.optimizationProblem.evaluate(population);
|
||||
population.incrGeneration();
|
||||
}
|
||||
|
||||
@ -102,37 +102,37 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
* population of evaluated individuals.
|
||||
*/
|
||||
private void generateChildren() {
|
||||
this.m_ParentSelection.prepareSelection(this.m_Population);
|
||||
this.m_PartnerSelection.prepareSelection(this.m_Population);
|
||||
Population parents = this.m_ParentSelection.selectFrom(this.m_Population, 1);
|
||||
this.parentSelection.prepareSelection(this.population);
|
||||
this.partnerSelection.prepareSelection(this.population);
|
||||
Population parents = this.parentSelection.selectFrom(this.population, 1);
|
||||
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);
|
||||
offSprings[0].mutate();
|
||||
this.m_Problem.evaluate(offSprings[0]);
|
||||
this.m_ReplacementSelection.insertIndividual(offSprings[0], this.m_Population, parents);
|
||||
this.optimizationProblem.evaluate(offSprings[0]);
|
||||
this.replacementSelection.insertIndividual(offSprings[0], this.population, parents);
|
||||
}
|
||||
|
||||
@Override
|
||||
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.m_Population.incrFunctionCallsBy(this.m_Population.size());
|
||||
this.m_Population.incrGeneration();
|
||||
this.population.incrFunctionCallsBy(this.population.size());
|
||||
this.population.incrGeneration();
|
||||
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||
this.m_Listener = ea;
|
||||
this.populationChangedEventListener = ea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePopulationChangedEventListener(
|
||||
InterfacePopulationChangedEventListener ea) {
|
||||
if (m_Listener == ea) {
|
||||
m_Listener = null;
|
||||
if (populationChangedEventListener == ea) {
|
||||
populationChangedEventListener = null;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -140,8 +140,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
}
|
||||
|
||||
protected void firePropertyChangedEvent(String name) {
|
||||
if (this.m_Listener != null) {
|
||||
this.m_Listener.registerPopulationStateChanged(this, name);
|
||||
if (this.populationChangedEventListener != null) {
|
||||
this.populationChangedEventListener.registerPopulationStateChanged(this, name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,12 +152,12 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void setProblem(InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.optimizationProblem = problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.optimizationProblem;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,8 +171,8 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
String result = "";
|
||||
result += "Genetic Algorithm:\n";
|
||||
result += "Optimization Problem: ";
|
||||
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.m_Population.getStringRepresentation();
|
||||
result += this.optimizationProblem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.population.getStringRepresentation();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -183,12 +183,12 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void setIdentifier(String name) {
|
||||
this.m_Identifier = name;
|
||||
this.identifier = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
* allow acess to this population to query to current state of the
|
||||
* Assuming that all optimizers will store their data in a population we will
|
||||
* allow access to this population to query to current state of the
|
||||
* optimizer.
|
||||
*
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
@Override
|
||||
public Population getPopulation() {
|
||||
return this.m_Population;
|
||||
return this.population;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPopulation(Population pop) {
|
||||
this.m_Population = pop;
|
||||
this.population = pop;
|
||||
}
|
||||
|
||||
public String populationTipText() {
|
||||
@ -246,11 +246,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
* @param selection
|
||||
*/
|
||||
public void setParentSelection(InterfaceSelection selection) {
|
||||
this.m_ParentSelection = selection;
|
||||
this.parentSelection = selection;
|
||||
}
|
||||
|
||||
public InterfaceSelection getParentSelection() {
|
||||
return this.m_ParentSelection;
|
||||
return this.parentSelection;
|
||||
}
|
||||
|
||||
public String parentSelectionTipText() {
|
||||
@ -267,11 +267,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
if (partners < 0) {
|
||||
partners = 0;
|
||||
}
|
||||
this.m_NumberOfPartners = partners;
|
||||
this.numberOfPartners = partners;
|
||||
}
|
||||
|
||||
public int getNumberOfPartners() {
|
||||
return this.m_NumberOfPartners;
|
||||
return this.numberOfPartners;
|
||||
}
|
||||
|
||||
public String numberOfPartnersTipText() {
|
||||
@ -285,11 +285,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
* @param selection
|
||||
*/
|
||||
public void setPartnerSelection(InterfaceSelection selection) {
|
||||
this.m_PartnerSelection = selection;
|
||||
this.partnerSelection = selection;
|
||||
}
|
||||
|
||||
public InterfaceSelection getPartnerSelection() {
|
||||
return this.m_PartnerSelection;
|
||||
return this.partnerSelection;
|
||||
}
|
||||
|
||||
public String partnerSelectionTipText() {
|
||||
@ -302,11 +302,11 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
* @param selection
|
||||
*/
|
||||
public void setReplacementSelection(InterfaceReplacement selection) {
|
||||
this.m_ReplacementSelection = selection;
|
||||
this.replacementSelection = selection;
|
||||
}
|
||||
|
||||
public InterfaceReplacement getReplacementSelection() {
|
||||
return this.m_ReplacementSelection;
|
||||
return this.replacementSelection;
|
||||
}
|
||||
|
||||
public String replacementSelectionTipText() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user