Constants.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package psoAlgoCode;
  2. public class Constants {
  3. // Constants PSO
  4. public static double ALPHA1 = 2;
  5. public static double ALPHA2 = 2;
  6. public static int SWARM_SIZE = 20;
  7. public static int MAX_ITERATION = 100;
  8. public static double PHI = 2.01;
  9. public static double RMU = 1.0;
  10. // 0 = Sphere function, 1 = Rastrigin, 2 = Griewank. Only for problems with
  11. // double as input
  12. public static int function = 0;
  13. // Constants Chart
  14. public static int ROUNDS = 1;
  15. // Variables PSO
  16. public static double START_OMEGA = 0.7;//1.2;//0.7;
  17. public static double END_OMEGA = 0.4;//0.2;//0.4;
  18. public static double DIFF_OMEGA = ((START_OMEGA - END_OMEGA) / MAX_ITERATION);
  19. // Dimensions determines the length of the
  20. public static int DIMENSIONS = 0;
  21. public static void setDimensions(int dim) {
  22. DIMENSIONS = dim;
  23. }
  24. public static void setAlpha1(double alpha) {
  25. ALPHA1 = alpha;
  26. }
  27. public static void setAlpha2(double alpha) {
  28. ALPHA2 = alpha;
  29. }
  30. public static void setSwarmSize(int size) {
  31. SWARM_SIZE = size;
  32. }
  33. public static void setMaxIt(int it) {
  34. MAX_ITERATION = it;
  35. }
  36. public static void setRounds(int rounds) {
  37. ROUNDS = rounds;
  38. }
  39. public static void setPhi(double phi) {
  40. PHI = phi;
  41. }
  42. public static void setRMU(double rmu) {
  43. RMU = rmu;
  44. }
  45. }