"""Hierarchical level taxonomy (LADDER)."""
from typing import Optional
import numpy as np
[docs]
class HierarchicalLevel:
"""A single level L_n with complexity range."""
def __init__(self, index: int, lower_bound: float, upper_bound: float, label: str = ""):
self.index = index
self.lower = lower_bound
self.upper = upper_bound
self.label = label
[docs]
def contains(self, complexity: float) -> bool:
return self.lower < complexity <= self.upper
[docs]
class LadderHierarchy:
"""Complete LADDER taxonomy (Levels 0‑18)."""
# Predefined complexity thresholds (example values, calibrate later)
THRESHOLDS = [
0.0, # Level 0
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
10.0, # Levels 1-10
11.0,
12.0,
13.0,
14.0,
15.0,
16.0,
17.0,
18.0,
19.0, # Levels 11-18
]
LABELS = [
"Neutral Substrate",
"Quantum‑Gravitational",
"Elementary Particles",
"Composite Particles",
"Atomic Species",
"Molecular Aggregates",
"Mesoscale Structures",
"Macroscopic Materials",
"Functional Assemblies",
"Integrated Biological",
"Networked Systems",
"Planetary Systems",
"Interplanetary",
"Interstellar",
"Galactic",
"Intergalactic",
"Cosmic Web",
"Observable Universe",
"Entire Branch",
]
def __init__(self):
self.levels = []
for i in range(len(self.THRESHOLDS) - 1):
self.levels.append(
HierarchicalLevel(i, self.THRESHOLDS[i], self.THRESHOLDS[i + 1], self.LABELS[i])
)
[docs]
def get_level(self, complexity: float) -> Optional[HierarchicalLevel]:
for level in self.levels:
if level.contains(complexity):
return level
return None
[docs]
def complexity_measure(self, pattern) -> float:
"""Compute Λ(P) = α log₂ N_dof + β I_int + γ Σ."""
# Simplified: use pattern's information content as proxy
I = pattern.information_content()
# Estimate N_dof from state variable dimension
if len(pattern.V.shape) > 1:
N_dof = pattern.V.shape[1]
else:
N_dof = 1
alpha, beta, gamma = 1.0, 1.0, 0.1
return alpha * np.log2(N_dof) + beta * I + gamma * (1 - pattern.coherence())