model_properties.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 dHI(width: int, depth: int) -> dict:
  42. properties = HI(width, depth)
  43. properties["Created"] = (width - 1) * (depth - 1)
  44. properties["Connected"] = 2 * (width - 1) * (depth - 1)
  45. return properties
  46. def model_properties(model: str, width: int, depth: int) -> dict:
  47. match model:
  48. case "LI":
  49. return LI(width, depth)
  50. case "HI":
  51. return HI(width, depth)
  52. case "HO":
  53. return HO(width, depth)
  54. case "HOmod":
  55. return HOmod(width, depth)
  56. case "HI2LI":
  57. return {}
  58. case "LI2HI":
  59. return {}
  60. case "dLI":
  61. return dLI(width, depth)
  62. case "dHI":
  63. return dHI(width, depth)
  64. case _:
  65. return {}
  66. def display_model_properties(model: str, width: int, depth: int):
  67. properties = model_properties(model, width, depth)
  68. print(f"Model: {model}")
  69. for key, value in properties.items():
  70. print(f"Number of {key}: {value}")
  71. print("="*50)
  72. if __name__ == "__main__":
  73. display_model_properties("LI", 100, 100)
  74. display_model_properties("HI", 100, 100)
  75. display_model_properties("HO", 100, 100)
  76. display_model_properties("HOmod", 100, 100)