model_properties.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. def LI(width: int, depth: int) -> dict:
  2. properties = {}
  3. properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
  4. properties["External Incoming Connections"] = width * (depth - 1) + 1
  5. properties["External Outgoing Connections"] = depth
  6. properties["Internal Connections"] = 0
  7. properties["Events"] = (width - 1) * (depth - 1) + 1
  8. return properties
  9. def HI(width: int, depth: int) -> dict:
  10. properties = {}
  11. properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
  12. properties["External Incoming Connections"] = width * (depth - 1) + 1
  13. properties["External Outgoing Connections"] = depth
  14. properties["Internal Connections"] = (width - 2) * (depth - 1) if width > 2 else 0
  15. properties["Events"] = 1 + (depth - 1) * ((width - 1) * width) / 2
  16. return properties
  17. def HO(width: int, depth: int) -> dict:
  18. properties = {}
  19. properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
  20. properties["External Incoming Connections"] = (width + 1) * (depth - 1) + 1
  21. properties["External Outgoing Connections"] = width * (depth - 1) + 1
  22. properties["Internal Connections"] = (width - 2) * (depth - 1) if width > 2 else 0
  23. properties["Events"] = 1 + (depth - 1) * ((width - 1) * width) / 2
  24. return properties
  25. def HOmod(width: int, depth: int) -> dict:
  26. properties = {}
  27. properties["Atomic Models"] = (width - 1 + ((width - 1) * width) / 2) * (depth - 1) + 1
  28. properties["External Incoming Connections"] = (2 * (width - 1) + 1) * (depth - 1) + 1
  29. properties["External Outgoing Connections"] = depth
  30. properties["Internal Connections"] = ((width - 1) ** 2 + ((width - 1) * width) / 2) * (depth - 1)
  31. properties["Events"] = 1
  32. for i in range(1, depth):
  33. e = (1 + (i - 1) * (width - 1)) * ((width - 1) * width) / 2 + (width - 1) * (width + (i - 1) * (width - 1))
  34. properties["Events"] += e
  35. return properties
  36. def dLI(width: int, depth: int) -> dict:
  37. properties = LI(width, depth)
  38. properties["Created"] = (width - 1) * (depth - 1)
  39. properties["Connected"] = (width - 1) * (depth - 1)
  40. return properties
  41. def mdLI(width: int, depth: int) -> dict:
  42. properties = dLI(width, depth)
  43. properties["Atomic Models"] += depth
  44. return properties
  45. def dHI(width: int, depth: int) -> dict:
  46. properties = HI(width, depth)
  47. properties["Created"] = (width - 1) * (depth - 1)
  48. properties["Connected"] = 2 * (width - 1) * (depth - 1)
  49. return properties
  50. def mdHI(width: int, depth: int) -> dict:
  51. properties = dHI(width, depth)
  52. properties["Atomic Models"] += depth
  53. return properties
  54. def dHO(width: int, depth: int) -> dict:
  55. properties = HO(width, depth)
  56. properties["Created"] = 0 # TODO
  57. properties["Connected"] = 0 # TODO
  58. return properties
  59. def mdHO(width: int, depth: int) -> dict:
  60. properties = dHO(width, depth)
  61. properties["Atomic Models"] += depth
  62. return properties
  63. def model_properties(model: str, width: int, depth: int) -> dict:
  64. match model:
  65. case "LI":
  66. return LI(width, depth)
  67. case "HI":
  68. return HI(width, depth)
  69. case "HO":
  70. return HO(width, depth)
  71. case "HOmod":
  72. return HOmod(width, depth)
  73. case "HI2LI":
  74. return LI(width, depth)
  75. case "LI2HI":
  76. return HI(width, depth)
  77. case "dLI":
  78. return dLI(width, depth)
  79. case "mdLI":
  80. return mdLI(width, depth)
  81. case "dHI":
  82. return dHI(width, depth)
  83. case "mdHI":
  84. return mdHI(width, depth)
  85. case "dHO":
  86. return dHO(width, depth)
  87. case "mdHO":
  88. return mdHO(width, depth)
  89. case _:
  90. return {}
  91. def display_model_properties(model: str, width: int, depth: int):
  92. properties = model_properties(model, width, depth)
  93. print(f"Model: {model} {depth}x{width}")
  94. for key, value in properties.items():
  95. print(f"Number of {key}: {value:,}")
  96. print("="*50)
  97. if __name__ == "__main__":
  98. # display_model_properties("LI", 100, 100)
  99. display_model_properties("HI", 100, 100)
  100. # display_model_properties("HO", 100, 100)
  101. # display_model_properties("HOmod", 30, 30)