Commit 072d3043 authored by Fabian Becker's avatar Fabian Becker

Fix typos and reactivate local IslandEA

parent fc0ea0dd
...@@ -107,13 +107,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -107,13 +107,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
} }
/************************************************************************************
* InterfaceDataTypeDouble methods
*/
/** /**
* This method allows you to request a certain amount of double data * This method allows you to request a certain amount of double data
* *
* @param length The lenght of the double[] that is to be optimized * @param length The length of the double[] that is to be optimized
*/ */
@Override @Override
public void setDoubleDataLength(int length) { public void setDoubleDataLength(int length) {
...@@ -254,7 +251,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -254,7 +251,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
/** /**
* This method will return a string description of the GAIndividal * This method will return a string description of the GAIndividual
* noteably the Genotype. * noteably the Genotype.
* *
* @return A descriptive string * @return A descriptive string
...@@ -290,10 +287,6 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -290,10 +287,6 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return result; return result;
} }
/************************************************************************************
* InterfaceGAIndividual methods
*/
/** /**
* This method allows you to read the binary data * This method allows you to read the binary data
* *
...@@ -317,8 +310,8 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -317,8 +310,8 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** /**
* This method allows the user to read the length of the genotype. * This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index * This may be necessary since BitSet.length only returns the index
* of the last significat bit. * of the last significant bit.
* *
* @return The length of the genotype. * @return The length of the genotype.
*/ */
...@@ -350,9 +343,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -350,9 +343,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
this.genotype.set(mutationIndex); this.genotype.set(mutationIndex);
} }
} }
/**********************************************************************************************************************
* 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.
...@@ -380,10 +371,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte ...@@ -380,10 +371,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
/** /**
* This method allows you to set the number of mulitruns that are to be performed, * This method allows you to set the number of multi runs that are to be performed,
* necessary for stochastic optimizers to ensure reliable results. * necessary for stochastic optimizers to ensure reliable results.
* *
* @param precision The number of multiruns that are to be performed * @param precision The number of multi runs that are to be performed
*/ */
@Parameter(description = "Gives the number of bits to be used to code a double.") @Parameter(description = "Gives the number of bits to be used to code a double.")
public void setPrecision(int precision) { public void setPrecision(int precision) {
......
...@@ -108,13 +108,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -108,13 +108,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/************************************************************************************
* InterfaceDataTypeProgram methods
*/
/** /**
* This method allows you to request a certain amount of double data * This method allows you to request a certain amount of double data
* *
* @param length The lenght of the double[] that is to be optimized * @param length The length of the double[] that is to be optimized
*/ */
@Override @Override
public void setProgramDataLength(int length) { public void setProgramDataLength(int length) {
...@@ -142,14 +139,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -142,14 +139,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
this.phenotype = new AbstractGPNode[this.genotype.length]; this.phenotype = new AbstractGPNode[this.genotype.length];
for (int i = 0; i < this.genotype.length; i++) { for (int i = 0; i < this.genotype.length; i++) {
this.phenotype[i] = (AbstractGPNode) this.genotype[i].clone(); this.phenotype[i] = (AbstractGPNode) this.genotype[i].clone();
// if (!phenotype[0].checkDepth(0)) {
// System.err.println("error... " + genotype[0].checkDepth(0));
// }
if ((this.checkMaxDepth) && (this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth))) { if ((this.checkMaxDepth) && (this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth))) {
System.err.println("Trying to meet the Target Depth! " + this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth) + " " + phenotype[i].getMaxDepth()); System.err.println("Trying to meet the Target Depth! " + this.phenotype[i].isMaxDepthViolated(this.maxAllowedDepth) + " " + phenotype[i].getMaxDepth());
this.phenotype[i].repairMaxDepth(this.gpArea[i], this.maxAllowedDepth); this.phenotype[i].repairMaxDepth(this.gpArea[i], this.maxAllowedDepth);
//System.out.println("TragetDepth: " + this.targetDepth + " : " + this.m_Program.getMaxDepth());
} }
} }
return this.phenotype; return this.phenotype;
...@@ -223,9 +216,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -223,9 +216,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return this.gpArea; return this.gpArea;
} }
/************************************************************************************
* InterfaceEAIndividual methods
*/
/** /**
* This method will initialize the individual with a given value for the * This method will initialize the individual with a given value for the
* phenotype. * phenotype.
...@@ -246,7 +236,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -246,7 +236,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
/** /**
* This method will return a string description of the GAIndividal * This method will return a string description of the GAIndividual
* noteably the Genotype. * noteably the Genotype.
* *
* @return A descriptive string * @return A descriptive string
...@@ -273,10 +263,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -273,10 +263,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return result; return result;
} }
/************************************************************************************
* InterfaceGPIndividual methods
*/
/** /**
* This method will allow the user to read the program genotype * This method will allow the user to read the program genotype
* *
...@@ -308,7 +294,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -308,7 +294,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
public void setPGenotype(AbstractGPNode b, int i) { public void setPGenotype(AbstractGPNode b, int i) {
this.genotype[i] = b; this.genotype[i] = b;
genotype[i].updateDepth(0); genotype[i].updateDepth(0);
// System.out.println("Setting pheno of depth " + b.getMaxDepth() + " " + b.getStringRepresentation());
this.phenotype = null; this.phenotype = null;
} }
...@@ -333,9 +318,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int ...@@ -333,9 +318,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
newNode.initGrow(this.gpArea[i], this.maxAllowedDepth); newNode.initGrow(this.gpArea[i], this.maxAllowedDepth);
parent.setNode(newNode, nodeToMutate); parent.setNode(newNode, nodeToMutate);
} }
//if (!genotype[i].checkDepth(0) || (genotype[i].isMaxDepthViolated(maxAllowedDepth))) {
// System.err.println("Error in GPIndividualProgramData.defaultMutate!");
//}
} }
} }
phenotype = null; // reset pheno phenotype = null; // reset pheno
......
...@@ -21,7 +21,7 @@ import eva2.util.annotation.Hidden; ...@@ -21,7 +21,7 @@ import eva2.util.annotation.Hidden;
* distribution scheme is rather prone to config errors (the correct ssh version * distribution scheme is rather prone to config errors (the correct ssh version
* is required, the jar needs to be in the working dir and possible problem data * is required, the jar needs to be in the working dir and possible problem data
* must be on the servers to) an implicit island-model has been implemented too * must be on the servers to) an implicit island-model has been implemented too
* to allow fast and reliable computation. This is still usefull, since it is * to allow fast and reliable computation. This is still useful, since it is
* less prone to premature convergence and also an heterogenuous island model * less prone to premature convergence and also an heterogenuous island model
* can be used. * can be used.
* <p> * <p>
...@@ -48,11 +48,9 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I ...@@ -48,11 +48,9 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
private boolean logLocalChanges = true; private boolean logLocalChanges = true;
private boolean show = false; private boolean show = false;
transient private Plot plot = null; transient private Plot plot = null;
transient private String identifier = "";
transient private InterfacePopulationChangedEventListener populationChangedEventListener; transient private InterfacePopulationChangedEventListener populationChangedEventListener;
public IslandModelEA() { public IslandModelEA() {}
}
public IslandModelEA(IslandModelEA a) { public IslandModelEA(IslandModelEA a) {
this.population = (Population) a.population.clone(); this.population = (Population) a.population.clone();
...@@ -81,13 +79,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I ...@@ -81,13 +79,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
} }
} }
// this.population = new Population();
this.population.clear(); this.population.clear();
this.population.initialize(); this.population.initialize();
this.optimizer.initialize(); this.optimizer.initialize();
this.optimizer.setProblem(this.optimizationProblem); this.optimizer.setProblem(this.optimizationProblem);
this.optimizer.setPopulation((Population) population.clone()); this.optimizer.setPopulation((Population) population.clone());
InterfacePopulationChangedEventListener myLocal = null;
if (this.numLocalOnly) { if (this.numLocalOnly) {
// this is running on the local machine // this is running on the local machine
this.islands = new InterfaceOptimizer[this.numLocalCPUs]; this.islands = new InterfaceOptimizer[this.numLocalCPUs];
...@@ -408,10 +404,6 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I ...@@ -408,10 +404,6 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
this.heterogeneousProblems = t; this.heterogeneousProblems = t;
} }
/**
* ********************************************************************************************************************
* These are for InterfacePopulationChangedEventListener
*/
/** /**
* This method allows an optimizer to register a change in the EA-lecture * This method allows an optimizer to register a change in the EA-lecture
* *
...@@ -446,11 +438,10 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I ...@@ -446,11 +438,10 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
* implementation. * implementation.
* *
*/ */
// TODO Deactivated from GUI because the current implementation does not really paralelize on a multicore. public boolean isLocalOnly() {
// Instead, the new direct problem parallelization can be used. return this.numLocalOnly;
// public boolean isLocalOnly() { }
// return this.numLocalOnly;
// }
public void setLocalOnly(boolean b) { public void setLocalOnly(boolean b) {
this.numLocalOnly = b; this.numLocalOnly = b;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment