model_properties.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 + (width - 1) * ((depth - 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 + (width - 1) * ((depth - 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 - 1):
  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 model_properties(model: str, width: int, depth: int) -> dict:
  55. match model:
  56. case "LI":
  57. return LI(width, depth)
  58. case "HI":
  59. return HI(width, depth)
  60. case "HO":
  61. return HO(width, depth)
  62. case "HOmod":
  63. return HOmod(width, depth)
  64. case "HI2LI":
  65. return {}
  66. case "LI2HI":
  67. return {}
  68. case "dLI":
  69. return dLI(width, depth)
  70. case "mdLI":
  71. return mdLI(width, depth)
  72. case "dHI":
  73. return dHI(width, depth)
  74. case "mdHI":
  75. return mdHI(width, depth)
  76. case _:
  77. return {}
  78. def display_model_properties(model: str, width: int, depth: int):
  79. properties = model_properties(model, width, depth)
  80. print(f"Model: {model}")
  81. for key, value in properties.items():
  82. print(f"Number of {key}: {value:,}")
  83. print("="*50)
  84. if __name__ == "__main__":
  85. display_model_properties("LI", 100, 100)
  86. display_model_properties("HI", 100, 100)
  87. display_model_properties("HO", 100, 100)
  88. display_model_properties("HOmod", 30, 30)