Traffic Flow on Intersection based on Max Entropy

by Kardi Teknomo








NorthEastSouthWest
In
Out

NorthEastSouthWest
Rules


Lane Direction in Intersection

Flow in an Intersection based on Max Entropy




Phase Optimization & Signal Timing










Pedestrian Crossings:

Conflict Graph

Optimized Phase Plan

Signal Timing Details

User Guide: The Virtual Traffic Engineer's Handbook

Welcome to the Intersection Sandbox!

This tool is part of an Ideal Flow Network (IFN) "virtual lab" that lets you act as a traffic engineer. Your goal is to design a 4-way intersection and find the most efficient traffic signal plan to keep cars moving safely and prevent gridlock.

This lab is a powerful educational tool to explore the complex trade-offs in traffic signal design. You will:

  1. Design a virtual intersection (how many lanes, which turns are allowed).
  2. Simulate traffic flow (how many cars want to go where).
  3. Optimize a signal plan (who gets a green light, and for how long).
  4. Analyze the results (did you fix the traffic jam, or make it worse?).

A Note on Assumptions: This is an advanced simulation, but still a model. It assumes a 4-way intersection and uses established traffic engineering formulas (like Maximum Entropy for flow and Webster's formula for timing). The results are an excellent approximation but are not a substitute for a full-scale professional study with site-specific data.

The fastest way to see the lab's power is to jump right in. Let's find the "best" signal plan in 60 seconds.

  1. Do nothing! The lab loads with a standard, 2-lane intersection. We can use this as our test case.
  2. Click the "Signal Timing" tab. This is your main control panel.
  3. Find the Find Best Plan button and click it.
  4. Wait a few moments. The tool is now running dozens of simulations, testing every major algorithm and a wide range of cycle times (from 25 to 600 seconds) to find the most efficient plan.
  5. Look at the results. Once it finishes, scroll down to the "Performance Metrics" table.
    • Level of Service (LOS): This is your grade. 'A' is a free-flowing intersection, 'F' is a total failure.
    • Queue / Storage Status: This is the most important result.
      • OK: Your plan works! The line of waiting cars ("queue") fits in the street.
      • FAIL (Spillback Risk): Your plan is a failure. The queue is so long it "spills back" and blocks the next intersection, causing gridlock.

That's it! You've just run a comprehensive optimization. Keep reading to understand how it all works, what the different knobs do, and how to manually design and fix a "failing" intersection.

This tab lets you define the physical geometry of your intersection. Changes here will dramatically affect the results.

Number of Lanes (In/Out)

This defines the number of lanes for each approach (North, East, South, West) going In (approaching the signal) and Out (exiting the intersection). The "In" lanes are the most critical for signal timing.

Lane Direction Rules

This is the most important setting in this tab. It tells drivers what turns are allowed from each "In" lane.

Lanes are separated by a | pipe. For example, a 3-lane road with the rule L|S|SR means:

Driving Side

This is a critical, fundamental setting that changes the core logic of what a "conflict" is.

This tab shows you the traffic problem you need to solve. You can either let the lab generate traffic for you, or you can input your own.

Flow Mode (Controlled in the 'Signal Timing' Tab)

Saturation Flow

Think of this as the "top speed" of a single lane. It's the maximum number of cars that can pass through one lane in one hour if the light was always green. A value of 1800-2000 is a common standard.

OD Table

The "Origin-Destination" table summarizes the total flow from each origin road (e.g., North) to each destination road (e.g., South).

This is the main "sandbox" where you will do most of your work. Here you set the rules for the signal and optimization.

Main Timing Parameters

Understanding Conflicts (The Toggles)

A conflict is any time two vehicle paths could cross or interfere. The entire goal of a traffic signal is to separate conflicts into different "phases" (green light times).

Queue & Spillback (Platoon Constraint)

This is a vital "anti-gridlock" feature.

A "Spillback" is when your intersection's traffic jam (the "queue") gets so long that it spills backward and blocks the next intersection, causing total gridlock.

Checking "Allow Platoon Constraint" tells the optimizer: "Do not let a green light run so long that it causes a spillback." It will cap the green time based on the "Mid Block Dist" (the distance, in meters, to the next intersection upstream).

The Optimization Buttons

After you run an optimization, four sections update with data.

1. Optimized Phase Plan (The Table)

This is a text summary of your signal plan. It lists each Phase, the movements in it, and the "Critical Flow"—the one movement that needs the most green time, which determines the green time for the whole phase.

2. Phase Diagrams (The Arrows)

This shows you WHAT is in each phase.

3. Signal Timing Diagram (The Timeline)

This shows you WHEN each movement runs. It's a Gantt chart (a timeline) of the full cycle, showing exactly how many seconds are given to Green, Yellow, and Red for every single movement.

4. Performance Metrics (The "Score")

This is your report card. It tells you how well your plan works.

What is a "Phase"?

A Phase is a set of one or more traffic movements that can all get a green light at the same time without conflicting.

The core problem of signal timing is to find the minimum number of phases to serve all movements, which minimizes the "lost time" from yellow/red lights.

How do you find the phases?

This problem can be modeled as a "graph theory" problem. Imagine each movement (e.g., "North-Left") is a "node".

Both methods solve the same problem. Since finding the perfect solution is extremely hard (NP-hard), the lab uses fast "greedy heuristics" to find a very good, near-optimal plan.

Comparison of Implemented Algorithms

Algorithm (in UI) Graph Type Problem Solved Heuristic / Method Result
Flow-Aware Clique Cover
PhaseOptimizerFlowAwareCliqueCover
Compatibility Graph Minimum Clique Cover (Flow-Weighted) Greedy (First-Fit, prioritized by flow volume). Standard Engineering: Produces a valid, near-optimal plan that prioritizes high-flow movements to minimize delay.
Protected-Permitted Optimizer
PhaseOptimizerProtectedPermitted
Compatibility Graph Minimum Clique Cover (Hybrid) Hybrid. Creates phases for protected movements, then adds permitted movements based on flow (v/c) ratios. Standard Engineering: Produces a complex, realistic, flow-aware plan separating protected and permitted turns.
NEMA 8-Phase
PhaseOptimizerNEMA
N/A (Fixed Logic) N/A (Applies standard) Applies the fixed, 8-phase "Ring-and-Barrier" logic used by real-world signal controllers. Standard Engineering: The most common, stable, and reliable plan. Not always the most efficient, but very predictable.
Min Clique Cover
PhaseOptimizerCliqueCover
Compatibility Graph Minimum Clique Cover Greedy (First-Fit by compatibility degree). Flow-ignorant. Geometric: Produces a valid, near-optimal phase plan based only on geometry.
Graph Coloring
PhaseOptimizerColorGraph
Conflict Graph Minimum Graph Coloring Greedy (First-Fit by conflict degree). Flow-ignorant. Geometric: Produces a valid, near-optimal phase plan based only on geometry.
Conflict Graph
PhaseOptimizerConflictGraph
Conflict Graph Minimum Graph Coloring Welsh-Powell (assigns lowest available color). Flow-ignorant. Geometric: Produces a valid, near-optimal phase plan.
Max Clique
PhaseOptimizerMaxClique
Compatibility Graph Maximal Clique Enumeration Bron-Kerbosch (Finds all maximal cliques). Academic: Does NOT produce a valid plan. It lists all possible valid phases, resulting in many redundant "phases" and invalid timings.

This algorithm implements the standard NEMA (National Electrical Manufacturers Association) 8-Phase sequencing.

Unlike the graph-based algorithms ("Clique Cover", etc.) which find phases from scratch, this algorithm applies a hard-coded, industry-standard phase structure.

How it Works: Ring & Barrier

A NEMA controller uses a "ring-and-barrier" logic to run non-conflicting phases concurrently (at the same time).

This simulation models a standard "dual-ring" setup:

The green time for each step is determined by the "critical" movement in the pair. For example, the green time for Step 1 is `max(Green Needed for Phase1, Green Needed for Phase5)`. This is a highly efficient and standard way to time an intersection.

You are right to notice the difference! They are two different types of diagrams that show two different things:

The NEMA diagram is a logic-based flowchart, not a geometric one. The boxes represent the phases themselves (Phase 1, Phase 2, etc.).

1. Rings (The Columns)

A Ring is a sequence of conflicting phases that must run one after another.

Phases in the same ring cannot run at the same time (e.g., Phase 1 and Phase 2 conflict).

2. Barriers (The Horizontal Lines)

A Barrier is a mandatory stop point. All phases in all rings must end before any phase after the barrier can begin.

3. Concurrency (The Rows)

Phases that are in different rings but in the same row (between the same barriers) can run at the same time.

In short, the Arrow diagrams show you the contents of each box. The NEMA (box) diagram shows you the rules for how to run those boxes in order.

So your plan has a Level of Service 'F' or a "FAIL (Spillback Risk)". How do you fix it?

This is the real job of a traffic engineer. You have four main solutions to try.

Solution 1: Add More Lanes (The "More Concrete" Fix)

The simplest fix. Go to the "IntersectionDesign" tab. Change the "In" lanes from 2 to 3 on the failing road. More lanes = more capacity.

Solution 2: Add Dedicated Turn Lanes (The "Smarter" Fix)

This is usually the best answer. Look at your "Lane Direction Rules". Do you have a rule like LSR|S?

This is a "shared" lane, and it's terrible. The cars turning Left (L) will block all the cars trying to go Straight (S).

The Fix: Go to "IntersectionDesign", change "In" lanes from 2 to 3, and change the rule to L|S|R. Now every movement has its own dedicated lane. This removes conflicts and dramatically improves flow.

Solution 3: Change the Signal Timing

Go to "Signal Timing". Try a longer "Cycle Time" (e.g., 140 instead of 120). This gives more total green time to everyone, but also makes people wait longer, which can make queues worse. It's a trade-off.

Solution 4: Build a Bridge (The "Big" Fix)

Sometimes, pedestrians are the problem. Go to the "Signal Timing" tab and look at your "Pedestrian" settings.

Is the "Ped. Min. Time" (e.g., 22s) longer than the green time the parallel cars actually need?

If so, the pedestrians are forcing the green light to stay on longer than needed. This "wasted" green time increases delay for everyone else and can cause spillback.

This gives you a perfect "engineering warrant" to recommend building a pedestrian bridge or underpass (a "grade-separated crossing") to remove the conflict entirely. Try unchecking the Pedestrian box and see how much the LOS improves!

Why is "Cycle Time" different from "Target Cycle Time" in the results?

In the "Signal Timing Diagram" summary, you may see a message like: Cycle Time: 48.0s (Target: 25s)

Why are they different?

If they are different, it means the target was impossible to meet. This can happen for two reasons:

  1. The Target is too short. The total lost time (Yellow+All-Red) plus the minimum green times for all phases may already be longer than the target you set.
  2. An unsuitable algorithm was chosen. An algorithm like "Max Clique" is not a valid signal-phasing algorithm. It finds all possible compatible groups, not a minimal, efficient plan. The diagram will show a long, invalid list of phases, and the "Calculated Time" will just be the sum of all of them.

This is an educational tool, not a professional design product.

While this tool uses correct, standard-practice traffic engineering formulas, it is for education and research dissemination only. The real design of an optimum traffic signal requires much larger consideration, including site-specific data collection, actuated control logic, detector placement, and detailed microscopic simulation.

The results from this tool should not be used for any real-world traffic signal design or implementation without validation by a qualified traffic engineer.

If you find any bugs or problem, or simply just want to appreciate the work I am doing, please do not hesitate to contact me. I also accept donation.