Solving a Transportation Planning Problem Through the Programming Language “C”
Presented by
Yousuf Mahid(0615012)
Shahadat Hossain Shakil(0615020)
Khadija Akhter(0615027)
Page 2
Calculation of Inter-Zonal Trips (Gravity Model)
Problem:Calculation of inter-zonal trips in a town.(Gravity Model)
Example: A self-contained town consists of four residential areas A, B, C and D and two industrial areas X and Y. Generation equations show that for the design year the trips from home to work generated by each residential area per day are A=1000, B=2250, C=1750 and D=3200. There are 3700 jobs in X and 4500 jobs in Y. The frictional factor is inversely proportional to the travel time between zones as tabulated below and the value of exponent is 2.
Travel time between the zones in minutes
Zones X Y
A 15 20
B 15 10
C 10 10
D 15 20
Page 3
Calculation of Inter-Zonal Trips (Gravity Model)
We have to determine the correct value of the TAX, TAY, TBX, …………. TDY, until justifying both the column and the row total by continuous calculation through iteration.
X Y Total
A 1000
B 2250
C 1750
D 3200
Total 3700 4500 8200
DestinationOrigin
TAX TAY
TBX TBY
TCY
TDX
TCX
TDY
Page 4
Calculation of Inter-Zonal Trips (Gravity Model)
Solution:The most typical version of gravity model used in the transportation planning application is
Tij= (Oi × Djfij) ∕ ( ∑ Djfij)
Where
Tij = no. of trips from zone i to zone j.
Oi = total no. of trips produced in zone i.
Dj = total no. of trips attracted to zone j.
b = an exponential constant whose value is usually found between 1 and 2.
The frictional factor is an inverse function of the travel cost (time, distance, monetary cost).
fij = 1 / Cijb
Page 5
Calculation of Inter-Zonal Trips (Gravity Model)
TAX = 1000 × (3700/152) / (3700/152 + 4500/202) = 592
TAY = 1000 × (4500/202) / (3700/152 + 4500/202) = 407
………………………………………………………………
TDX = 3200 × (3700/152) / (3700/152 + 4500/202) = 1896
TDY = 3200 × (4500/152) / (3700/152 + 4500/202) = 1303
X Y Total
A 1000
B 2250
C 1750
D 3200
Calculated Attraction
Projected Attraction 3700 4500 8200
DestinationOrigin
3867 4329
592
590
789
1896 1303
1659
960
407
8196
Page 6
Calculation of Inter-Zonal Trips (Gravity Model)
The adjusted attraction = Projected attraction × (The attraction used in the previous iteration ∕ Calculated attraction in the previous iteration)
D1X = 3700 × (3700 ∕ 3867) = 3540
D1Y = 4500 × (4500 ∕ 4329) = 4677
TAX = 1000 × (3540/152) / (3540/152 + 4677/202) = 576
………………………………………………………….
TDY = 3200 × (4677/152) / (3540/152 + 4677/202) = 1353
X Y Total
A 1000
B 2250
C 1750
D 3200
Calculated Attraction
Projected Attraction 3700 4500 8200
Destination
Origin
3731 4465
576
553
756
1846
423
1696
993
1353
8196
Page 7
Calculation of Inter-Zonal Trips (Gravity Model)
Again the adjusted attractions after second iteration is
D2X = 3700 × (3540 ∕ 3731) = 3510
D2Y = 4500 × (4677 ∕ 4465) = 4713
Using this adjusted attraction value, 3rd iteration will be operated.
This process continues until the calculated attraction value and the
projected attraction value is being equalized or nearest most.
Using the “C” programming language we have to develop a program to do
this cumbersome mathematical calculation mechanically to save time and
energy and to get the accurate result in the shortest possible time.
Page 8
Making Procedure of the Program in “C”
Divide the whole task among different functions.
Function declaration.
Declaring functions prototype before main function.
Then subdivide the claculation of a specific function into more smaller parts
to store the return value into different variables.
Variable Declaration-(Local and Global).
Global Array Declaration- (1D and 2D)-to store and manipulate same
kind of data.
Function calling - inside the main function and also inside the called
function.
Page 9
Making Procedure of the Program in “C”
Library function used – main(); clrscr(); printf();scanf(); fflush(stdin);
getch(); (including related header files)
Type of variables used – int; long int; float;
(including ralated format specifier)
Operator used – arithmatic (addition, multiplication, division)
– assignment(=), relational(==),increment(++)
Control Statement Used – if statement;
– for loop;
A progarm largely dependent on the use of array and continuous iteration.
Limitations – deigned for 10 residential zone and 2 working zone.
Failure of converting the fraction trip value into the next higher integer number.
Page 10
Thanks for your patience.
Q/A
Page 11
Page 12
Page 13
Page 14
Page 15