Killed double method getGenerations() in Population
This commit is contained in:
parent
5acff4aec6
commit
6303437fe8
@ -28,7 +28,7 @@ public interface PopulationInterface {
|
|||||||
public double[] getWorstFitness();
|
public double[] getWorstFitness();
|
||||||
public double[] getMeanFitness();
|
public double[] getMeanFitness();
|
||||||
public int getFunctionCalls();
|
public int getFunctionCalls();
|
||||||
public int getGenerations();
|
public int getGeneration();
|
||||||
/** This method returns problem specific data
|
/** This method returns problem specific data
|
||||||
* @return double[]
|
* @return double[]
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +110,7 @@ Serializable {
|
|||||||
oldFit = Pop.getBestFitness();
|
oldFit = Pop.getBestFitness();
|
||||||
oldNorm = PhenotypeMetric.norm(oldFit);
|
oldNorm = PhenotypeMetric.norm(oldFit);
|
||||||
popFitCalls = Pop.getFunctionCalls();
|
popFitCalls = Pop.getFunctionCalls();
|
||||||
popGens = Pop.getGenerations();
|
popGens = Pop.getGeneration();
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ Serializable {
|
|||||||
return (pop.getFunctionCalls() - popFitCalls) >= m_stagTime;
|
return (pop.getFunctionCalls() - popFitCalls) >= m_stagTime;
|
||||||
} else {// by generation
|
} else {// by generation
|
||||||
// System.out.println("stagnationTimeHasPassed returns " + ((pop.getFunctionCalls() - popGens) >= m_stagTime) + " after " + (pop.getFunctionCalls() - popGens));
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class GenerationTerminator implements InterfaceTerminator,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public boolean isTerminated(PopulationInterface Pop) {
|
public boolean isTerminated(PopulationInterface Pop) {
|
||||||
if (m_Generations<Pop.getGenerations())
|
if (m_Generations<Pop.getGeneration())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -801,10 +801,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
// }
|
// }
|
||||||
// return sum;
|
// return sum;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public int getGenerations() {
|
|
||||||
return this.m_Generation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fire an event every n function calls, the event sends the public String funCallIntervalReached.
|
* Fire an event every n function calls, the event sends the public String funCallIntervalReached.
|
||||||
|
@ -211,8 +211,8 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
tracedVelocity = new double[((InterfaceESIndividual)population.get(0)).getDGenotype().length];
|
tracedVelocity = new double[((InterfaceESIndividual)population.get(0)).getDGenotype().length];
|
||||||
for (int i=0; i<tracedVelocity.length; i++) tracedVelocity[i] = curAvVelAndSpeed[i];
|
for (int i=0; i<tracedVelocity.length; i++) tracedVelocity[i] = curAvVelAndSpeed[i];
|
||||||
} else {
|
} else {
|
||||||
if (population.getGenerations() < emaPeriods) {// if less than emaPeriods have passed, use larger alpha
|
if (population.getGeneration() < emaPeriods) {// if less than emaPeriods have passed, use larger alpha
|
||||||
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(population.getGenerations()+1));
|
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(population.getGeneration()+1));
|
||||||
} else {
|
} else {
|
||||||
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(emaPeriods+1));
|
addMovingAverage(tracedVelocity, curAvVelAndSpeed, 2./(emaPeriods+1));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user