Fix typos and reactivate local IslandEA

This commit is contained in:
Fabian Becker 2015-12-31 16:43:10 +01:00
parent fc0ea0dd45
commit 072d30439d
3 changed files with 15 additions and 51 deletions

View File

@ -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
*
* @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
public void setDoubleDataLength(int length) {
@ -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.
*
* @return A descriptive string
@ -290,10 +287,6 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return result;
}
/************************************************************************************
* InterfaceGAIndividual methods
*/
/**
* This method allows you to read the binary data
*
@ -317,8 +310,8 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index
* of the last significat bit.
* This may be necessary since BitSet.length only returns the index
* of the last significant bit.
*
* @return The length of the genotype.
*/
@ -350,9 +343,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
this.genotype.set(mutationIndex);
}
}
/**********************************************************************************************************************
* These are for GUI
*/
/**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object.
@ -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.
*
* @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.")
public void setPrecision(int precision) {

View File

@ -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
*
* @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
public void setProgramDataLength(int length) {
@ -142,14 +139,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
this.phenotype = new AbstractGPNode[this.genotype.length];
for (int i = 0; i < this.genotype.length; i++) {
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))) {
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);
//System.out.println("TragetDepth: " + this.targetDepth + " : " + this.m_Program.getMaxDepth());
}
}
return this.phenotype;
@ -223,9 +216,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return this.gpArea;
}
/************************************************************************************
* InterfaceEAIndividual methods
*/
/**
* This method will initialize the individual with a given value for the
* phenotype.
@ -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.
*
* @return A descriptive string
@ -273,10 +263,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return result;
}
/************************************************************************************
* InterfaceGPIndividual methods
*/
/**
* This method will allow the user to read the program genotype
*
@ -308,7 +294,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
public void setPGenotype(AbstractGPNode b, int i) {
this.genotype[i] = b;
genotype[i].updateDepth(0);
// System.out.println("Setting pheno of depth " + b.getMaxDepth() + " " + b.getStringRepresentation());
this.phenotype = null;
}
@ -333,9 +318,6 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
newNode.initGrow(this.gpArea[i], this.maxAllowedDepth);
parent.setNode(newNode, nodeToMutate);
}
//if (!genotype[i].checkDepth(0) || (genotype[i].isMaxDepthViolated(maxAllowedDepth))) {
// System.err.println("Error in GPIndividualProgramData.defaultMutate!");
//}
}
}
phenotype = null; // reset pheno

View File

@ -21,7 +21,7 @@ import eva2.util.annotation.Hidden;
* 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
* 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
* can be used.
* <p>
@ -48,11 +48,9 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
private boolean logLocalChanges = true;
private boolean show = false;
transient private Plot plot = null;
transient private String identifier = "";
transient private InterfacePopulationChangedEventListener populationChangedEventListener;
public IslandModelEA() {
}
public IslandModelEA() {}
public IslandModelEA(IslandModelEA a) {
this.population = (Population) a.population.clone();
@ -81,13 +79,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
}
}
// this.population = new Population();
this.population.clear();
this.population.initialize();
this.optimizer.initialize();
this.optimizer.setProblem(this.optimizationProblem);
this.optimizer.setPopulation((Population) population.clone());
InterfacePopulationChangedEventListener myLocal = null;
if (this.numLocalOnly) {
// this is running on the local machine
this.islands = new InterfaceOptimizer[this.numLocalCPUs];
@ -408,10 +404,6 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
this.heterogeneousProblems = t;
}
/**
* ********************************************************************************************************************
* These are for InterfacePopulationChangedEventListener
*/
/**
* This method allows an optimizer to register a change in the EA-lecture
*
@ -446,11 +438,10 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
* implementation.
*
*/
// TODO Deactivated from GUI because the current implementation does not really paralelize on a multicore.
// Instead, the new direct problem parallelization can be used.
// public boolean isLocalOnly() {
// return this.numLocalOnly;
// }
public boolean isLocalOnly() {
return this.numLocalOnly;
}
public void setLocalOnly(boolean b) {
this.numLocalOnly = b;
}