Yiliang Xiong committed 9e4bf03

plot the MOW track window

Comments (0)

Files changed (3)

 # export the solution to MATLAB
+### export the input data
 # origin and destination
 printf "OD = [\n" > sol.m;
 for {i in T} {
     printf "%d\t%d\t%f\n", r, s, trackleng[r,s] > sol.m;
 printf "];\n\n" > sol.m;
+# MOW
+printf "MOW = [\n" > sol.m;
+for {(r,s) in F} {
+    printf "%d\t%d\t%d\t%d", r, s, mowstart[r,s], mowend[r,s] > sol.m;
+printf "];\n\n" > sol.m;
+### export solution
 # route choice
 for {i in T} {
     printf "y(%d,:,:) = [\n", i > sol.m;
+function plotmow(edge, cumleng, mowedge, mowtime)
+% plot MOW track window
+    function drawrectangle(x1, x2, y1, y2)
+        line([x1;x2], [y1;y1])
+        line([x1;x2], [y2;y2])
+        line([x1;x1], [y1;y2])
+        line([x2;x2], [y1;y2])
+    end
+for i = 1:size(mowedge,1)
+    j = find(edge(:,1)==mowedge(i,1) & edge(:,2)==mowedge(i,2));
+    x1 = cumleng(j);
+    x2 = cumleng(j+1);
+    t1 = mowtime(i,1);
+    t2 = mowtime(i,2);
+    drawrectangle(x1, x2, t1, t2)
+% import solution
 run ./sol.m
 edge = E(:,1:2);
 leng = E(:,3);
+mowedge = MOW(:,1:2);
+mowtime = MOW(:,3:4);
+% plot schedules
 figure; hold on; grid on
-cumleng = plotedge(edge, leng);
+[cumleng ax1 ax2] = plotaxes(edge, leng);
+plotmow(edge, cumleng, mowedge, mowtime);
 for i = 1:size(a,1)
     route = y(i,:,3);
     atime = a(i,:,4);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.