0% found this document useful (0 votes)
4 views10 pages

DSA Resport For Project

The Digital Traffic Management System (DMS) aims to enhance urban traffic management through route optimization, traffic intensity measurement, and signal timing adjustments. Key features include calculating shortest paths using Dijkstra's algorithm, estimating vehicle counts, and determining optimal green light durations based on traffic load. The project emphasizes real-time data integration and potential future enhancements for improved traffic flow and safety.

Uploaded by

habibireads
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

DSA Resport For Project

The Digital Traffic Management System (DMS) aims to enhance urban traffic management through route optimization, traffic intensity measurement, and signal timing adjustments. Key features include calculating shortest paths using Dijkstra's algorithm, estimating vehicle counts, and determining optimal green light durations based on traffic load. The project emphasizes real-time data integration and potential future enhancements for improved traffic flow and safety.

Uploaded by

habibireads
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Digital Traffic Management

System

Submitted To:
Dr.Inayat-ul-Rehman
Submitted By:
Kacho Ayoub Khan(FA23-BCS-039)
Dua Fatima (FA23-BCS-129)
Muaaz Tasawwar (FA23-BCS-050)
Overview
The Digital Management System (DMS) was created to assist urban traffic
systems by providing route enabling, traffic intensity measurement, and
signal timing all in a single package. The goal of our project is to create an
application that allows users to manage traffic data, calculate shortest paths,
estimate traffic intensity, and determine green signal times given real-world
data.

Goals
1. Normalize urban traffic by routing through optimal pathways to reach
the destination.
2. Tweak the timings of traffic lights based on the roads' density at
various times.
3. Provide analytics on the state of the roads, including those under
construction and possible detours.
4. Interpret external CSV files in real time to aid in traffic analysis.
5. Calculate time to reach a destination while considering traffic intensity
and road distance.

Highlights
1. Locating VIP Trails
This feature calculates and displays the shortest distance for a specific load
between a start intersection point and a target intersection using Dijkstra’s
technique. The software loads the distances from a CSV file and enables the
user to determine the cheapest distance from one point to another.
For Example: If a user asks to get the shortest distance from the intersection
point marked “G-7 Markaz” to the point “F-10 Markaz,” the program displays:
Distance: 10 km
Route Taken: F-10 Markaz ← G-9 Markaz ← G-7 Markaz.
Furthermore, this feature also displays any closed roads along the route,
such as:
Road Closure Alert: The road between G-9 Markaz and G-8 Markaz is blocked.
Output:

2. Estimation of the Number of Vehicles on Certain Roads


This feature estimates and validates the number of vehicles expected to ply
a given road segment by utilizing data sourced from a traffic intensity CSV
file coupled with the Dijkstra technique.
For Example: If the road section between “G-7 Markaz” and “F-10 Markaz”
has an intensity of 300 vehicles, the program would display:
Number of Cars: 300.

Output:

3. Timing of the Green Traffic Lights


The durations of green lights are computed based on the traffic load to
improve vehicular flow. The program operates with predefined thresholds for
traffic density and calculates optimal green light durations.
For Example: For an intensity of 400 vehicles:
Green Signal for Route: From F-10 Markaz to G-7 Markaz is set to 5 minutes.

Output:

4. Calculating Time to Reach a Node Considering Traffic


Intensity
This newly added feature estimates the time to reach a target node from a
source node while considering both the traffic intensity and the length of the
shortest route. It assigns time per kilometer based on intensity levels:
 Intensity > 600: 9 minutes per kilometer
 300 ≤ Intensity ≤ 600: 7 minutes per kilometer
 100 ≤ Intensity < 300: 4 minutes per kilometer
 Intensity < 100: 2 minutes per kilometer
For Example: If the shortest route between G-7 Markaz and F-10 Markaz is 10
km and the intensity is 450:
Estimated Time: 10 km × 7 minutes/km = 70 minutes.

Output:

Code Overview
1. Graph Class
The Graph class uses an adjacency matrix to represent the city’s road
network. It includes methods for adding vertex data, importing data from
CSV files, and running Dijkstra’s algorithm.
class Graph {
public:
vector<vector<int>> adj_matrix;
vector<string> vertex_data;
int size;
vector<int> parent;
Graph(int size) {
this->size = size;
adj_matrix.resize(size, vector<int>(size, 0));
vertex_data.resize(size, "");
parent.resize(size, -1);
}
};

2. Dijkstra’s Algorithm Implementation


The dijkstra() method determines the shortest distance from a source
intersection to all other intersections. It updates the distance vector and the
visited vector.
vector<int> dijkstra(const string& start_vertex_data) {
int start_vertex = -1;
for (int i = 0; i < size; i++) {
if (vertex_data[i] == start_vertex_data) {
start_vertex = i;
break;
}
}
if (start_vertex == -1) {
throw invalid_argument("Start vertex not found in vertex data.");
}

vector<int> distances(size, INT_MAX);


vector<bool> visited(size, false);
distances[start_vertex] = 0;

for (int count = 0; count < size - 1; ++count) {


int min_distance = INT_MAX;
int u = -1;
for (int i = 0; i < size; ++i) {
if (!visited[i] && distances[i] < min_distance) {
min_distance = distances[i];
u = i;
}
}
if (u == -1) {
break;
}
visited[u] = true;
for (int v = 0; v < size; ++v) {
if (adj_matrix[u][v] != 0 && !visited[v]) {
int alt = distances[u] + adj_matrix[u][v];
if (alt < distances[v]) {
distances[v] = alt;
parent[v] = u;
}
}
}
}
return distances;
}

3. Main Menu Function


The main() function offers options for routing vehicles, estimating vehicle
volumes, determining traffic light timings, and calculating time considering
traffic intensity.
int main() {
Graph *distanceGraph = readDistances();
Graph *intensityGraph = readIntensity();
int choice;
do {
cout << "\n--- Digital Traffic Management System ---" << endl;
cout << "1. Find VIP Route" << endl;
cout << "2. Find Number of Vehicles on a Road" << endl;
cout << "3. Find Green Traffic Light Timing" << endl;
cout << "4. Calculate Time Considering Traffic Intensity" << endl;
cout << "5. Exit" << endl;
cout << "Enter your choice: ";
cin >> choice;

switch (choice) {
case 1:
getVipRoot(distanceGraph);
break;
case 2:
cout << "Number of Vehicles: " <<
numberOfWhicles(intensityGraph) << endl;
break;
case 3:
getGreenLightTiming(intensityGraph);
break;
case 4:
calculateTimeConsideringIntensity(distanceGraph, intensityGraph);
break;
case 5:
cout << "Exiting program. Goodbye!" << endl;
break;
default:
cout << "Invalid choice. Please try again." << endl;
}
} while (choice != 5);
return 0;
}

Output:

Conclusion
The Digital Traffic Management System is a powerful and highly modifiable
solution to urban traffic management problems. By improving traffic flow and
road safety with graph-based algorithms and real-time data, it sets the stage
for future enhancements. Potential developments include integrating live
data interfaces, predictive traffic control, and a graphical interface for easier
use.

Project Divisions:
Our team worked together seamlessly, distributing tasks uniformly and
leveraging each other's strengths to deliver a high-quality project
Kacho Ayoub Khan(FA23-BCS-039)
Dua Fatima (FA23-BCS-129)
Muaaz Tasawwar (FA23-BCS-050)

You might also like