Improve handling of externally set initial population in PSO - minor change.
This commit is contained in:
parent
a8234302f0
commit
4ecb159d5e
@ -1,50 +1,51 @@
|
||||
package eva2.server.go.enums;
|
||||
|
||||
public enum PSOTopologyEnum {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
linear,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
grid,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
star,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
multiSwarm,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
tree,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
hpso,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
random;
|
||||
|
||||
/**
|
||||
* A method to translate the "old" integer tags into the enum type.
|
||||
* @param oldID
|
||||
* @return
|
||||
*/
|
||||
public static PSOTopologyEnum translateOldID(int oldID) {
|
||||
switch (oldID) {
|
||||
case 0: return linear;
|
||||
case 1: return grid;
|
||||
case 2: return star;
|
||||
case 3: return multiSwarm;
|
||||
case 4: return tree;
|
||||
case 5: return hpso;
|
||||
case 6: return random;
|
||||
}
|
||||
return random;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
linear,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
grid,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
star,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
multiSwarm,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
tree,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
hpso,
|
||||
/**
|
||||
*
|
||||
*/
|
||||
random;
|
||||
|
||||
/**
|
||||
* A method to translate the "old" integer tags into the enum type.
|
||||
* @param oldID
|
||||
* @return
|
||||
*/
|
||||
public static PSOTopologyEnum translateOldID(int oldID) {
|
||||
switch (oldID) {
|
||||
case 0: return linear;
|
||||
case 1: return grid;
|
||||
case 2: return star;
|
||||
case 3: return multiSwarm;
|
||||
case 4: return tree;
|
||||
case 5: return hpso;
|
||||
case 6: return random;
|
||||
default: System.err.println("Error: invalid old topology ID in PSOTopologyEnum translateOldID! Returning grid.");
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user