File size: 1,828 Bytes
9d09c45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""Preconfigured dataset generation harness (no CLI arguments)."""

from __future__ import annotations

import secrets
from pathlib import Path

from .city_generator import CityGenerator
from .schemas import DatasetGenerationConfig


# -----------------------------------------------------------------------------
# Edit these values to control the default batch generation run.
# -----------------------------------------------------------------------------
NUM_CITIES: int = 100
OUTPUT_DIR: Path = Path("data/generated")
BASE_SEED: int | None = 42  # set to an int for reproducible runs
TOPOLOGIES: list[str] = [
    "rectangular_grid",
    "irregular_grid",
    "arterial_local",
    "ring_road",
    "mixed",
]
MIN_DISTRICTS: int = 6
MAX_DISTRICTS: int = 20
MIN_INTERSECTIONS_PER_DISTRICT: int = 4
MAX_INTERSECTIONS_PER_DISTRICT: int = 10
SIMULATION_STEPS: int = 3600
INTERVAL: float = 1.0
FAIL_FAST: bool = False


def main() -> None:
    """Run deterministic-configured dataset generation with pre-set defaults."""
    base_seed = BASE_SEED if BASE_SEED is not None else secrets.randbits(63)

    config = DatasetGenerationConfig(
        num_cities=NUM_CITIES,
        output_dir=OUTPUT_DIR,
        seed=base_seed,
        topologies=TOPOLOGIES,
        min_districts=MIN_DISTRICTS,
        max_districts=MAX_DISTRICTS,
        min_intersections_per_district=MIN_INTERSECTIONS_PER_DISTRICT,
        max_intersections_per_district=MAX_INTERSECTIONS_PER_DISTRICT,
        simulation_steps=SIMULATION_STEPS,
        interval=INTERVAL,
        fail_fast=FAIL_FAST,
    )

    print(f"Generating {config.num_cities} cities into {config.output_dir}")
    print(f"Base seed: {config.seed}")
    print(f"Topologies: {', '.join(TOPOLOGIES)}")

    CityGenerator().generate_dataset(config)


if __name__ == "__main__":
    main()