Download src/cpptai/phases/phase2.py from Fra150/Cpptai: direct link, hf CLI and curl.
- Browser
- Download file 844 Bytes
-
https://huggingface.co/spaces/Fra150/Cpptai/resolve/main/src/cpptai/phases/phase2.py
- Command line
-
hf download hf://spaces/Fra150/Cpptai/src/cpptai/phases/phase2.py
-
curl -L -o phase2.py https://huggingface.co/spaces/Fra150/Cpptai/resolve/main/src/cpptai/phases/phase2.py
844 Bytes
| """Phase II: Vertical Topology.""" | |
| from __future__ import annotations | |
| import time | |
| from ..core import VerticalTopology | |
| from ..types import PhaseOutput, RunConfig, SolutionState | |
| def run(state: SolutionState, config: RunConfig) -> tuple[SolutionState, PhaseOutput]: | |
| t0 = time.perf_counter() | |
| topology = VerticalTopology() | |
| building_height = topology.calculate_building_height(state.blocks) | |
| topology.assign_floors(state.blocks, building_height) | |
| state.building_height = building_height | |
| dt = time.perf_counter() - t0 | |
| return ( | |
| state, | |
| PhaseOutput( | |
| name="phase2_vertical_topology", | |
| input={"block_count": len(state.blocks)}, | |
| output={"building_height": building_height, "floors": {b.id: b.floor_index for b in state.blocks}}, | |
| duration_sec=dt, | |
| ), | |
| ) | |