-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmpTT.m
64 lines (48 loc) · 1.34 KB
/
cmpTT.m
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
function TU = cmpTT(run_solver)
% plot time use bars
% select individual 1
n = 1;
function fx = run_helper(tx)
% run with tx travel time
genTT(tx)
% start solver
runAMPL('MDPNonlinearEqn.run')
% load data
fx = readFLOW('DATA\FX.m', n);
end
% run the solver and import data
if run_solver
% set default values for solver
setDEFAULT()
% run with different travel times
tt1 = 1.0; tt2 = 2.0;
fx1 = run_helper(tt1);
fx2 = run_helper(tt2);
% save flows
save('DATA/FXtt.mat', 'tt1', 'tt2', 'fx1', 'fx2')
else
% load saved flows
load('DATA/FXtt.mat', 'tt1', 'tt2', 'fx1', 'fx2')
end
% plot time use bars
figure; grid off; box off
TU = [getTU(fx1); getTU(fx2)];
barTU(TU', {'Normal traffic condition', 'Traffic congestion condition'});
% export time use into csv
csvwrite('FIGURES/TUtt.csv', TU)
export_fig('FIGURES/TUtt', '-pdf', '-jpg', '-r150')
% also plot fx1 and fx2
figure; grid off; box off
plotFX(fx1)
title('Normal traffic condition')
export_fig(['FIGURES/FXt', num2str(tt1, '%.1f')], '-pdf', '-jpg', '-r150')
figure; grid off; box off
plotFX(fx2)
title('Traffic congestion condition')
export_fig(['FIGURES/FXt', num2str(tt2, '%.1f')], '-pdf', '-jpg', '-r150')
figure; grid off; box off
plotFF(fx2, fx1)
title('Traffic congestion condition')
export_fig(['FIGURES/FXt', num2str(tt1, '%.1f'), 't', num2str(tt2, '%.1f')],...
'-pdf', '-jpg', '-r150')
end