Killed double method getGenerations() in Population

This commit is contained in:
Marcel Kronfeld 2008-06-19 15:54:14 +00:00
parent 5acff4aec6
commit 6303437fe8
5 changed files with 6 additions and 10 deletions

View File

@ -28,7 +28,7 @@ public interface PopulationInterface {
public double[] getWorstFitness();
public double[] getMeanFitness();
public int getFunctionCalls();
public int getGenerations();
public int getGeneration();
/** This method returns problem specific data
* @return double[]
*/

View File

@ -110,7 +110,7 @@ Serializable {
oldFit = Pop.getBestFitness();
oldNorm = PhenotypeMetric.norm(oldFit);
popFitCalls = Pop.getFunctionCalls();
popGens = Pop.getGenerations();
popGens = Pop.getGeneration();
firstTime = false;
}
@ -140,7 +140,7 @@ Serializable {
return (pop.getFunctionCalls() - popFitCalls) >= m_stagTime;
} else {// by generation
// System.out.println("stagnationTimeHasPassed returns " + ((pop.getFunctionCalls() - popGens) >= m_stagTime) + " after " + (pop.getFunctionCalls() - popGens));
return (pop.getGenerations() - popGens) >= m_stagTime;
return (pop.getGeneration() - popGens) >= m_stagTime;
}
}

View File

@ -52,7 +52,7 @@ public class GenerationTerminator implements InterfaceTerminator,
*
*/
public boolean isTerminated(PopulationInterface Pop) {
if (m_Generations<Pop.getGenerations())
if (m_Generations<Pop.getGeneration())
return true;
return false;
}

View File

@ -801,10 +801,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
// }
// return sum;
// }
public int getGenerations() {
return this.m_Generation;
}
/**
* Fire an event every n function calls, the event sends the public String funCallIntervalReached.

View File

@ -211,8 +211,8 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
tracedVelocity = new double[((InterfaceESIndividual)population.get(0)).getDGenotype().length];
for (int i=0; i<tracedVelocity.length; i++) tracedVelocity[i] = curAvVelAndSpeed[i];
} else {
if (population.getGenerations() < emaPeriods) {// if less than emaPeriods have passed, use larger alpha
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(population.getGenerations()+1));
if (population.getGeneration() < emaPeriods) {// if less than emaPeriods have passed, use larger alpha
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(population.getGeneration()+1));
} else {
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(emaPeriods+1));
}