@@ -134,53 +134,64 @@ function plot_instance(
134134 (; tasks, district_width, width) = sample. instance. city
135135 ticks = 0 : district_width: width
136136 max_time = maximum (t. end_time for t in sample. instance. city. tasks[1 : (end - 1 )])
137- pp = floor (Int, max (max_time))
138- palette = Plots. palette (color_scheme, pp)
139137 fig = plot (;
140138 xlabel= " x" ,
141139 ylabel= " y" ,
142- legend= false ,
143140 gridlinewidth= 3 ,
144141 aspect_ratio= :equal ,
145142 size= (500 , 500 ),
146143 xticks= ticks,
147144 yticks= ticks,
148145 xlims= (- 1 , width + 1 ),
149146 ylims= (- 1 , width + 1 ),
147+ clim= (0.0 , max_time),
148+ label= nothing ,
149+ colorbar_title= " Time" ,
150+ )
151+ scatter! (
152+ fig,
153+ [tasks[1 ]. start_point. x],
154+ [tasks[1 ]. start_point. y];
155+ label= nothing ,
156+ marker= :rect ,
157+ markersize= 10 ,
150158 )
151- for (i_task, task) in enumerate (tasks[1 : (end - 1 )])
159+ annotate! (fig, (tasks[1 ]. start_point. x, tasks[1 ]. start_point. y, text (" 0" , 10 )))
160+ for (i_task, task) in enumerate (tasks[2 : (end - 1 )])
152161 (; start_point, end_point) = task
153162 points = [(start_point. x, start_point. y), (end_point. x, end_point. y)]
154- plot! (fig, points; color= :black )
163+ plot! (fig, points; color= :black , label = nothing )
155164 scatter! (
156165 fig,
157166 points[1 ];
158167 markersize= 10 ,
159168 marker= :rect ,
160- color= palette[max (floor (Int, task. start_time), 1 )],
169+ marker_z= task. start_time,
170+ colormap= :turbo ,
171+ label= nothing ,
161172 )
162173 scatter! (
163174 fig,
164175 points[2 ];
165176 markersize= 10 ,
166177 marker= :rect ,
167- color= palette[max (floor (Int, task. end_time), 1 )],
178+ marker_z= task. end_time,
179+ colormap= :turbo ,
180+ label= nothing ,
181+ # color=palette[max(floor(Int, task.end_time), 1)],
168182 )
169- annotate! (fig, (points[1 ]. .. , text (" $(i_task- 1 ) " , 10 )))
183+ annotate! (fig, (points[1 ]. .. , text (" $(i_task) " , 10 )))
170184 end
171- p2 = Plots. heatmap (
172- rand (2 , 2 ); clims= (0 , pp), framestyle= :none , c= palette, cbar= true , lims= (- 1 , - 1 )
173- )
174- l = Plots. @layout [a{0.99 w} b]
175- return plot (fig, p2; layout= l)
185+ return fig
176186end
177187
178188function plot_solution (
179189 :: StochasticVehicleSchedulingBenchmark , sample:: DataSample{<:Instance{City}} ; kwargs...
180190)
181191 (; tasks, district_width, width) = sample. instance. city
182192 ticks = 0 : district_width: width
183- path_list = compute_path_list (sample. y_true)
193+ solution = Solution (sample. y_true, sample. instance)
194+ path_list = compute_path_list (solution)
184195 fig = plot (;
185196 xlabel= " x" ,
186197 ylabel= " y" ,
0 commit comments