OptimizerFactory now contains several new methods.

This commit is contained in:
Andreas Dräger 2008-03-26 16:05:37 +00:00
parent cbc6992ac5
commit 83cd026722
3 changed files with 1214 additions and 772 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,102 +9,136 @@ import javaeva.server.go.tools.RandomNumberGenerator;
import java.util.BitSet; import java.util.BitSet;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA. User: streiche Date: 03.04.2003 Time: 10:34:17 To
* User: streiche * change this template use Options | File Templates.
* Date: 03.04.2003
* Time: 10:34:17
* To change this template use Options | File Templates.
*/ */
public class CrossoverGADefault implements InterfaceCrossover, java.io.Serializable { public class CrossoverGADefault implements InterfaceCrossover,
private InterfaceOptimizationProblem m_OptimizationProblem; java.io.Serializable {
private InterfaceOptimizationProblem m_OptimizationProblem;
public CrossoverGADefault() { public CrossoverGADefault() {
} }
public CrossoverGADefault(CrossoverGADefault c) {
this.m_OptimizationProblem = c.m_OptimizationProblem;
}
/** This method will enable you to clone a given mutation operator
* @return The clone
*/
public Object clone() {
return new CrossoverGADefault(this);
}
/** This method performs crossover on two individuals. If the individuals do public CrossoverGADefault(CrossoverGADefault c) {
* not implement InterfaceGAIndividual, then nothing will happen. this.m_OptimizationProblem = c.m_OptimizationProblem;
* @param indy1 The first individual }
* @param partners The second individual
*/
public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners) {
AbstractEAIndividual[] result = null;
result = new AbstractEAIndividual[partners.size()+1];
result[0] = (AbstractEAIndividual) (indy1).clone();
for (int i = 0; i < partners.size(); i++) result[i+1] = (AbstractEAIndividual) ((AbstractEAIndividual)partners.get(i)).clone();
//for (int i = 0; i < result.length; i++) System.out.println("Before Crossover: " +result[i].getSolutionRepresentationFor());
if (partners.size() == 0) return result;
if ((indy1 instanceof InterfaceGAIndividual) && (partners.get(0) instanceof InterfaceGAIndividual)) {
// Currently we will only handle two parents
int crossoverpoint = RandomNumberGenerator.randomInt(0,((InterfaceGAIndividual)indy1).getGenotypeLength()-1);
boolean tmpValue;
BitSet[] tmpBitSets = new BitSet[2];
tmpBitSets[0] = ((InterfaceGAIndividual)result[0]).getBGenotype();
tmpBitSets[1] = ((InterfaceGAIndividual)result[1]).getBGenotype();
for (int i = crossoverpoint; i < ((InterfaceGAIndividual)result[0]).getGenotypeLength(); i++) {
if (tmpBitSets[0].get(i)) tmpValue = true;
else tmpValue = false;
if (tmpBitSets[1].get(i)) tmpBitSets[0].set(i);
else tmpBitSets[0].clear(i);
if (tmpValue) tmpBitSets[1].set(i);
else tmpBitSets[1].clear(i);
}
((InterfaceGAIndividual)result[0]).SetBGenotype(tmpBitSets[0]);
((InterfaceGAIndividual)result[1]).SetBGenotype(tmpBitSets[1]);
}
//in case the crossover was successfull lets give the mutation operators a chance to mate the strategy parameters
for (int i = 0; i < result.length; i++) result[i].getMutationOperator().crossoverOnStrategyParameters(indy1, partners);
//for (int i = 0; i < result.length; i++) System.out.println("After Crossover: " +result[i].getSolutionRepresentationFor());
return result;
}
/** This method allows you to evaluate wether two crossover operators /**
* are actually the same. * This method will enable you to clone a given mutation operator
* @param crossover The other crossover operator *
*/ * @return The clone
public boolean equals(Object crossover) { */
if (crossover instanceof CrossoverGADefault) return true; public Object clone() {
else return false; return new CrossoverGADefault(this);
} }
/** This method will allow the crossover operator to be initialized depending on the /**
* individual and the optimization problem. The optimization problem is to be stored * This method performs crossover on two individuals. If the individuals do
* since it is to be called during crossover to calculate the exogene parameters for * not implement InterfaceGAIndividual, then nothing will happen.
* the offsprings. *
* @param individual The individual that will be mutated. * @param indy1
* @param opt The optimization problem. * The first individual
*/ * @param partners
public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) { * The second individual
this.m_OptimizationProblem = opt; */
} public AbstractEAIndividual[] mate(AbstractEAIndividual indy1,
Population partners) {
AbstractEAIndividual[] result = null;
result = new AbstractEAIndividual[partners.size() + 1];
result[0] = (AbstractEAIndividual) (indy1).clone();
for (int i = 0; i < partners.size(); i++)
result[i + 1] = (AbstractEAIndividual) ((AbstractEAIndividual) partners
.get(i)).clone();
// for (int i = 0; i < result.length; i++) System.out.println("Before
// Crossover: " +result[i].getSolutionRepresentationFor());
if (partners.size() == 0) return result;
if ((indy1 instanceof InterfaceGAIndividual)
&& (partners.get(0) instanceof InterfaceGAIndividual)) {
// Currently we will only handle two parents
int crossoverpoint = RandomNumberGenerator.randomInt(0,
((InterfaceGAIndividual) indy1).getGenotypeLength() - 1);
boolean tmpValue;
BitSet[] tmpBitSets = new BitSet[2];
tmpBitSets[0] = ((InterfaceGAIndividual) result[0]).getBGenotype();
tmpBitSets[1] = ((InterfaceGAIndividual) result[1]).getBGenotype();
for (int i = crossoverpoint; i < ((InterfaceGAIndividual) result[0])
.getGenotypeLength(); i++) {
if (tmpBitSets[0].get(i))
tmpValue = true;
else tmpValue = false;
if (tmpBitSets[1].get(i))
tmpBitSets[0].set(i);
else tmpBitSets[0].clear(i);
if (tmpValue)
tmpBitSets[1].set(i);
else tmpBitSets[1].clear(i);
}
((InterfaceGAIndividual) result[0]).SetBGenotype(tmpBitSets[0]);
((InterfaceGAIndividual) result[1]).SetBGenotype(tmpBitSets[1]);
}
// in case the crossover was successfull lets give the mutation operators a
// chance to mate the strategy parameters
for (int i = 0; i < result.length; i++)
result[i].getMutationOperator().crossoverOnStrategyParameters(indy1,
partners);
// for (int i = 0; i < result.length; i++) System.out.println("After
// Crossover: " +result[i].getSolutionRepresentationFor());
return result;
}
public String getStringRepresentation() { /**
return this.getName(); * This method allows you to evaluate wether two crossover operators are
} * actually the same.
*
* @param crossover
* The other crossover operator
*/
public boolean equals(Object crossover) {
if (crossover instanceof CrossoverGADefault)
return true;
else return false;
}
/********************************************************************************************************************** /**
* These are for GUI * This method will allow the crossover operator to be initialized depending
*/ * on the individual and the optimization problem. The optimization problem is
/** This method allows the CommonJavaObjectEditorPanel to read the * to be stored since it is to be called during crossover to calculate the
* name to the current object. * exogene parameters for the offsprings.
* @return The name. *
*/ * @param individual
public String getName() { * The individual that will be mutated.
return "GA default crossover"; * @param opt
} * The optimization problem.
/** This method returns a global info string */
* @return description public void init(AbstractEAIndividual individual,
*/ InterfaceOptimizationProblem opt) {
public String globalInfo() { this.m_OptimizationProblem = opt;
return "This is a one-point crossover between two individuals."; }
}
public String getStringRepresentation() {
return this.getName();
}
/*****************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the name to the
* current object.
*
* @return The name.
*/
public String getName() {
return "GA default crossover";
}
/**
* This method returns a global info string
*
* @return description
*/
public String globalInfo() {
return "This is a one-point crossover between two individuals.";
}
} }

