@@ -17,7 +17,7 @@ function plot_state(
1717 postponable_color= :lightblue ,
1818 show_axis_labels= true ,
1919 markerstrokewidth= 0.5 ,
20- kwargs...
20+ kwargs... ,
2121)
2222 # Get coordinates from the state instance
2323 coordinates = coordinate (state)
@@ -29,8 +29,7 @@ function plot_state(
2929
3030 # Create the plot
3131 plot_args = Dict (
32- :legend => :topleft ,
33- :title => " DVSP State - Epoch $(state. current_epoch) "
32+ :legend => :topleft , :title => " DVSP State - Epoch $(state. current_epoch) "
3433 )
3534
3635 if show_axis_labels
@@ -109,7 +108,7 @@ function plot_routes(
109108 route_linewidth= 3 , # Increased from 2 to 3
110109 route_alpha= 0.7 ,
111110 show_route_labels= true ,
112- kwargs...
111+ kwargs... ,
113112)
114113 # Start with the basic state plot
115114 fig = plot_state (state; kwargs... )
@@ -144,11 +143,11 @@ function plot_routes(
144143 fig,
145144 route_x,
146145 route_y;
147- color= color,
146+ # color=color,
148147 linewidth= route_linewidth,
149148 alpha= 1.0 , # Make routes fully opaque
150149 label= label,
151- linestyle= :solid
150+ linestyle= :solid ,
152151 )
153152 end
154153 end
@@ -162,11 +161,7 @@ $TYPEDSIGNATURES
162161Plot a given DVSPState with routes overlaid. This version accepts routes as a single
163162vector where routes are separated by depot visits (index 1).
164163"""
165- function plot_routes (
166- state:: DVSPState ,
167- routes:: Vector{Int} ;
168- kwargs...
169- )
164+ function plot_routes (state:: DVSPState , routes:: Vector{Int} ; kwargs... )
170165 # Convert single route vector to vector of route vectors
171166 route_vectors = Vector{Int}[]
172167 current_route = Int[]
@@ -196,11 +191,7 @@ $TYPEDSIGNATURES
196191Plot a given DVSPState with routes overlaid. This version accepts routes as a BitMatrix
197192where entry (i,j) = true indicates an edge from location i to location j.
198193"""
199- function plot_routes (
200- state:: DVSPState ,
201- routes:: BitMatrix ;
202- kwargs...
203- )
194+ function plot_routes (state:: DVSPState , routes:: BitMatrix ; kwargs... )
204195 # Convert BitMatrix to vector of route vectors
205196 n_locations = size (routes, 1 )
206197 route_vectors = Vector{Int}[]
@@ -267,7 +258,7 @@ function plot_epochs(
267258 tickfontsize= 10 ,
268259 show_axis_labels= false ,
269260 show_colorbar= false ,
270- kwargs...
261+ kwargs... ,
271262)
272263 n_epochs = length (data_samples)
273264
@@ -296,7 +287,7 @@ function plot_epochs(
296287
297288 xlims = (
298289 minimum (p. x for p in all_coordinates) - margin,
299- maximum (p. x for p in all_coordinates) + margin
290+ maximum (p. x for p in all_coordinates) + margin,
300291 )
301292
302293 # Add extra margin at the top for legend space
@@ -338,39 +329,44 @@ function plot_epochs(
338329 guidefontsize= guidefontsize,
339330 tickfontsize= tickfontsize,
340331 legend= false ,
341- kwargs...
332+ kwargs... ,
342333 )
343334 else
344335 # Plot with or without routes
345336 if plot_routes_flag && ! isnothing (sample. y_true)
346- fig = plot_routes (state, sample. y_true;
347- xlims= xlims,
348- ylims= ylims,
349- clims= clims,
350- colorbar= false ,
351- title= " Epoch $(state. current_epoch) " ,
352- titlefontsize= titlefontsize,
353- guidefontsize= guidefontsize,
354- legendfontsize= legendfontsize,
355- tickfontsize= tickfontsize,
356- show_axis_labels= show_axis_labels,
357- markerstrokewidth= 0.5 ,
358- show_route_labels= false ,
359- kwargs... )
337+ fig = plot_routes (
338+ state,
339+ sample. y_true;
340+ xlims= xlims,
341+ ylims= ylims,
342+ clims= clims,
343+ colorbar= false ,
344+ title= " Epoch $(state. current_epoch) " ,
345+ titlefontsize= titlefontsize,
346+ guidefontsize= guidefontsize,
347+ legendfontsize= legendfontsize,
348+ tickfontsize= tickfontsize,
349+ show_axis_labels= show_axis_labels,
350+ markerstrokewidth= 0.5 ,
351+ show_route_labels= false ,
352+ kwargs... ,
353+ )
360354 else
361- fig = plot_state (state;
362- xlims= xlims,
363- ylims= ylims,
364- clims= clims,
365- colorbar= false ,
366- title= " Epoch $(state. current_epoch) " ,
367- titlefontsize= titlefontsize,
368- guidefontsize= guidefontsize,
369- legendfontsize= legendfontsize,
370- tickfontsize= tickfontsize,
371- show_axis_labels= show_axis_labels,
372- markerstrokewidth= 0.5 ,
373- kwargs... )
355+ fig = plot_state (
356+ state;
357+ xlims= xlims,
358+ ylims= ylims,
359+ clims= clims,
360+ colorbar= false ,
361+ title= " Epoch $(state. current_epoch) " ,
362+ titlefontsize= titlefontsize,
363+ guidefontsize= guidefontsize,
364+ legendfontsize= legendfontsize,
365+ tickfontsize= tickfontsize,
366+ show_axis_labels= show_axis_labels,
367+ markerstrokewidth= 0.5 ,
368+ kwargs... ,
369+ )
374370 end
375371 end
376372
@@ -386,11 +382,18 @@ function plot_epochs(
386382
387383 # Combine plots in a grid layout with optional shared colorbar
388384 if show_colorbar
389- combined_plot = plot (plots... , layout= (rows, cols), size= figsize,
390- link= :both , colorbar= :right , clims= clims)
385+ combined_plot = plot (
386+ plots... ;
387+ layout= (rows, cols),
388+ size= figsize,
389+ link= :both ,
390+ colorbar= :right ,
391+ clims= clims,
392+ )
391393 else
392- combined_plot = plot (plots... , layout= (rows, cols), size= figsize,
393- link= :both , clims= clims)
394+ combined_plot = plot (
395+ plots... ; layout= (rows, cols), size= figsize, link= :both , clims= clims
396+ )
394397 end
395398
396399 return combined_plot
@@ -402,9 +405,7 @@ $TYPEDSIGNATURES
402405Plot multiple epochs side by side, optionally filtering to specific epoch indices.
403406"""
404407function plot_epochs (
405- data_samples:: Vector{<:DataSample} ,
406- epoch_indices:: Vector{Int} ;
407- kwargs...
408+ data_samples:: Vector{<:DataSample} , epoch_indices:: Vector{Int} ; kwargs...
408409)
409410 filtered_samples = data_samples[epoch_indices]
410411 return plot_epochs (filtered_samples; kwargs... )
@@ -428,7 +429,7 @@ function animate_epochs(
428429 legendfontsize= 12 ,
429430 tickfontsize= 11 ,
430431 show_axis_labels= true ,
431- kwargs...
432+ kwargs... ,
432433)
433434 n_epochs = length (data_samples)
434435
@@ -451,7 +452,7 @@ function animate_epochs(
451452
452453 xlims = (
453454 minimum (p. x for p in all_coordinates) - margin,
454- maximum (p. x for p in all_coordinates) + margin
455+ maximum (p. x for p in all_coordinates) + margin,
455456 )
456457
457458 # Add extra margin at the top for legend space
@@ -522,51 +523,55 @@ function animate_epochs(
522523 tickfontsize= tickfontsize,
523524 legend= false ,
524525 size= figsize,
525- kwargs...
526+ kwargs... ,
526527 )
527528 else
528529 if frame_type == :routes
529530 # Show state with routes
530- plot_routes (state, sample. y_true;
531- xlims= xlims,
532- ylims= ylims,
533- clims= clims,
534- title= " Epoch $(state. current_epoch) - Routes Dispatched" ,
535- titlefontsize= titlefontsize,
536- guidefontsize= guidefontsize,
537- legendfontsize= legendfontsize,
538- tickfontsize= tickfontsize,
539- show_axis_labels= show_axis_labels,
540- markerstrokewidth= 0.5 ,
541- show_route_labels= false ,
542- size= figsize,
543- kwargs... )
531+ plot_routes (
532+ state,
533+ sample. y_true;
534+ xlims= xlims,
535+ ylims= ylims,
536+ clims= clims,
537+ title= " Epoch $(state. current_epoch) - Routes Dispatched" ,
538+ titlefontsize= titlefontsize,
539+ guidefontsize= guidefontsize,
540+ legendfontsize= legendfontsize,
541+ tickfontsize= tickfontsize,
542+ show_axis_labels= show_axis_labels,
543+ markerstrokewidth= 0.5 ,
544+ show_route_labels= false ,
545+ size= figsize,
546+ kwargs... ,
547+ )
544548 else # frame_type == :state
545549 # Show state only
546- plot_state (state;
547- xlims= xlims,
548- ylims= ylims,
549- clims= clims,
550- title= " Epoch $(state. current_epoch) - Available Requests" ,
551- titlefontsize= titlefontsize,
552- guidefontsize= guidefontsize,
553- legendfontsize= legendfontsize,
554- tickfontsize= tickfontsize,
555- show_axis_labels= show_axis_labels,
556- markerstrokewidth= 0.5 ,
557- size= figsize,
558- kwargs... )
550+ plot_state (
551+ state;
552+ xlims= xlims,
553+ ylims= ylims,
554+ clims= clims,
555+ title= " Epoch $(state. current_epoch) - Available Requests" ,
556+ titlefontsize= titlefontsize,
557+ guidefontsize= guidefontsize,
558+ legendfontsize= legendfontsize,
559+ tickfontsize= tickfontsize,
560+ show_axis_labels= show_axis_labels,
561+ markerstrokewidth= 0.5 ,
562+ size= figsize,
563+ kwargs... ,
564+ )
559565 end
560566 end
561567 end
562568
563569 # Save as GIF
564- gif (anim, filename, fps= fps)
570+ gif (anim, filename; fps= fps)
565571
566572 return anim
567573end
568574
569-
570575# """
571576# $TYPEDSIGNATURES
572577
0 commit comments