Improve handling of externally set initial population in PSO - minor change.

This commit is contained in:
Marcel Kronfeld 2009-05-04 15:49:31 +00:00
parent a8234302f0
commit 4ecb159d5e

View File

@ -1,50 +1,51 @@
package eva2.server.go.enums; package eva2.server.go.enums;
public enum PSOTopologyEnum { public enum PSOTopologyEnum {
/** /**
* *
*/ */
linear, linear,
/** /**
* *
*/ */
grid, grid,
/** /**
* *
*/ */
star, star,
/** /**
* *
*/ */
multiSwarm, multiSwarm,
/** /**
* *
*/ */
tree, tree,
/** /**
* *
*/ */
hpso, hpso,
/** /**
* *
*/ */
random; random;
/** /**
* A method to translate the "old" integer tags into the enum type. * A method to translate the "old" integer tags into the enum type.
* @param oldID * @param oldID
* @return * @return
*/ */
public static PSOTopologyEnum translateOldID(int oldID) { public static PSOTopologyEnum translateOldID(int oldID) {
switch (oldID) { switch (oldID) {
case 0: return linear; case 0: return linear;
case 1: return grid; case 1: return grid;
case 2: return star; case 2: return star;
case 3: return multiSwarm; case 3: return multiSwarm;
case 4: return tree; case 4: return tree;
case 5: return hpso; case 5: return hpso;
case 6: return random; case 6: return random;
} default: System.err.println("Error: invalid old topology ID in PSOTopologyEnum translateOldID! Returning grid.");
return random; return grid;
} }
}
} }