forked from huevosabio/cs341
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildCityMap.m
More file actions
35 lines (26 loc) · 798 Bytes
/
Copy pathBuildCityMap.m
File metadata and controls
35 lines (26 loc) · 798 Bytes
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
LinkTime=csvread('travel_time.csv',4,1);
LinkTime=LinkTime*60; %express in seconds
global RoadGraph NodesLocation
NodesLocation=csvread('inferred_locations.csv',1,1);
N=length(NodesLocation);
NodesLocation=NodesLocation*60; % to seconds!
StationLocation=NodesLocation;
StationNodeID=[1:1:N]';
RoadGraph=cell(N,1);
LinkFreeFlow=zeros(N,N);
LinkLength=LinkFreeFlow;
RoadCap=LinkFreeFlow;
MAXCAP=1e6;
for i=1:N
for j=1:N
RoadGraph{i}=[RoadGraph{i},j];
LinkLength(i,j)=norm(NodesLocation(j,:) - NodesLocation(i,:));
LinkTime(i,j)=LinkLength(i,j);
LinkFreeFlow(i,j)=LinkLength(i,j)/LinkTime(i,j);
RoadCap(i,j)=MAXCAP;
end
end
LinkTime(LinkTime==0)=1e9;
LinkLength(LinkLength==0)=1e9;
LinkNumVehicles = sparse(N,N);
LinkCapacityLeft = sparse(N,N);