File size: 4,687 Bytes
b6f80c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
id: traffic-control
name: Autonomous Traffic Control Environment
version: "1.0.0"
description: >
  A 4-way intersection RL environment where an AI agent controls traffic lights
  to maximise vehicle throughput and prioritise emergency vehicles.
  Compliant with the OpenEnv reset / step / state API specification.

author: OpenEnv Hackathon Submission
tags:
  - reinforcement-learning
  - traffic-control
  - emergency-vehicles
  - autonomous-systems
  - openenv

# ---------------------------------------------------------------------------
# Observation space
# ---------------------------------------------------------------------------
observation_space:
  type: object
  properties:
    current_phase:
      type: integer
      enum: [0, 1, 2, 3, 4]
      description: >
        Active traffic-light phase.
        0=NS_GREEN | 1=EW_GREEN | 2=ALL_RED | 3=NS_YELLOW | 4=EW_YELLOW
    time_in_phase:
      type: integer
      minimum: 0
      description: Steps elapsed since the last phase change.
    queue_lengths:
      type: array
      items: { type: integer, minimum: 0 }
      minItems: 4
      maxItems: 4
      description: "Regular vehicle queue depth per approach [N, S, E, W]."
    emergency_queue:
      type: array
      items: { type: integer, minimum: 0 }
      minItems: 4
      maxItems: 4
      description: "Emergency vehicle count per approach [N, S, E, W]."
    emergency_urgency:
      type: array
      items: { type: integer, minimum: 0, maximum: 10 }
      minItems: 4
      maxItems: 4
      description: "Max urgency of waiting emergency vehicles per approach (0 = none)."
    vehicles_passed:
      type: integer
      minimum: 0
      description: Regular vehicles that cleared the intersection this step.
    emergency_passed:
      type: integer
      minimum: 0
      description: Emergency vehicles that cleared the intersection this step.
    total_waiting_time:
      type: number
      description: Sum of per-vehicle waiting increments accumulated this step.
    collision:
      type: boolean
      description: True if a gridlock-induced collision occurred this step.
    reward:
      type: number
      description: Step reward computed by the environment.
    done:
      type: boolean
      description: True when the episode has ended.
    metadata:
      type: object
      description: Auxiliary info (step_count, task_id, …).

# ---------------------------------------------------------------------------
# Action space
# ---------------------------------------------------------------------------
action_space:
  type: object
  properties:
    light_phase:
      type: integer
      enum: [0, 1, 2]
      description: >
        Desired traffic-light phase.
        0=NS_GREEN | 1=EW_GREEN | 2=ALL_RED

# ---------------------------------------------------------------------------
# Tasks
# ---------------------------------------------------------------------------
tasks:
  - id: basic_flow
    name: Basic Traffic Flow Management
    difficulty: easy
    description: >
      Optimise vehicle throughput at a 4-way intersection with moderate,
      consistent traffic and no emergency vehicles.
    max_steps: 200
    grading:
      throughput_weight: 0.60
      efficiency_weight: 0.40
      target_throughput_per_step: 1.8

  - id: emergency_priority
    name: Emergency Vehicle Prioritisation
    difficulty: medium
    description: >
      Manage mixed traffic while prioritising occasional emergency vehicles
      that arrive from random directions with high urgency.
    max_steps: 300
    grading:
      throughput_weight:  0.30
      emergency_weight:   0.35
      delay_weight:       0.20
      efficiency_weight:  0.15
      target_emergency_delay_steps: 3

  - id: dynamic_scenarios
    name: Dynamic and Complex Scenarios
    difficulty: hard
    description: >
      Handle high traffic density, traffic-surge events, and multiple
      simultaneous emergency vehicles. Robustness and collision avoidance
      are critical evaluation criteria.
    max_steps: 400
    grading:
      throughput_weight:    0.25
      emergency_weight:     0.30
      delay_weight:         0.20
      efficiency_weight:    0.15
      adaptability_weight:  0.10

# ---------------------------------------------------------------------------
# Server
# ---------------------------------------------------------------------------
server:
  port: 8000
  module: traffic_control.server.app
  app: app
  workers: 2

# ---------------------------------------------------------------------------
# Docker
# ---------------------------------------------------------------------------
docker:
  base_image: python:3.11-slim
  exposed_port: 8000