Spaces:
Running
Running
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| DISTRICT_TYPES: tuple[str, ...] = ( | |
| "residential", | |
| "commercial", | |
| "industrial", | |
| "mixed", | |
| ) | |
| DISTRICT_TYPE_TO_INDEX: dict[str, int] = { | |
| district_type: index for index, district_type in enumerate(DISTRICT_TYPES) | |
| } | |
| DEFAULT_DISTRICT_TYPE = "mixed" | |
| class PhaseConfig: | |
| engine_phase_index: int | |
| available_road_links: tuple[int, ...] | |
| incoming_lanes_served: tuple[str, ...] | |
| outgoing_lanes_served: tuple[str, ...] | |
| class IntersectionConfig: | |
| intersection_id: str | |
| district_id: str | |
| district_type: str | |
| district_type_index: int | |
| incoming_lanes: tuple[str, ...] | |
| outgoing_lanes: tuple[str, ...] | |
| is_boundary: bool | |
| green_phases: tuple[PhaseConfig, ...] | |
| all_phase_indices: tuple[int, ...] | |
| initial_engine_phase_index: int | |
| def num_green_phases(self) -> int: | |
| return len(self.green_phases) | |
| class DistrictConfig: | |
| district_id: str | |
| district_type: str | |
| district_type_index: int | |
| intersection_ids: tuple[str, ...] | |
| neighbor_districts: tuple[str, ...] | |