Commits

Yiliang Xiong committed 4cee455

minor changes: filename, axis limits and comments

Comments (0)

Files changed (4)

 # mileage[i,v] < mileage[i,s] + trainleng[i]
 s.t. train_control {i in T, j in T, (r,s) in E: i <> j}: 
     d[i,r,s] + trainleng[i] / trainspeed[i,r,s] <= a[j,r,s] + (1 - x[i,j,r,s]) * M;
-# MOW windows
+# Maintenance of Way (MOW) track window
 s.t. mow_early {i in T, (r,s) in F}: d[i,r,s] <= mowstart[r,s] + (1 - g[i,r,s]) * M;
 s.t. mow_later {i in T, (r,s) in F}: a[i,r,s] >= mowend[r,s] - g[i,r,s] * M;
-# terminal want time deviance
+# Terminal Want Time (TWT) deviance
 s.t. terminal_early {(i,r,s) in LAST}: early[i,r,s] >= twtstart[i] - a[i,r,s] + (1 - y[i,r,s]) * M;
 s.t. terminal_late  {(i,r,s) in LAST}: late[i,r,s]  >= a[i,r,s] - twtend[i] + (1 - y[i,r,s]) * M;
 
-
-
-
+function [cumleng ax1 ax2]= plotaxes(edge, leng)
+% plot the track edges
+
+% track labels
+startnode = num2cell(edge(:,1));
+endnode = num2cell(edge(:,2));
+startlabel = cellfun(@num2str, startnode, 'UniformOutput', false);
+endlabel = cellfun(@num2str, endnode, 'UniformOutput', false);
+startlabel = [startlabel(:); {''}];
+endlabel = [{''}; endlabel(:)];
+% the minimal display space is 5.0
+minlen = 5;
+leng(leng<minlen) = minlen;
+% cummulative track length
+cumleng = cumsum([0;leng(:)]);
+% plot the axes
+ax1 = gca;
+line(cumleng, 0, 'Color', 'k')
+set(ax1,'XTick', cumleng)
+set(ax1,'XTickLabel', startlabel)
+ax2 = axes('Position',get(ax1,'Position'),...
+           'XAxisLocation','top',...
+           'YAxisLocation','right',...
+           'Color','none',...
+           'XColor','k','YColor','k');
+line(cumleng, 0, 'Color', 'k', 'Parent', ax2)
+set(ax2,'XTick', cumleng)
+set(ax2,'XTickLabel', endlabel)
+axes(ax1)

plotedge.m

-function cumleng = plotedge(edge, leng)
-% plot the track edges
-
-% track labels
-startnode = num2cell(edge(:,1));
-endnode = num2cell(edge(:,2));
-startlabel = cellfun(@num2str, startnode, 'UniformOutput', false);
-endlabel = cellfun(@num2str, endnode, 'UniformOutput', false);
-startlabel = [startlabel(:); {''}];
-endlabel = [{''}; endlabel(:)];
-% the minimal display space is 5.0
-minlen = 5;
-leng(leng<minlen) = minlen;
-% cummulative track length
-cumleng = cumsum([0;leng(:)]);
-% plot the axes
-ax1 = gca;
-line(cumleng, 0, 'Color', 'k')
-set(ax1,'XTick', cumleng)
-set(ax1,'XTickLabel', startlabel)
-ax2 = axes('Position',get(ax1,'Position'),...
-           'XAxisLocation','top',...
-           'YAxisLocation','right',...
-           'Color','none',...
-           'XColor','k','YColor','k');
-line(cumleng, 0, 'Color', 'k', 'Parent', ax2)
-set(ax2,'XTick', cumleng)
-set(ax2,'XTickLabel', endlabel)
-axes(ax1)
     dest = OD(i,2);
     plotroute(cumleng, route, atime, dtime, orig, dest)
 end
+% set Y tick and label
+yy = get(ax1, 'YLim');
+set(ax1,'YLim', [min(yy)-10, max(yy)+10])
+set(ax2,'YLim', get(ax1, 'YLim'))
+set(ax2,'YTick', get(ax1, 'YTick'))