diff --git a/src/eva2/optimization/modules/ModuleAdapter.java b/src/eva2/optimization/modules/ModuleAdapter.java index b3d599ec..ce7684d2 100644 --- a/src/eva2/optimization/modules/ModuleAdapter.java +++ b/src/eva2/optimization/modules/ModuleAdapter.java @@ -1,15 +1,4 @@ package eva2.optimization.modules; -/* - * Title: EvA2 - * Description: - * Copyright: Copyright (c) 2003 - * Company: University of Tuebingen, Computer Architecture - * @author Holger Ulmer, Felix Streichert, Hannes Planatscher - * @version: $Revision: 272 $ - * $Date: 2007-11-21 18:06:36 +0100 (Wed, 21 Nov 2007) $ - * $Author: mkron $ - */ - import eva2.gui.EvATabbedFrameMaker; import eva2.optimization.OptimizationStateListener; import eva2.optimization.stat.OptimizationJob; diff --git a/src/eva2/optimization/strategies/ParticleSwarmOptimization.java b/src/eva2/optimization/strategies/ParticleSwarmOptimization.java index af733b32..d6e1eb74 100644 --- a/src/eva2/optimization/strategies/ParticleSwarmOptimization.java +++ b/src/eva2/optimization/strategies/ParticleSwarmOptimization.java @@ -155,25 +155,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se topology = topo; } - // /** -// * Constructor for most common parameters with constriction based approach and local search. -// * -// * @param popSize swarm size -// * @param p1 the value for phi1 -// * @param p2 the value for phi1 -// * @param topo type of the neighbourhood topology -// * @param topoRange range of the neighbourhood topology -// * @param lsEveryNGens interval of local search steps in generations -// * @param stepsPerInd number of local search steps per individual -// * @param candidateRatio ratio of population on which local search is performed -// */ -// public ParticleSwarmOptimization(int popSize, double p1, double p2, PSOTopologyEnum topo, int topoRange, int lsEveryNGens, int stepsPerInd, double candidateRatio) { -// this(popSize, p1, p2, topo, topoRange); -// setDoLocalSearch(true); -// localSearchGens=lsEveryNGens; -// lsStepsPerInd=stepsPerInd; -// lsCandidateRatio = candidateRatio; -// } @Override public Object clone() { return (Object) new ParticleSwarmOptimization(this); @@ -539,9 +520,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se if (emaPeriods > 0) { traceEMA(population); } -// AbstractEAIndividual indy = population.getBestEAIndividual(); - //System.out.println("best ind at " + indy.getStringRepresentation() + " , fit is " + indy.getFitness(0)); - //try { Thread.sleep(10); } catch(Exception e) {} } public static void dumpPop(String prefix, Population pop) { @@ -681,30 +659,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se this.plot.setConnectedPoint(curPosition[0], curPosition[1], index); this.plot.setConnectedPoint(curPosition[0] + curVelocity[0], curPosition[1] + curVelocity[1], index); } - -// plot = null; -// show(); -// if (pop.getGeneration()%15 == 0) { -// this.plot.clearAll(); -// plot.setUnconnectedPoint(-10, -10, 0); -// plot.setUnconnectedPoint(10, 10, 0); -// } - -// if (index != 0) return; -// double[] bestPosition = (double[])bestIndividual.getData(partBestPosKey); -// double[] localBestPos = findNeighbourhoodOptimum(index, population); -// this.plot.setConnectedPoint(curPosition[0], curPosition[1], index+1); -// this.plot.setConnectedPoint(curPosition[0] + curVelocity[0], curPosition[1] + curVelocity[1], index+1); -// this.plot.setConnectedPoint(curPosition[0], curPosition[1], index+2); -// this.plot.setConnectedPoint(bestPosition[0], bestPosition[1], index+2); -// this.plot.setConnectedPoint(curPosition[0], curPosition[1], index+3); -// this.plot.setConnectedPoint(localBestPos[0], localBestPos[1], index+3); - - // this.plot.setConnectedPoint(curPosition[0], curPosition[1], index+1); - // this.plot.setConnectedPoint(localBestPosition[0], localBestPosition[1], index+1); - // this.plot.setConnectedPoint(curPosition[0], curPosition[1], index+1); - // this.plot.setConnectedPoint(bestPosition[0], bestPosition[1], index+1); - // this.plot.setUnconnectedPoint(curPosition[0], curPosition[1], 100*index+1); } } @@ -720,7 +674,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se if (isIndividualToUpdate(indy)) { updateIndProps(indy, indy); indy.putData(lastSuccessKey, indy.getData(partVelKey)); -// System.err.println("updated " + i + " - "+ getParticleInfo(indy)); } else { indy.putData(lastSuccessKey, null); } @@ -733,9 +686,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * @param indy */ protected void resetFitness(AbstractEAIndividual indy) { -// double[] fit = new double[1]; -// fit[0] = 0; -// indy.SetFitness(fit); indy.resetFitness(0); indy.resetConstraintViolation(); } @@ -775,46 +725,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se * @return */ protected double[] updateVelocity(int index, double[] lastVelocity, double[] personalBestPos, double[] curPosition, double[] neighbourBestPos, double[][] range) { -// for (int i = 0; i < lastVelocity.length; i++) { -// socCogn[i] = (personalBestPos[i]-curPosition[i]); -// neiDiff[i] = (neighbourBestPos[i]-curPosition[i]); -// } -// -// System.out.println("-- len bef " + vecLen(socCogn)); -// rotateAllAxes(socCogn, .5, false); -// System.out.println("-- len aft " + vecLen(socCogn)); -// rotateAllAxes(neiDiff, .5, false); -// // TODO!!! -// if (algType.getSelectedTag().getID()==1) chi=inertnessOrChi; -// else chi = 1.; -// -// double scaleCog = this.phi1*chi*RNG.randomDouble(0,1); -// double scaleNei = this.phi2*chi*RNG.randomDouble(0,1); -// -// -// for (int i=0; i " + vecSum.toString()); -// } - /** * Return a random vector after a gaussian distribution oriented along dir, * meaning that variance is len(dir) along dir and len(dir)/scale in any @@ -1620,26 +1459,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se return links; } -// /** -// * Randomly assign groups of size groupSize. -// * -// * @param links -// * @param groupSize -// */ -// private int[] regroupSwarm(Population pop, int groupSize) { -// int groupIndex, numGroups = pop.size() / groupSize; // truncated integer: last group is larger -//// int hangover = pop.size()-(numGroups*groupSize); // Ueberhangmandate ... woanders zuteilen um einergruppen zu vermeiden -// -// int[] perm = RNG.randomPerm(pop.size()); -// -// for (int k=0; k=numGroups) groupIndex--; -// pop.getEAIndividual(perm[k]).putData(dmsGroupIndexKey, groupIndex); -// } -// return perm; -// } - /** * This method is simply for debugging. */ @@ -2083,13 +1902,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se return "if activated, the speed limit is enforced for the particles"; } -// public int getEMAPeriods() { -// return emaPeriods; -// } -// public void setEMAPeriods(int emaP) { -// this.emaPeriods = emaP; -// } - /** * @return the sleepTime */ @@ -2140,14 +1952,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se this.treeStruct = treeStruct; } - // This was for testing rotation operators -// public boolean isUseAlternative() { -// return useAlternative; -// } -// -// public void setUseAlternative(boolean useAlternative) { -// this.useAlternative = useAlternative; -// } public boolean isWrapTopology() { return wrapTopology; } @@ -2239,13 +2043,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se return "The number of generations after which new subswarms are randomly formed."; } - // public boolean isDoLocalSearch() { -// return doLocalSearch; -// } -// -// public void setDoLocalSearch(boolean doLocalSearch) { -// this.doLocalSearch = doLocalSearch; -// } @Override public String[] getAdditionalDataHeader() { if (emaPeriods > 0) {