Network_def.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Network_def.h
  2. *
  3. * Copyright (C) 2009-2018 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define ooSTRUCT NetworkNode
  19. oo_DEFINE_STRUCT (NetworkNode)
  20. oo_DOUBLE (x)
  21. oo_DOUBLE (y)
  22. oo_BOOLEAN (clamped)
  23. oo_DOUBLE (activity)
  24. #if ! oo_READING && ! oo_WRITING
  25. oo_DOUBLE (excitation)
  26. #endif
  27. oo_END_STRUCT (NetworkNode)
  28. #undef ooSTRUCT
  29. #define ooSTRUCT NetworkConnection
  30. oo_DEFINE_STRUCT (NetworkConnection)
  31. oo_INTEGER (nodeFrom)
  32. oo_INTEGER (nodeTo)
  33. oo_DOUBLE (weight)
  34. oo_FROM (1)
  35. oo_DOUBLE (plasticity)
  36. oo_ENDFROM
  37. #if oo_READING
  38. oo_VERSION_UNTIL (1)
  39. our plasticity = 1.0;
  40. oo_VERSION_END
  41. #endif
  42. oo_END_STRUCT (NetworkConnection)
  43. #undef ooSTRUCT
  44. #define ooSTRUCT Network
  45. oo_DEFINE_CLASS (Network, Daata)
  46. oo_DOUBLE (minimumActivity)
  47. oo_DOUBLE (maximumActivity)
  48. oo_FROM (3)
  49. oo_BYTE (dummyActivitySpreadingRule)
  50. oo_ENDFROM
  51. oo_FROM (4)
  52. oo_DOUBLE (shunting)
  53. oo_ENUM (kNetwork_activityClippingRule, activityClippingRule)
  54. oo_ENDFROM
  55. oo_DOUBLE (spreadingRate)
  56. oo_DOUBLE (activityLeak)
  57. oo_DOUBLE (minimumWeight)
  58. oo_DOUBLE (maximumWeight)
  59. oo_FROM (2)
  60. oo_BYTE (dummyWeightUpdateRule)
  61. oo_ENDFROM
  62. oo_DOUBLE (learningRate)
  63. oo_FROM (5)
  64. oo_DOUBLE (instar)
  65. oo_DOUBLE (outstar)
  66. oo_ENDFROM
  67. oo_DOUBLE (weightLeak)
  68. #if oo_READING
  69. oo_VERSION_UNTIL (5)
  70. if (our learningRate != 0.0) our weightLeak /= our learningRate;
  71. if (our dummyWeightUpdateRule == 1) our instar = 1.0, our outstar = 0.0;
  72. if (our dummyWeightUpdateRule == 2) our instar = 0.0, our outstar = 1.0;
  73. if (our dummyWeightUpdateRule == 3) our instar = 0.5, our outstar = 0.5;
  74. oo_VERSION_END
  75. oo_VERSION_UNTIL (6)
  76. our activityLeak = - our activityLeak; // convert self-excitation to activity leak
  77. oo_VERSION_END
  78. #endif
  79. oo_DOUBLE (xmin)
  80. oo_DOUBLE (xmax)
  81. oo_DOUBLE (ymin)
  82. oo_DOUBLE (ymax)
  83. oo_INTEGER (numberOfNodes)
  84. oo_STRUCT_VECTOR (NetworkNode, nodes, numberOfNodes)
  85. oo_INTEGER (numberOfConnections)
  86. oo_STRUCT_VECTOR (NetworkConnection, connections, numberOfConnections)
  87. #if oo_DECLARING
  88. void v_info ()
  89. override;
  90. #endif
  91. oo_END_CLASS (Network)
  92. #undef ooSTRUCT
  93. /* End of file Network_def.h */