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 + (depth - 1) * ((width - 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 + (depth - 1) * ((width - 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): 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 mdLI(width: int, depth: int) -> dict: properties = dLI(width, depth) properties["Atomic Models"] += depth 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 mdHI(width: int, depth: int) -> dict: properties = dHI(width, depth) properties["Atomic Models"] += depth return properties def dHO(width: int, depth: int) -> dict: properties = HO(width, depth) properties["Created"] = 0 # TODO properties["Connected"] = 0 # TODO return properties def mdHO(width: int, depth: int) -> dict: properties = dHO(width, depth) properties["Atomic Models"] += depth 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 LI(width, depth) case "LI2HI": return HI(width, depth) case "dLI": return dLI(width, depth) case "mdLI": return mdLI(width, depth) case "dHI": return dHI(width, depth) case "mdHI": return mdHI(width, depth) case "dHO": return dHO(width, depth) case "mdHO": return mdHO(width, depth) case _: return {} def display_model_properties(model: str, width: int, depth: int): properties = model_properties(model, width, depth) print(f"Model: {model} {depth}x{width}") 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", 30, 30)