Removed deprecated methods.

fixes #10
This commit is contained in:
Fabian Becker 2013-10-29 16:21:09 +01:00
parent cc9b29147f
commit dbb6d54e26
25 changed files with 77 additions and 136 deletions

View File

@ -428,7 +428,6 @@ public class OptimizerFactory {
pso.setPhi1(phi1);
pso.setPhi2(phi2);
pso.setSpeedLimit(speedLim);
// pso.getTopology().setSelectedTag(selectedTopology);
pso.setTopology(selectedTopology);
pso.setTopologyRange(topologyRange);
pso.addPopulationChangedEventListener(listener);

View File

@ -471,7 +471,7 @@ public class MOCCOStandalone implements InterfaceStandaloneOptimization, Interfa
System.out.println("" + this.m_State.m_Optimizer.getStringRepresentation());
}
this.m_State.m_CurrentProblem.evaluate(this.m_State.m_Optimizer.getPopulation());
this.m_State.m_Optimizer.getPopulation().SetFunctionCalls(0);
this.m_State.m_Optimizer.getPopulation().setFunctionCalls(0);
if (this.m_State.m_Optimizer.getPopulation().size() == 0) {
this.m_State.m_Optimizer.init();
}

View File

@ -407,7 +407,7 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
this.optimizationParameters.getOptimizer().getProblem().evaluate(this.optimizationParameters.getOptimizer().getPopulation());
this.optimizationParameters.getOptimizer().getProblem().evaluate(this.optimizationParameters.getOptimizer().getPopulation().getArchive());
this.optimizationParameters.getOptimizer().initByPopulation(this.backupPopulation, false);
this.optimizationParameters.getOptimizer().getPopulation().SetFunctionCalls(0);
this.optimizationParameters.getOptimizer().getPopulation().setFunctionCalls(0);
this.optimizationParameters.addPopulationChangedEventListener(this);
} else {
this.recentFunctionCalls = 0;

View File

@ -375,8 +375,8 @@ public class PostProcess {
* @return the number of evaluations actually performed
*/
public static int processWithHC(Population pop, AbstractOptimizationProblem problem, int maxSteps, double stepSize, double minStepSize) {
// pop.SetFunctionCalls(0); // or else optimization wont restart on an "old" population
// pop.setGenerationTo(0);
// pop.setFunctionCalls(0); // or else optimization wont restart on an "old" population
// pop.setGeneration(0);
int stepsBef = pop.getFunctionCalls();
processWithHC(pop, problem, new EvaluationTerminator(pop.getFunctionCalls() + maxSteps), new MutateESMutativeStepSizeControl(stepSize, minStepSize, stepSize));
return pop.getFunctionCalls() - stepsBef;
@ -519,7 +519,7 @@ public class PostProcess {
pop.addPopulation(es.getPopulation());
int funCallsDone = es.getPopulation().getFunctionCalls() - baseEvals;
pop.SetFunctionCalls(funCallsBefore);
pop.setFunctionCalls(funCallsBefore);
return new Pair<Integer, Boolean>(funCallsDone, ppRunnable.wasAborted());
}
@ -632,7 +632,7 @@ public class PostProcess {
int evalsOld = candidates.getFunctionCalls();
processWithHC(candidates, prob, new EvaluationTerminator(evalsOld + steps), mute);
int evalsDone = candidates.getFunctionCalls() - evalsOld;
candidates.SetFunctionCalls(evalsOld);
candidates.setFunctionCalls(evalsOld);
return evalsDone;
} else {
int stepsPerCand = (steps - (candCnt * (dim - 1))) / candCnt;

View File

@ -5,10 +5,11 @@ import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.PopulationInterface;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.SelectedTag;
import eva2.util.annotation.Description;
import java.io.Serializable;
@Description(text = "Boolean combination of two terminators.")
public class CombinedTerminator implements InterfaceTerminator, Serializable {
/**
*
@ -37,10 +38,6 @@ public class CombinedTerminator implements InterfaceTerminator, Serializable {
andOrTag.setSelectedTag(bAnd ? "AND" : "OR");
}
public static String globalInfo() {
return "Boolean combination of two terminators.";
}
@Override
public void init(InterfaceOptimizationProblem prob) {
if (t1 != null) {

View File

@ -1,39 +1,27 @@
package eva2.optimization.operator.terminators;
/*
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 319 $
* $Date: 2007-12-05 11:29:32 +0100 (Wed, 05 Dec 2007) $
* $Author: mkron $
*/
/*==========================================================================*
* IMPORTS
*==========================================================================*/
import eva2.optimization.go.InterfaceTerminator;
import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.PopulationInterface;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
import java.io.Serializable;
/*==========================================================================*
* CLASS DECLARATION
*==========================================================================*/
/**
*
* Evaluation Terminator. Terminates the optimization after a certain
* number of fitness evaluations. Note that this will not terminate after
* the exact number of fitness calls, since terminators are only once per
* generation.
*/
@Description(text = "Terminates after the given number of fitness calls.")
public class EvaluationTerminator implements InterfaceTerminator,
Serializable {
private String msg = "Not terminated.";
/**
* Number of fitness calls on the problem which is optimized.
*/
protected int m_FitnessCalls = 1000;
protected int maxFitnessCalls = 1000;
public EvaluationTerminator() {
}
@ -43,17 +31,13 @@ public class EvaluationTerminator implements InterfaceTerminator,
msg = "Not terminated.";
}
public static String globalInfo() {
return "Terminates after the given number of fitness calls.";
}
/**
* Construct Terminator with a maximum number of fitness calls.
*
* @param maximum number of fitness calls
*/
public EvaluationTerminator(int x) {
m_FitnessCalls = x;
maxFitnessCalls = x;
}
@Override
@ -62,12 +46,11 @@ public class EvaluationTerminator implements InterfaceTerminator,
}
@Override
public boolean isTerminated(PopulationInterface pop) {
//System.out.println("m_FitnessCalls="+m_FitnessCalls);
if (m_FitnessCalls > pop.getFunctionCalls()) {
public boolean isTerminated(PopulationInterface population) {
if (maxFitnessCalls > population.getFunctionCalls()) {
return false;
} else {
msg = m_FitnessCalls + " fitness calls were reached.";
msg = maxFitnessCalls + " fitness calls were reached.";
return true;
}
}
@ -79,18 +62,18 @@ public class EvaluationTerminator implements InterfaceTerminator,
@Override
public String toString() {
String ret = "EvaluationTerminator,calls=" + m_FitnessCalls;
String ret = "EvaluationTerminator,calls=" + maxFitnessCalls;
return ret;
}
public void setFitnessCalls(int x) {
//System.out.println("setFitnessCalls"+x);
m_FitnessCalls = x;
maxFitnessCalls = x;
}
public int getFitnessCalls() {
//System.out.println("getFitnessCalls"+m_FitnessCalls);
return m_FitnessCalls;
//System.out.println("getFitnessCalls"+maxFitnessCalls);
return maxFitnessCalls;
}
/**

View File

@ -1,31 +1,23 @@
package eva2.optimization.operator.terminators;
/*
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 319 $
* $Date: 2007-12-05 11:29:32 +0100 (Wed, 05 Dec 2007) $
* $Author: mkron $
*/
import eva2.optimization.go.InterfaceTerminator;
import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.PopulationInterface;
import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
import java.io.Serializable;
/**
*
*/
@Description(text = "Terminate after the given number of generations")
public class GenerationTerminator implements InterfaceTerminator, Serializable {
/**
* Number of fitness calls on the problem which is optimized
*/
protected int m_Generations = 100;
protected int maxGenerations = 100;
private String msg = "";
@Override
@ -33,15 +25,11 @@ public class GenerationTerminator implements InterfaceTerminator, Serializable {
msg = "Not terminated.";
}
public static String globalInfo() {
return "Terminate after the given number of generations";
}
public GenerationTerminator() {
}
public GenerationTerminator(int gens) {
m_Generations = gens;
maxGenerations = gens;
}
@Override
@ -51,8 +39,8 @@ public class GenerationTerminator implements InterfaceTerminator, Serializable {
@Override
public boolean isTerminated(PopulationInterface Pop) {
if (m_Generations < Pop.getGeneration()) {
msg = m_Generations + " generations reached.";
if (maxGenerations < Pop.getGeneration()) {
msg = maxGenerations + " generations reached.";
return true;
}
return false;
@ -65,16 +53,16 @@ public class GenerationTerminator implements InterfaceTerminator, Serializable {
@Override
public String toString() {
String ret = "Generations calls=" + m_Generations;
String ret = "Generations calls=" + maxGenerations;
return ret;
}
public void setGenerations(int x) {
m_Generations = x;
maxGenerations = x;
}
public int getGenerations() {
return m_Generations;
return maxGenerations;
}
/**

View File

@ -323,7 +323,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
@Override
public Object clone() {
return (Object) new Population(this);
return new Population(this);
}
/**
@ -675,17 +675,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
return this.functionCallCount;
}
/**
* This method set the current number of function calls performed. Use with
* care
*
* @param d The new number of functioncalls.
* @deprecated
*/
public void SetFunctionCalls(int d) {
this.functionCallCount = d;
}
/**
* This method set the current number of function calls performed. Use with
* care
@ -741,17 +730,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
return this.generationCount;
}
/**
* This method sets the generation.
*
* @param gen the value to set as new generation index
* @see setGeneration
* @deprecated
*/
public void setGenerationTo(int gen) {
this.generationCount = gen;
}
/**
* This method sets the generation.
*

View File

@ -507,8 +507,8 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
int calls = getMainSwarm().getPopulation().getFunctionCalls();
getMainSwarm().setPopulation(pop);
getMainSwarm().populationSizeHasChanged();
getMainSwarm().getPopulation().setGenerationTo(generations);
getMainSwarm().getPopulation().SetFunctionCalls(calls);
getMainSwarm().getPopulation().setGeneration(generations);
getMainSwarm().getPopulation().setFunctionCalls(calls);
}
/**
@ -768,7 +768,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
// }
// set correct number of generations
metapop.setGenerationTo(getMainSwarm().getPopulation().getGeneration());
metapop.setGeneration(getMainSwarm().getPopulation().getGeneration());
// set correct number of function calls
int calls = getMainSwarm().getPopulation().getFunctionCalls();
@ -780,7 +780,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
}
// calls from inactivated subswarms were transfered to the mainswarm, see useAsSubSwarms method
metapop.SetFunctionCalls(calls);
metapop.setFunctionCalls(calls);
return metapop;
}

View File

@ -806,7 +806,7 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ
// The events of the interim hill climbing population will be caught here
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
// set funcalls to real value
refSet.SetFunctionCalls(((Population) source).getFunctionCalls());
refSet.setFunctionCalls(((Population) source).getFunctionCalls());
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));

View File

@ -572,7 +572,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
System.out.println("-Deme " + i + " size: " + ((Population) this.species.get(i)).size());
}
curSpecies = ((Population) this.species.get(i));
curSpecies.SetFunctionCalls(0);
curSpecies.setFunctionCalls(0);
curSpecies.synchSize();
// if (isActive(curSpecies)) { // Lets have only active species...
if ((haltingWindow > 0) && (this.testSpeciesForConvergence(curSpecies))) {
@ -969,7 +969,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
spec1.SetHistory(spec2.getHistory());
}
if (spec2.getGeneration() > spec1.getGeneration()) {
spec1.setGenerationTo(spec2.getGeneration());
spec1.setGeneration(spec2.getGeneration());
}
// possibly notify the optimizer of the merging event to merge population based information
if (optimizer instanceof InterfaceSpeciesAware) {
@ -989,10 +989,10 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
newSp.setTargetSize(newSp.size());
newSp.setUseHistory(true);
if (startAtP1Gen) { // start explicitely as a child population of p1
newSp.setGenerationTo(parentSp.getGeneration());
newSp.setGeneration(parentSp.getGeneration());
newSp.SetHistory((LinkedList<AbstractEAIndividual>) parentSp.getHistory().clone());
} else { // start anew (from undiff)
newSp.setGenerationTo(0);
newSp.setGeneration(0);
newSp.SetHistory(new LinkedList<AbstractEAIndividual>());
}

View File

@ -212,7 +212,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
System.out.println("num inds after clusterLS: " + m_Population.size());
}
popD.head().setGenerationTo(m_Population.getGeneration() + 1);
popD.head().setGeneration(m_Population.getGeneration() + 1);
if (doReinitialization && (improvement < minImprovement)) {
if (TRACE) {
@ -229,7 +229,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
}
// store results
archive.SetFunctionCalls(m_Population.getFunctionCalls());
archive.setFunctionCalls(m_Population.getFunctionCalls());
archive.addPopulation(m_Population);
Population tmpPop = new Population();
@ -268,7 +268,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
// System.out.println("bla");
// }
// set funcalls to real value
m_Population.SetFunctionCalls(((Population) source).getFunctionCalls());
m_Population.setFunctionCalls(((Population) source).getFunctionCalls());
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
}
@ -303,8 +303,8 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
Population tmp = new Population();
tmp.addPopulation(archive);
tmp.addPopulation(m_Population);
tmp.SetFunctionCalls(m_Population.getFunctionCalls());
tmp.setGenerationTo(m_Population.getGeneration());
tmp.setFunctionCalls(m_Population.getFunctionCalls());
tmp.setGeneration(m_Population.getGeneration());
// tmp = PostProcessInterim.clusterBest(tmp, sigma, 0, PostProcessInterim.KEEP_LONERS, PostProcessInterim.BEST_ONLY);
return new SolutionSet(m_Population, tmp);
}

View File

@ -318,7 +318,6 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
esIndy = (InterfaceDataTypeDouble) indy;
} catch (java.lang.ClassCastException e) {
throw new RuntimeException("Differential Evolution currently requires InterfaceESIndividual as basic data type!");
// return (AbstractEAIndividual)((AbstractEAIndividual)pop.get(RNG.randomInt(0, pop.size()-1))).getClone();
}
double[] nX, vX, oX;
oX = esIndy.getDoubleData();
@ -368,9 +367,8 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
parents.add(bestIndy);
} // Add best instead of preselected
double[] delta1 = this.fetchDeltaRandom(pop);
double[] delta2 = this.fetchDeltaRandom(pop);
for (int i = 0; i < oX.length; i++) {
vX[i] = oX[i] + this.getCurrentF() * (delta1[i] - delta2[i]);
vX[i] = oX[i] + this.getCurrentF() * delta1[i];
}
break;
}
@ -383,10 +381,8 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
} // Add best instead of preselected
double[] delta1 = this.fetchDeltaRandom(pop);
double[] delta2 = this.fetchDeltaRandom(pop);
double[] delta3 = this.fetchDeltaRandom(pop);
double[] delta4 = this.fetchDeltaRandom(pop);
for (int i = 0; i < oX.length; i++) {
vX[i] = oX[i] + this.getCurrentF() * (delta1[i] - delta2[i]) + this.getCurrentF() * (delta3[i] - delta4[i]);
vX[i] = oX[i] + this.getCurrentF() * delta1[i] + this.getCurrentF() * delta2[i];
}
break;
}

View File

@ -704,7 +704,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
private void setGeneration(int gen, Population[] pops) {
for (int i = 0; i < pops.length; i++) {
pops[i].setGenerationTo(gen);
pops[i].setGeneration(gen);
}
}
@ -924,7 +924,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
// (few) duplicates may happen because parents are copied to another peak population
// if a cluster had a size of 1 AND parents may survive due to elitism.
pop.addPopulation(pi, false);
// if (i==0) pop.setGenerationTo(pi.getGeneration());
// if (i==0) pop.setGeneration(pi.getGeneration());
// else if (pop.getGeneration()!=pi.getGeneration()) System.err.println("Error, mismatching generation in collectPopulation");
}
if (immigrants != null) {
@ -1301,7 +1301,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
System.err.println("Warning, mismatching population in " + this.getClass().getName());
}
if (name.equals(Population.FUN_CALL_INTERVAL_REACHED)) {
// getPopulation().SetFunctionCalls(((Population)source).getFunctionCalls()); // this is ugly and I dont know what its for.. possibly if the population instance changes along the GUi?
// getPopulation().setFunctionCalls(((Population)source).getFunctionCalls()); // this is ugly and I dont know what its for.. possibly if the population instance changes along the GUi?
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} else {
// this may come from cloned instances with the same listener - should not happen since they are removed.

View File

@ -259,7 +259,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
@Override
public void registerPopulationStateChanged(Object source, String name) {
if (name.equals(Population.FUN_CALL_INTERVAL_REACHED)) {
getPopulation().SetFunctionCalls(((Population) source).getFunctionCalls()); // TODO this is ugly
getPopulation().setFunctionCalls(((Population) source).getFunctionCalls()); // TODO this is ugly
super.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
} else {
// System.err.println("Not forwarding event " + name);

View File

@ -25,7 +25,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
private InterfaceOptimizationProblem m_Problem = new B1Problem();
private InterfaceMutation mutator = null;
// private int m_MultiRuns = 100;
// private int m_FitnessCalls = 100;
// private int maxFitnessCalls = 100;
// private int m_FitnessCallsNeeded = 0;
// GAIndividualBinaryData m_Best, m_Test;
// These variables are necessary for the more complex LectureGUI enviroment
@ -158,12 +158,12 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
// /** This method will optimize
// */
// public void defaultOptimize() {
// for (int i = 0; i < m_FitnessCalls; i++) {
// for (int i = 0; i < maxFitnessCalls; i++) {
// this.m_Test = (GAIndividualBinaryData)((this.m_Best).clone());
// this.m_Test.defaultMutate();
// if (this.m_Test.defaultEvaulateAsMiniBits() < this.m_Best.defaultEvaulateAsMiniBits()) this.m_Best = this.m_Test;
// this.m_FitnessCallsNeeded = i;
// if (this.m_Best.defaultEvaulateAsMiniBits() == 0) i = this.m_FitnessCalls +1;
// if (this.m_Best.defaultEvaulateAsMiniBits() == 0) i = this.maxFitnessCalls +1;
// }
// }
// /** This main method will start a simple hillclimber.
@ -181,7 +181,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
// }
// TmpMeanCalls = TmpMeanCalls/program.m_MultiRuns;
// TmpMeanFitness = TmpMeanFitness/program.m_MultiRuns;
// System.out.println("("+program.m_MultiRuns+"/"+program.m_FitnessCalls+") Mean Fitness : " + TmpMeanFitness + " Mean Calls needed: " + TmpMeanCalls);
// System.out.println("("+program.m_MultiRuns+"/"+program.maxFitnessCalls+") Mean Fitness : " + TmpMeanFitness + " Mean Calls needed: " + TmpMeanCalls);
// }
/**

View File

@ -160,7 +160,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer,
}
}
// eigentlich muss hier noch subsetsize drauf, aber lassen wir das
gop.SetFunctionCalls(gop.getFunctionCalls()
gop.setFunctionCalls(gop.getFunctionCalls()
+ (int) Math.round(localSearchSteps * cost * subset.size()));
if (TRACE) {

View File

@ -93,7 +93,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
m_Population.getEAIndividual(i).defaultInit(null);
}
this.m_Population.SetFunctionCalls(original.getFunctionCalls());
this.m_Population.setFunctionCalls(original.getFunctionCalls());
this.m_Problem.evaluate(this.m_Population);
for (int i = 0; i < this.m_Population.size(); i++) {
if (((AbstractEAIndividual) original.get(i)).isDominatingDebConstraints(((AbstractEAIndividual) this.m_Population.get(i)))) {

View File

@ -233,7 +233,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable {
// Kinder erzeugen
Population children = new Population(m_lambdamo * m_lambda);
children.setGenerationTo(m_Population.getGeneration());
children.setGeneration(m_Population.getGeneration());
for (int j = 0; j < children.getTargetSize(); j++) {
AbstractEAIndividual parent = m_Population.getEAIndividual(j

View File

@ -241,7 +241,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
setMainSwarmSize(mainSwarmSize); // (particles are initialized later via init)
getMainSwarm().setProblem(m_Problem);
getMainSwarm().SetMaxAllowedSwarmRadius(maxAllowedSwarmRadius);
getMainSwarm().getPopulation().setGenerationTo(0);
getMainSwarm().getPopulation().setGeneration(0);
// choose PSO-type for the mainswarmoptimizer
getMainSwarm().setGcpso(false);
@ -767,7 +767,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
}
// set correct number of generations
metapop.setGenerationTo(getMainSwarm().getPopulation().getGeneration());
metapop.setGeneration(getMainSwarm().getPopulation().getGeneration());
// set correct number of function calls
int calls = getMainSwarm().getPopulation().getFunctionCalls();
@ -776,7 +776,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
// calls from inactive populations have to be counted as well...
calls += currentsubswarm.getPopulation().getFunctionCalls();
}
metapop.SetFunctionCalls(calls);
metapop.setFunctionCalls(calls);
// care for consistent size:
metapop.synchSize();
return metapop;
@ -816,7 +816,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
System.out.println("Active populations: " + activeCnt);
}
// set correct number of generations
metapop.setGenerationTo(getMainSwarm().getPopulation().getGeneration());
metapop.setGeneration(getMainSwarm().getPopulation().getGeneration());
// set correct number of function calls
int calls = getMainSwarm().getPopulation().getFunctionCalls();
@ -824,7 +824,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
calls += getSubSwarms().get(i).getPopulation().getFunctionCalls();
}
// System.out.println("metapop size " + metapop.size());
metapop.SetFunctionCalls(calls);
metapop.setFunctionCalls(calls);
if (metapop.size() == 0) {
System.err.println("NichePSO ERROR! " + metapop.getFunctionCalls());
@ -858,8 +858,8 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
if (returnRepresentativeSolutionsOnly) {
Population sols = getSubswarmRepresentatives(false);
Population metapop = getPopulation();
sols.SetFunctionCalls(metapop.getFunctionCalls());
sols.setGenerationTo(metapop.getGeneration());
sols.setFunctionCalls(metapop.getFunctionCalls());
sols.setGeneration(metapop.getGeneration());
return new SolutionSet(metapop, sols);
} else {
Population metapop = getPopulation();
@ -869,8 +869,8 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
AbstractEAIndividual pbest = (AbstractEAIndividual) indy.getData("PersonalBestKey");
sols.add(pbest);
}
sols.SetFunctionCalls(metapop.getFunctionCalls());
sols.setGenerationTo(metapop.getFunctionCalls());
sols.setFunctionCalls(metapop.getFunctionCalls());
sols.setGeneration(metapop.getFunctionCalls());
return new SolutionSet(sols);
}
}

View File

@ -507,7 +507,7 @@ public class PDDifferentialEvolution implements InterfaceOptimizer, java.io.Seri
children.add(indy);
}
children.setGenerationTo(m_Population.getGeneration());
children.setGeneration(m_Population.getGeneration());
m_Problem.evaluate(children);
/**

View File

@ -181,8 +181,8 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S
}
}
parents.SetFunctionCalls(pop.getFunctionCalls());
parents.setGenerationTo(pop.getGeneration());
parents.setFunctionCalls(pop.getFunctionCalls());
parents.setGeneration(pop.getGeneration());
if (withShow) {
drawPop(parents, 3, true);

View File

@ -199,7 +199,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
// System.out.println("bla");
// }
// set funcalls to real value
refSet.SetFunctionCalls(((Population) source).getFunctionCalls());
refSet.setFunctionCalls(((Population) source).getFunctionCalls());
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));

View File

@ -596,8 +596,8 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
TribesPosition tp = iterator.next();
all.add(positionToExplorer(tp));
}
all.SetFunctionCalls(population.getFunctionCalls());
all.setGenerationTo(population.getGeneration());
all.setFunctionCalls(population.getFunctionCalls());
all.setGeneration(population.getGeneration());
//all.addPopulation(pop);
return new SolutionSet(population, all);
}

View File

@ -159,7 +159,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
private void communicate() {
int oldFunctionCalls;
this.m_Population.clear();
this.m_Population.SetFunctionCalls(0);
this.m_Population.setFunctionCalls(0);
Population pop;
// first collect all the data
pop = (Population) this.m_MOOptimizer.getPopulation().clone();
@ -172,7 +172,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
}
oldFunctionCalls = this.m_Population.getFunctionCalls();
this.m_Problem.evaluate(this.m_Population);
this.m_Population.SetFunctionCalls(oldFunctionCalls);
this.m_Population.setFunctionCalls(oldFunctionCalls);
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
// double plotValue = (this.problem.getDoublePlotValue(this.population)).doubleValue();
// now they are synchronized lets migrate