Optimization of traffic flow in a road network using MATLABβs Genetic Algorithm, applied to a nonlinear objective function with flow conservation and capacity constraints.
Developed as part of the course Optimization Techniques at the Aristotle University of Thessaloniki (AUTH), School of Electrical & Computer Engineering.
A traffic network with 9 intersections (nodes) and 17 roads (edges) is modeled. Each road has a specific capacity and a congestion-sensitive travel time. The objective is to minimize the total travel time per vehicle by distributing traffic optimally, while satisfying:
- Flow conservation at all internal nodes
- Inflow = outflow condition
- Per-road capacity limits
Red numbers indicate road capacity ( c_i ) (vehicles/min). Each arrow represents a one-way traffic path between intersections.
The delay for road (i) is modeled by the nonlinear function:
Where:
- ( t_i ): base (uncongested) travel time
- ( a_i ): congestion factor
- ( x_i ): flow on road (i)
- ( c_i ): road capacity
The total network cost is:
f(x) = βα΅’ xα΅’ Β· Tα΅’(xα΅’)
We solve the nonlinear constrained optimization problem using MATLABβs built-in Genetic Algorithm (ga
). This choice is robust to local minima and does not require gradient information.
- Linear equality constraints: Aβq Β· x = bβq
- Bound constraints: 0 β€ xα΅’ β€ cα΅’
- Flow conservation is built into
Aeq
,beq
- File:
optimize_flow_baseline.m
- Traffic inflow: ( V = 100 ) vehicles/min
- File:
optimize_flow_variable_V.m
- Tested inflows: ( V = 85, 95, 105, 115 )
- For each V, the GA is run and convergence plots are generated.
genetic-algorithm-for-network-optimization
βββ src/
β βββ travel_time_objective.m # Objective function f(x)
β βββ optimize_flow_baseline.m # GA run for V = 100
β βββ optimize_flow_variable_V.m # GA runs for V β {85, 95, 105, 115}
βββ images/
β βββ network_diagram.png # Network structure
β βββ Ti(xi).png # Travel time function
βββ report.pdf # Project report with equations and results
βββ README.md
- MATLAB
- Optimization Toolbox
- Global Optimization Toolbox
Panagiotis Koutris
Undergraduate at AUTH β School of Electrical & Computer Engineering
Licensed under the Apache 2.0 License.