Cosmetics
This commit is contained in:
parent
b9d392738d
commit
3e948f3807
@ -1190,11 +1190,11 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addSortedIndicesTo(Population pop) {
|
protected void addSortedIndicesTo(Object[] sortedPopulation, Population pop) {
|
||||||
int origIndex;
|
int origIndex;
|
||||||
for (int i=0; i<pop.size(); i++) {
|
for (int i=0; i<pop.size(); i++) {
|
||||||
// cross-link the sorted list for faster access
|
// cross-link the sorted list for faster access
|
||||||
origIndex = (Integer)((AbstractEAIndividual)sortedPop[i]).getData(indexKey);
|
origIndex = (Integer)((AbstractEAIndividual)sortedPopulation[i]).getData(indexKey);
|
||||||
((AbstractEAIndividual)pop.get(origIndex)).SetData(sortedIndexKey, new Integer(i));
|
((AbstractEAIndividual)pop.get(origIndex)).SetData(sortedIndexKey, new Integer(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1206,7 +1206,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
sortedPop = pop.toArray();
|
sortedPop = pop.toArray();
|
||||||
if ((topoID == 3) || (treeStruct>=2)) Arrays.sort(sortedPop, new AbstractEAIndividualComparator());
|
if ((topoID == 3) || (treeStruct>=2)) Arrays.sort(sortedPop, new AbstractEAIndividualComparator());
|
||||||
else Arrays.sort(sortedPop, new AbstractEAIndividualComparator(partBestFitKey));
|
else Arrays.sort(sortedPop, new AbstractEAIndividualComparator(partBestFitKey));
|
||||||
addSortedIndicesTo(pop);
|
addSortedIndicesTo(sortedPop, pop);
|
||||||
}
|
}
|
||||||
if (topoID == 3) {
|
if (topoID == 3) {
|
||||||
// prepare multi swarm topology
|
// prepare multi swarm topology
|
||||||
|
Loading…
x
Reference in New Issue
Block a user