View File

@ -1,311 +1,397 @@
package javaeva.server.go.strategies; package javaeva.server.go.strategies;
import java.util.Hashtable;
import javaeva.server.go.InterfacePopulationChangedEventListener; import javaeva.server.go.InterfacePopulationChangedEventListener;
import javaeva.server.go.PopulationInterface;
import javaeva.server.go.individuals.AbstractEAIndividual; import javaeva.server.go.individuals.AbstractEAIndividual;
import javaeva.server.go.operators.selection.InterfaceSelection; import javaeva.server.go.operators.selection.InterfaceSelection;
import javaeva.server.go.operators.selection.SelectBest;
import javaeva.server.go.operators.selection.SelectBestIndividuals; import javaeva.server.go.operators.selection.SelectBestIndividuals;
import javaeva.server.go.populations.Population; import javaeva.server.go.populations.Population;
import javaeva.server.go.problems.F1Problem; import javaeva.server.go.problems.F1Problem;
import javaeva.server.go.problems.InterfaceLocalSearchable; import javaeva.server.go.problems.InterfaceLocalSearchable;
import javaeva.server.go.problems.InterfaceOptimizationProblem; import javaeva.server.go.problems.InterfaceOptimizationProblem;
import java.util.Hashtable;
/**
/** A memetic algorithm by hannes planatscher. The local search strategy can only be applied * A memetic algorithm by hannes planatscher. The local search strategy can only
* to problems which implement the InterfaceLocalSearchable else the local search will not be * be applied to problems which implement the InterfaceLocalSearchable else the
* activated at all. * local search will not be activated at all.
* <p>Title: The JavaEvA</p> * <p>
* <p>Description: </p> * Title: The JavaEvA
* <p>Copyright: Copyright (c) 2003</p> * </p>
* <p>Company: </p> * <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2003
* </p>
* <p>
* Company:
* </p>
*
* @author not attributable * @author not attributable
* @version 1.0 * @version 1.0
*/ */
public class MemeticAlgorithm implements InterfaceOptimizer, java.io.Serializable { public class MemeticAlgorithm implements InterfaceOptimizer,
java.io.Serializable {
private int localSearchSteps = 1; /**
private int subsetsize = 5; * serial version uid.
private int globalSearchSteps = 1; */
private boolean lamarckism = true; private static final long serialVersionUID = -1730086430763348568L;
// int counter = 0; !?
// int maxfunctioncalls = 1000; !?
private boolean TRACE = false; private int localSearchSteps = 1;
private String m_Identifier = "";
private InterfaceOptimizationProblem m_Problem = new F1Problem();
private InterfaceOptimizer m_GlobalOptimizer = new GeneticAlgorithm();
private InterfaceSelection selectorPlug = new SelectBestIndividuals();
transient private InterfacePopulationChangedEventListener m_Listener;
private int subsetsize = 5;
public MemeticAlgorithm() { private int globalSearchSteps = 1;
} private boolean lamarckism = true;
public MemeticAlgorithm(MemeticAlgorithm a) { // int counter = 0; !?
// this.m_Population = (Population)a.m_Population.clone(); // int maxfunctioncalls = 1000; !?
this.m_Problem = (InterfaceLocalSearchable)a.m_Problem.clone();
this.m_GlobalOptimizer = (InterfaceOptimizer)a.m_GlobalOptimizer;
this.selectorPlug = (InterfaceSelection)a.selectorPlug;
this.m_Identifier = a.m_Identifier;
this.localSearchSteps = a.localSearchSteps;
this.subsetsize = a.subsetsize;
this.globalSearchSteps = a.globalSearchSteps;
this.lamarckism = a.lamarckism;
}
public Object clone() { private boolean TRACE = false;
return (Object) new MemeticAlgorithm(this);
}
public void initByPopulation(Population pop, boolean reset) { private String m_Identifier = "";
this.setPopulation((Population) pop.clone());
if (reset)this.getPopulation().init();
this.m_Problem.evaluate(this.getPopulation());
this.firePropertyChangedEvent("NextGenerationPerformed");
}
public void init() { private InterfaceOptimizationProblem m_Problem = new F1Problem();
//counter = 0;
this.m_GlobalOptimizer.SetProblem(this.m_Problem);
this.m_GlobalOptimizer.init();
this.evaluatePopulation(this.m_GlobalOptimizer.getPopulation());
this.firePropertyChangedEvent("NextGenerationPerformed");
}
/** This method will evaluate the current population using the private InterfaceOptimizer m_GlobalOptimizer = new GeneticAlgorithm();
* given problem.
* @param population The population that is to be evaluated
*/
private void evaluatePopulation(Population population) {
this.m_Problem.evaluate(population);
population.incrGeneration();
}
public void optimize() { private InterfaceSelection selectorPlug = new SelectBestIndividuals();
if (TRACE) System.out.println("global search"); transient private InterfacePopulationChangedEventListener m_Listener;
this.m_GlobalOptimizer.optimize();
if ((this.m_GlobalOptimizer.getPopulation().getGeneration()%this.globalSearchSteps == 0) public MemeticAlgorithm() {
&& (this.localSearchSteps != 0)
&& (this.m_Problem instanceof InterfaceLocalSearchable)){
// here the local search is performed
if (TRACE) System.out.println("Performing local search on " +subsetsize+ " individuals.");
Population gop = this.m_GlobalOptimizer.getPopulation();
Population subset = selectorPlug.selectFrom(gop, subsetsize);
Population subsetclone = new Population();
for (int i = 0; i < subset.size(); i++) {
subsetclone.add(((AbstractEAIndividual)subset.get(i)).clone());
}
if (subset.size() != subsetsize) System.out.println("ALERT! identic individual instances in subset");
Hashtable antilamarckismcache = new Hashtable();
if (!this.lamarckism) {
for (int i = 0; i < subset.size(); i++) {
AbstractEAIndividual indy = (AbstractEAIndividual) subset.get(i);
AbstractEAIndividual indyclone = (AbstractEAIndividual) subsetclone.get(i);
antilamarckismcache.put(indy, indyclone);
}
}
//int dosearchsteps = this.localSearchSteps; }
double cost = ((InterfaceLocalSearchable)this.m_Problem).getLocalSearchStepFunctionCallEquivalent();
//int calls = gop.getFunctionCalls() + (int) Math.round(localSearchSteps * cost * subset.size());
// nett aber total unn<EFBFBD>tig-falsch man kann nicht davon ausgehen, dass man einen Fitnesscall Terminator hat..
// if (calls > this.maxfunctioncalls) {
// int remainingfunctioncalls = this.maxfunctioncalls - gop.getFunctionCalls();
// dosearchsteps = (int)Math.floor(((double) remainingfunctioncalls) / (cost * subsetsize));
// stopit = true;
// }
for (int i = 0; i < localSearchSteps ; i++) {
((InterfaceLocalSearchable)this.m_Problem).doLocalSearch(subsetclone);
}
this.m_Problem.evaluate(subsetclone);
if (this.lamarckism) {
gop.removeAll(subset);
gop.addPopulation(subsetclone);
} else {
for (int i = 0; i < subset.size(); i++) {
AbstractEAIndividual indy = (AbstractEAIndividual) subset.get(i);
try {
AbstractEAIndividual newindy = (AbstractEAIndividual) antilamarckismcache.get(indy);
indy.SetFitness(newindy.getFitness());
}
catch (Exception ex) {
System.out.println("indy not found in antilamarckismcache");
}
}
}
// eigentlich muss hier noch subsetsize drauf, aber lassen wir das
gop.SetFunctionCalls(gop.getFunctionCalls() + (int) Math.round(localSearchSteps * cost * subset.size()));
if (TRACE) System.out.println("Population size after local search:" + gop.size()); public MemeticAlgorithm(MemeticAlgorithm a) {
// this.m_Population = (Population)a.m_Population.clone();
this.m_Problem = (InterfaceLocalSearchable) a.m_Problem.clone();
this.m_GlobalOptimizer = (InterfaceOptimizer) a.m_GlobalOptimizer;
this.selectorPlug = (InterfaceSelection) a.selectorPlug;
this.m_Identifier = a.m_Identifier;
this.localSearchSteps = a.localSearchSteps;
this.subsetsize = a.subsetsize;
this.globalSearchSteps = a.globalSearchSteps;
this.lamarckism = a.lamarckism;
}
this.setPopulation(gop); @Override
} public Object clone() {
return new MemeticAlgorithm(this);
}
if (TRACE) System.out.println("function calls" + this.m_GlobalOptimizer.getPopulation().getFunctionCalls()); public void initByPopulation(Population pop, boolean reset) {
this.firePropertyChangedEvent("NextGenerationPerformed"); this.setPopulation((Population) pop.clone());
} if (reset) this.getPopulation().init();
this.m_Problem.evaluate(this.getPopulation());
this.firePropertyChangedEvent("NextGenerationPerformed");
}
/** This method allows you to add the LectureGUI as listener to the Optimizer public void init() {
* @param ea // counter = 0;
*/ this.m_GlobalOptimizer.SetProblem(this.m_Problem);
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) { this.m_GlobalOptimizer.init();
this.m_Listener = ea; this.evaluatePopulation(this.m_GlobalOptimizer.getPopulation());
} this.firePropertyChangedEvent("NextGenerationPerformed");
/** Something has changed }
*/
protected void firePropertyChangedEvent (String name) {
if (this.m_Listener != null) {
if (TRACE) System.out.println("firePropertyChangedEvent MA");
this.m_Listener.registerPopulationStateChanged(this, name);
}
}
/** This method will set the problem that is to be optimized /**
* @param problem * This method will evaluate the current population using the given problem.
*/ *
public void SetProblem (InterfaceOptimizationProblem problem) { * @param population
this.m_Problem = problem; * The population that is to be evaluated
this.m_GlobalOptimizer.SetProblem(this.m_Problem); */
} private void evaluatePopulation(Population population) {
public InterfaceOptimizationProblem getProblem () { this.m_Problem.evaluate(population);
return this.m_Problem; population.incrGeneration();
} }
/** This method will return a string describing all properties of the optimizer public void optimize() {
* and the applied methods.
* @return A descriptive string
*/
public String getStringRepresentation() {
String result = "";
result += "Memetic Algorithm:\n";
result += "Optimization Problem: ";
result += this.m_Problem.getStringRepresentationForProblem(this) +"\n";
result += this.m_GlobalOptimizer.getStringRepresentation();
return result;
}
/** This method allows you to set an identifier for the algorithm
* @param name The indenifier
*/
public void SetIdentifier(String name) {
this.m_Identifier = name;
}
public String getIdentifier() {
return this.m_Identifier;
}
/** This method is required to free the memory on a RMIServer, if (TRACE) System.out.println("global search");
* but there is nothing to implement. this.m_GlobalOptimizer.optimize();
*/
public void freeWilly() {
} if ((this.m_GlobalOptimizer.getPopulation().getGeneration()
/********************************************************************************************************************** % this.globalSearchSteps == 0)
* These are for GUI && (this.localSearchSteps != 0)
*/ && (this.m_Problem instanceof InterfaceLocalSearchable)) {
/** This method returns a global info string // here the local search is performed
* @return description if (TRACE)
*/ System.out.println("Performing local search on " + subsetsize
public String globalInfo() { + " individuals.");
return "This is a basic generational Memetic Algorithm."; Population gop = this.m_GlobalOptimizer.getPopulation();
} Population subset = selectorPlug.selectFrom(gop, subsetsize);
/** This method will return a naming String Population subsetclone = new Population();
* @return The name of the algorithm for (int i = 0; i < subset.size(); i++) {
*/ subsetclone.add(((AbstractEAIndividual) subset.get(i)).clone());
public String getName() { }
return "Memetic-Algorithm"; if (subset.size() != subsetsize)
} System.err.println("ALERT! identical individual instances in subset");
Hashtable antilamarckismcache = new Hashtable();
if (!this.lamarckism) {
for (int i = 0; i < subset.size(); i++) {
AbstractEAIndividual indy = (AbstractEAIndividual) subset.get(i);
AbstractEAIndividual indyclone = (AbstractEAIndividual) subsetclone
.get(i);
antilamarckismcache.put(indy, indyclone);
}
}
/** Assuming that all optimizer will store thier data in a population // int dosearchsteps = this.localSearchSteps;
* we will allow acess to this population to query to current state double cost = ((InterfaceLocalSearchable) this.m_Problem)
* of the optimizer. .getLocalSearchStepFunctionCallEquivalent();
* @return The population of current solutions to a given problem. // int calls = gop.getFunctionCalls() + (int) Math.round(localSearchSteps
*/ // * cost * subset.size());
public Population getPopulation() { // nett aber total unn<EFBFBD>tig-falsch man kann nicht davon ausgehen, dass man
return this.m_GlobalOptimizer.getPopulation(); // einen Fitnesscall Terminator hat..
} // if (calls > this.maxfunctioncalls) {
public void setPopulation(Population pop){ // int remainingfunctioncalls = this.maxfunctioncalls -
this.m_GlobalOptimizer.setPopulation(pop); // gop.getFunctionCalls();
} // dosearchsteps = (int)Math.floor(((double) remainingfunctioncalls) /
public String populationTipText() { // (cost * subsetsize));
return "Edit the properties of the population used."; // stopit = true;
} // }
for (int i = 0; i < localSearchSteps; i++) {
((InterfaceLocalSearchable) this.m_Problem).doLocalSearch(subsetclone);
}
this.m_Problem.evaluate(subsetclone);
if (this.lamarckism) {
gop.removeAll(subset);
gop.addPopulation(subsetclone);
} else {
for (int i = 0; i < subset.size(); i++) {
AbstractEAIndividual indy = (AbstractEAIndividual) subset.get(i);
try {
AbstractEAIndividual newindy = (AbstractEAIndividual) antilamarckismcache
.get(indy);
indy.SetFitness(newindy.getFitness());
} catch (Exception ex) {
System.err.println("individual not found in antilamarckismcache");
}
}
}
// eigentlich muss hier noch subsetsize drauf, aber lassen wir das
gop.SetFunctionCalls(gop.getFunctionCalls()
+ (int) Math.round(localSearchSteps * cost * subset.size()));
if (TRACE)
System.out.println("Population size after local search:" + gop.size());
this.setPopulation(gop);
}
if (TRACE)
System.out.println("function calls"
+ this.m_GlobalOptimizer.getPopulation().getFunctionCalls());
this.firePropertyChangedEvent("NextGenerationPerformed");
}
/**
* This method allows you to add the LectureGUI as listener to the Optimizer
*
* @param ea
*/
public void addPopulationChangedEventListener(
InterfacePopulationChangedEventListener ea) {
this.m_Listener = ea;
}
/**
* Something has changed
*/
protected void firePropertyChangedEvent(String name) {
if (this.m_Listener != null) {
if (TRACE) System.out.println("firePropertyChangedEvent MA");
this.m_Listener.registerPopulationStateChanged(this, name);
}
}
/**
* This method will set the problem that is to be optimized
*
* @param problem
*/
public void SetProblem(InterfaceOptimizationProblem problem) {
this.m_Problem = problem;
this.m_GlobalOptimizer.SetProblem(this.m_Problem);
}
public InterfaceOptimizationProblem getProblem() {
return this.m_Problem;
}
/**
* This method will return a string describing all properties of the optimizer
* and the applied methods.
*
* @return A descriptive string
*/
public String getStringRepresentation() {
String result = "";
result += "Memetic Algorithm:\n";
result += "Optimization Problem: ";
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n";
result += this.m_GlobalOptimizer.getStringRepresentation();
return result;
}
/**
* This method allows you to set an identifier for the algorithm
*
* @param name
* The indenifier
*/
public void SetIdentifier(String name) {
this.m_Identifier = name;
}
public String getIdentifier() {
return this.m_Identifier;
}
/**
* This method is required to free the memory on a RMIServer, but there is
* nothing to implement.
*/
public void freeWilly() {
}
/*
* ========================================================================================
* These are for GUI
*/
/**
* This method returns a global info string
*
* @return description
*/
public String globalInfo() {
return "This is a basic generational Memetic Algorithm.";
}
/**
* This method will return a naming String
*
* @return The name of the algorithm
*/
public String getName() {
return "Memetic-Algorithm";
}
/**
* 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 optimizer.
*
* @return The population of current solutions to a given problem.
*/
public Population getPopulation() {
return this.m_GlobalOptimizer.getPopulation();
}
public void setPopulation(Population pop) {
this.m_GlobalOptimizer.setPopulation(pop);
}
public String populationTipText() {
return "Edit the properties of the population used.";
}
/**
* Choose the global optimization strategy to use
*
* @param m_GlobalOptimizer
*/
public void setGlobalOptimizer(InterfaceOptimizer m_GlobalOptimizer) {
this.m_GlobalOptimizer = m_GlobalOptimizer;
this.m_GlobalOptimizer.SetProblem(this.getProblem());
this.init();
}
public InterfaceOptimizer getGlobalOptimizer() {
return m_GlobalOptimizer;
}
public String globalOptimizerTipText() {
return "Choose the global optimization strategy to use.";
}
/**
* Choose the number of local search steps to perform per selected individual
*
* @param localSearchSteps
*/
public void setLocalSearchSteps(int localSearchSteps) {
this.localSearchSteps = localSearchSteps;
}
public int getLocalSearchSteps() {
return localSearchSteps;
}
public String localSearchStepsTipText() {
return "Choose the number of local search steps to perform per selected individual.";
}
/**
* Choose the interval between the application of the local search
*
* @param globalSearchSteps
*/
public void setGlobalSearchSteps(int globalSearchSteps) {
this.globalSearchSteps = globalSearchSteps;
}
public int getGlobalSearchSteps() {
return globalSearchSteps;
}
public String globalSearchStepsTipText() {
return "Choose the interval between the application of the local search.";
}
/**
* Choose the number of individual to be locally optimized
*
* @param subsetsize
*/
public void setSubsetsize(int subsetsize) {
this.subsetsize = subsetsize;
}
public Population getAllSolutions() { public Population getAllSolutions() {
return getPopulation(); return getPopulation();
} }
/** Choose the global optimization strategy to use public int getSubsetsize() {
* @param m_GlobalOptimizer return subsetsize;
*/ }
public void setGlobalOptimizer(InterfaceOptimizer m_GlobalOptimizer) {
this.m_GlobalOptimizer = m_GlobalOptimizer;
this.m_GlobalOptimizer.SetProblem(this.getProblem());
this.init();
}
public InterfaceOptimizer getGlobalOptimizer() {
return m_GlobalOptimizer;
}
public String globalOptimizerTipText() {
return "Choose the global optimization strategy to use.";
}
/** Choose the number of local search steps to perform per selected individual public String subsetsizeTipText() {
* @param localSearchSteps return "Choose the number of individual to be locally optimized.";
*/ }
public void setLocalSearchSteps(int localSearchSteps) {
this.localSearchSteps = localSearchSteps;
}
public int getLocalSearchSteps() {
return localSearchSteps;
}
public String localSearchStepsTipText() {
return "Choose the number of local search steps to perform per selected individual.";
}
/** Choose the interval between the application of the local search /**
* @param globalSearchSteps * Toggel between Lamarcksim and the Baldwin Effect
*/ *
public void setGlobalSearchSteps(int globalSearchSteps) { * @param lamarckism
this.globalSearchSteps = globalSearchSteps; */
} public void setLamarckism(boolean lamarckism) {
public int getGlobalSearchSteps() { this.lamarckism = lamarckism;
return globalSearchSteps; }
}
public String globalSearchStepsTipText() {
return "Choose the interval between the application of the local search.";
}
/** Choose the number of individual to be locally optimized public boolean getLamarckism() {
* @param subsetsize return this.lamarckism;
*/ }
public void setSubsetsize(int subsetsize) {
this.subsetsize = subsetsize;
}
public int getSubsetsize() {
return subsetsize;
}
public String subsetsizeTipText() {
return "Choose the number of individual to be locally optimized.";
}
/** Toggel between Lamarcksim and the Baldwin Effect public String lamarckismTipText() {
* @param lamarckism return "Toggel between Lamarcksim and the Baldwin Effect.";
*/ }
public void setLamarckism(boolean lamarckism) {
this.lamarckism = lamarckism; public boolean isLamarckism() {
} return lamarckism;
public boolean getLamarckism() { }
return this.lamarckism;
}
public String lamarckismTipText() {
return "Toggel between Lamarcksim and the Baldwin Effect.";
}
public boolean isLamarckism() {
return lamarckism;
}
} }