| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- def LI(width: int, depth: int) -> dict:
- properties = {}
- properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
- properties["External Incoming Connections"] = width * (depth - 1) + 1
- properties["External Outgoing Connections"] = depth
- properties["Internal Connections"] = 0
- properties["Events"] = (width - 1) * (depth - 1) + 1
- return properties
- def HI(width: int, depth: int) -> dict:
- properties = {}
- properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
- properties["External Incoming Connections"] = width * (depth - 1) + 1
- properties["External Outgoing Connections"] = depth
- properties["Internal Connections"] = (width - 2) * (depth - 1) if width > 2 else 0
- properties["Events"] = 1 + (width - 1) * ((depth - 1) * width) / 2
- return properties
- def HO(width: int, depth: int) -> dict:
- properties = {}
- properties["Atomic Models"] = (width - 1) * (depth - 1) + 1
- properties["External Incoming Connections"] = (width + 1) * (depth - 1) + 1
- properties["External Outgoing Connections"] = width * (depth - 1) + 1
- properties["Internal Connections"] = (width - 2) * (depth - 1) if width > 2 else 0
- properties["Events"] = 1 + (width - 1) * ((depth - 1) * width) / 2
- return properties
- def HOmod(width: int, depth: int) -> dict:
- properties = {}
- properties["Atomic Models"] = (width - 1 + ((width - 1) * width) / 2) * (depth - 1) + 1
- properties["External Incoming Connections"] = (2 * (width - 1) + 1) * (depth - 1) + 1
- properties["External Outgoing Connections"] = depth
- properties["Internal Connections"] = ((width - 1) ** 2 + ((width - 1) * width) / 2) * (depth - 1)
- properties["Events"] = 1
- for i in range(1, depth - 1):
- e = (1 + (i - 1) * (width - 1)) * ((width - 1) * width) / 2 + (width - 1) * (width + (i - 1) * (width - 1))
- properties["Events"] += e
- return properties
- def dLI(width: int, depth: int) -> dict:
- properties = LI(width, depth)
- properties["Created"] = (width - 1) * (depth - 1)
- properties["Connected"] = (width - 1) * (depth - 1)
- return properties
- def dHI(width: int, depth: int) -> dict:
- properties = HI(width, depth)
- properties["Created"] = (width - 1) * (depth - 1)
- properties["Connected"] = 2 * (width - 1) * (depth - 1)
- return properties
- def model_properties(model: str, width: int, depth: int) -> dict:
- match model:
- case "LI":
- return LI(width, depth)
- case "HI":
- return HI(width, depth)
- case "HO":
- return HO(width, depth)
- case "HOmod":
- return HOmod(width, depth)
- case "HI2LI":
- return {}
- case "LI2HI":
- return {}
- case "dLI":
- return dLI(width, depth)
- case "dHI":
- return dHI(width, depth)
- case _:
- return {}
- def display_model_properties(model: str, width: int, depth: int):
- properties = model_properties(model, width, depth)
- print(f"Model: {model}")
- for key, value in properties.items():
- print(f"Number of {key}: {value}")
- print("="*50)
- if __name__ == "__main__":
- display_model_properties("LI", 100, 100)
- display_model_properties("HI", 100, 100)
- display_model_properties("HO", 100, 100)
- display_model_properties("HOmod", 100, 100)
|