52
52
save_zoom = False # save zoom into left and right part of the figures
53
53
perfprofsamplesize = genericsettings .simulated_runlength_bootstrap_sample_size # number of bootstrap samples drawn for each fct+target in the performance profile
54
54
nbperdecade = 1
55
- median_max_evals_marker_format = ['x' , 12.5 , 1 ] # [symbol, size, edgewidth]
55
+ max_evals_marker_format = ['x' , 12.5 , 1 ] # [symbol, size, edgewidth]
56
+ max_evals_single_marker_format = ['+' , 14 , 1 ] # [symbol, size, edgewidth]
57
+ max_evals_percentile = 90
56
58
label_fontsize = 15 # was 17
57
59
xticks_fontsize = 16
58
60
yticks_fontsize = 14
@@ -195,8 +197,7 @@ def beautify():
195
197
plt .ylim (- 0.0 , 1.0 )
196
198
197
199
198
-
199
- def plotdata (data , maxval = None , maxevals = None , CrE = 0. , ** kwargs ):
200
+ def plotdata (data , maxval = None , maxevals = None , CrE = 0. , maxevals2 = None , ** kwargs ):
200
201
"""Draw a normalized ECDF. What means normalized?
201
202
202
203
:param seq data: data set, a 1-D ndarray of runlengths
@@ -206,7 +207,9 @@ def plotdata(data, maxval=None, maxevals=None, CrE=0., **kwargs):
206
207
:param seq maxevals: if provided, will plot the median of this
207
208
sequence as a single cross marker
208
209
:param float CrE: Crafting effort the data will be multiplied by
209
- the exponential of this value.
210
+ the exponential of this value
211
+ :param maxevals2: a single value or values to be plotted as median(maxevals2)
212
+ with the same marker as maxevals
210
213
:param kwargs: optional arguments provided to plot function.
211
214
212
215
"""
@@ -250,33 +253,37 @@ def plotdata(data, maxval=None, maxevals=None, CrE=0., **kwargs):
250
253
logscale = False , clip_on = False , ** kwargs )
251
254
# res = plotUnifLogXMarkers(x2, y2, nbperdecade, logscale=False, **kwargs)
252
255
253
- if maxevals : # Should cover the case where maxevals is None or empty
254
- x3 = np .median (maxevals ) # change it only here
255
- if (x3 <= maxval and
256
- # np.any(x2 <= x3) and # maxval < median(maxevals)
257
- not plt .getp (res [- 1 ], 'label' ).startswith ('best' )
258
- ): # TODO: HACK for not considering a "best" algorithm line
259
- # Setting y3
260
- if n == 0 :
261
- y3 = 0
262
- else :
263
- try :
264
- y3 = y2 [x2 <= x3 ][- 1 ] # find right y-value for x3==median(maxevals)
265
- except IndexError : # median(maxevals) is smaller than any data, can only happen because of CrE?
266
- y3 = y2 [0 ]
267
- h = plt .plot ((x3 ,), (y3 ,),
268
- marker = median_max_evals_marker_format [0 ],
269
- markersize = median_max_evals_marker_format [1 ] * size_correction_from_n_foreground ** 0.85 ,
270
- markeredgewidth = median_max_evals_marker_format [2 ],
271
- # marker='x', markersize=24, markeredgewidth=3,
272
- markeredgecolor = plt .getp (res [0 ], 'color' ),
273
- ls = plt .getp (res [0 ], 'linestyle' ),
274
- color = plt .getp (res [0 ], 'color' ),
275
- # zorder=1.6 # zorder=0;1;1.5 is behind the grid lines, 2 covers other lines, 1.6 is between
276
- )
277
- h .extend (res )
278
- res = h # so the last element in res still has the label.
279
- # Only take sequences for x and y!
256
+ for maxeval_ , format in ((maxevals , max_evals_marker_format ),
257
+ (maxevals2 , max_evals_single_marker_format )):
258
+ if not maxeval_ : # cover the case where maxevals is None or empty
259
+ continue
260
+ x3 = np .median (maxeval_ ) # change it only here
261
+ if (x3 <= maxval and
262
+ # np.any(x2 <= x3) and # maxval < median(maxevals)
263
+ not plt .getp (res [- 1 ], 'label' ).startswith ('best' )
264
+ ): # TODO: HACK for not considering a "best" algorithm line
265
+ # Setting y3
266
+ if n == 0 :
267
+ y3 = 0
268
+ else :
269
+ try :
270
+ y3 = y2 [x2 <= x3 ][- 1 ] # find right y-value for x3==median(maxevals)
271
+ except IndexError : # median(maxevals) is smaller than any data, can only happen because of CrE?
272
+ y3 = y2 [0 ]
273
+ h = plt .plot ((x3 ,), (y3 ,),
274
+ marker = format [0 ],
275
+ markersize = format [1 ] * size_correction_from_n_foreground ** 0.85 ,
276
+ markeredgewidth = format [2 ],
277
+ # marker='x', markersize=24, markeredgewidth=3,
278
+ markeredgecolor = plt .getp (res [0 ], 'color' ),
279
+ ls = plt .getp (res [0 ], 'linestyle' ),
280
+ color = plt .getp (res [0 ], 'color' ),
281
+ # zorder=1.6 # zorder=0;1;1.5 is behind the grid lines, 2 covers other lines, 1.6 is between
282
+ )
283
+ # h.extend(res)
284
+ # res = h # so the last element in res still has the label.
285
+
286
+ # Only take sequences for x and y!
280
287
281
288
return res
282
289
@@ -644,7 +651,8 @@ def main(dictAlg, order=None, outputdir='.', info='default',
644
651
print ('Crafting effort for' , alg , 'is' , CrE )
645
652
646
653
dictData = {} # list of (ert per function) per algorithm
647
- dictMaxEvals = collections .defaultdict (list ) # list of (maxevals per function) per algorithm
654
+ dictMaxEvals = collections .defaultdict (list ) # sum(maxevals) / max(1, #success) per instance
655
+ dictMaxEvals2 = collections .defaultdict (list ) # max of successf and unsucc 90%tile runtime over all instances
648
656
649
657
# funcsolved = [set()] * len(targets) # number of functions solved per target
650
658
xbest = []
@@ -690,7 +698,8 @@ def main(dictAlg, order=None, outputdir='.', info='default',
690
698
samplesize = int (samplesize )
691
699
for f , dictAlgperFunc in sorted (dictFunc .items ()):
692
700
# print(target_values((f, dim)))
693
- for j , t in enumerate (target_values ((f , dim ))):
701
+ targets = target_values ((f , dim ))
702
+ for j , t in enumerate (targets ):
694
703
# for j, t in enumerate(testbedsettings.current_testbed.ecdf_target_values(1e2, f)):
695
704
# funcsolved[j].add(f)
696
705
@@ -737,11 +746,17 @@ def main(dictAlg, order=None, outputdir='.', info='default',
737
746
keyValue = 'f%d' % (f )
738
747
dictData .setdefault (keyValue , []).extend (x )
739
748
# dictMaxEvals.setdefault(keyValue, []).extend(runlengthunsucc)
740
- if len (runlengthunsucc ):
741
- maxmed = np .median (runlengthunsucc )
742
- if len (runlengthsucc ):
743
- maxmed = max ((maxmed , np .median (runlengthsucc )))
744
- dictMaxEvals [keyValue ].append (maxmed )
749
+ if len (runlengthunsucc ) and t == min (targets ): # only once, not for each target as it was before June 2024
750
+ def percentile (vals , which = max_evals_percentile ):
751
+ return toolsstats .prctile (vals , [which ])[0 ]
752
+ if 1 < 3 : # budget_estimates gives the cross somewhat way too far to the right
753
+ if 'entry' in locals ():
754
+ dictMaxEvals [keyValue ].append (percentile (list (entry .budget_effective_estimates .values ())))
755
+ if 1 < 3 :
756
+ maxmed = percentile (runlengthunsucc )
757
+ if len (runlengthsucc ):
758
+ maxmed = max ((maxmed , percentile (runlengthsucc )))
759
+ dictMaxEvals2 [keyValue ].append (maxmed )
745
760
746
761
displaybest = plotType == PlotType .ALG
747
762
if displaybest :
@@ -806,7 +821,6 @@ def algname_to_label(algname, dirname=None):
806
821
for i , alg in enumerate (plotting_style .algorithm_list ):
807
822
try :
808
823
data = dictData [alg ]
809
- maxevals = dictMaxEvals [alg ]
810
824
except KeyError :
811
825
continue
812
826
@@ -837,7 +851,8 @@ def algname_to_label(algname, dirname=None):
837
851
838
852
args .update (plotting_style .pprldmany_styles ) # no idea what this does, maybe update for background algorithms?
839
853
840
- lines .append (plotdata (np .array (data ), x_limit , maxevals ,
854
+ lines .append (plotdata (np .array (data ), x_limit ,
855
+ dictMaxEvals [alg ], maxevals2 = dictMaxEvals2 [alg ],
841
856
CrE = CrEperAlg [alg ], ** args ))
842
857
843
858
if 11 < 3 :
0 commit comments