DM841 DISCRETE OPTIMIZATION Part 2 – Heuristics
Experimental Analysis
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Experimental Analysis Marco Chiarandini Department of Mathematics - - PowerPoint PPT Presentation
DM841 D ISCRETE O PTIMIZATION Part 2 Heuristics Experimental Analysis Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline Outline Experimental Analysis 1. Experimental Analysis
Department of Mathematics & Computer Science University of Southern Denmark
Outline Experimental Analysis
2
Outline Experimental Analysis
3
Outline Experimental Analysis
4
Outline Experimental Analysis
◮ Exploratory data analysis ◮ Presenting results in a concise way with graphs and tables ◮ Organizational issues and Experimental Design ◮ Basics of inferential statistics ◮ Sequential statistical testing: race, a methodology for tuning
5
Outline Experimental Analysis
◮ Exploratory data analysis ◮ Presenting results in a concise way with graphs and tables ◮ Organizational issues and Experimental Design ◮ Basics of inferential statistics ◮ Sequential statistical testing: race, a methodology for tuning
5
Outline Experimental Analysis
◮ Exploratory data analysis ◮ Presenting results in a concise way with graphs and tables ◮ Organizational issues and Experimental Design ◮ Basics of inferential statistics ◮ Sequential statistical testing: race, a methodology for tuning
5
Outline Experimental Analysis
6
Outline Experimental Analysis
7
Outline Experimental Analysis
◮ Defining standard methodologies ◮ Comparing relative performance of algorithms so as to identify the best
◮ Characterizing the behavior of algorithms ◮ Identifying algorithm separators, i.e., families of problem instances for
◮ Providing new insights in algorithm design
8
Outline Experimental Analysis
◮ possibly all algorithms must be implemented with the same style, with
◮ the code must be optimized, e.g., using the best possible data structures ◮ running times must be comparable, e.g., by running experiments on the
9
Outline Experimental Analysis
10
Outline Experimental Analysis
10
−∞
Outline Experimental Analysis
13
Outline Experimental Analysis
13
Outline Experimental Analysis
13
Outline Experimental Analysis
r
14
Outline Experimental Analysis
15
Outline Experimental Analysis
◮ real world instances ◮ random variants of real world-instances ◮ online libraries ◮ randomly generated instances
15
Outline Experimental Analysis
◮ real world instances ◮ random variants of real world-instances ◮ online libraries ◮ randomly generated instances
◮ type (for features that might impact performance) ◮ size (for scaling studies) ◮ hardness (focus on hard instances) ◮ application (e.g., CSP encodings of scheduling problems), ...
15
Outline Experimental Analysis
◮ real world instances ◮ random variants of real world-instances ◮ online libraries ◮ randomly generated instances
◮ type (for features that might impact performance) ◮ size (for scaling studies) ◮ hardness (focus on hard instances) ◮ application (e.g., CSP encodings of scheduling problems), ...
15
Outline Experimental Analysis
◮ describe, summarizing, the data (descriptive statistics) ◮ make inference on those data (inferential statistics)
16
Outline Experimental Analysis
◮ describe, summarizing, the data (descriptive statistics) ◮ make inference on those data (inferential statistics)
◮ guarantee reproducibility ◮ make results reliable
◮ extract relevant results from large amount of data
16
Outline Experimental Analysis
◮ describe, summarizing, the data (descriptive statistics) ◮ make inference on those data (inferential statistics)
◮ guarantee reproducibility ◮ make results reliable
◮ extract relevant results from large amount of data
16
Outline Experimental Analysis
◮ Comparison:
◮ Standard statistical methods:
Response −2 2 0.0 0.1 0.2 0.3 0.4
Response −2 2
17
Outline Experimental Analysis
◮ Comparison:
◮ Standard statistical methods:
◮ Characterization:
◮ Standard statistical methods: linear
0.01 0.01 0.1 1 10 100 1000 3600 20 40 80 200 400 800 1600
Uniform random graphs
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++++ + + + + + + + + + + + + + + + + + Size Seconds p=0 p=0.1 p=0.2 p=0.5 p=0.9
17
Outline Experimental Analysis
18
Outline Experimental Analysis
Algorithm 1 Algorithm 2 . . . Algorithm k Instance 1 X11 X21 Xk1 . . . . . . . . . . . . Instance 1 X1r X2r Xkr
19
Outline Experimental Analysis
◮ number of elementary operations/algorithmic iterations
◮ total CPU time consumed by the process
20
Outline Experimental Analysis
◮ number of elementary operations/algorithmic iterations
◮ total CPU time consumed by the process
◮ value returned by the cost function ◮ error from optimum/reference value ◮ (optimality) gap UB−LB LB+ǫ
UB+ǫ )
◮ ranks
20
Outline Experimental Analysis
Algorithm 1 Algorithm 2 . . . Algorithm k Instance 1 X11 X12 X1k . . . . . . . . . . . . Instance b Xb1 Xb2 Xbk
Algorithm 1 Algorithm 2 . . . Algorithm k Instance 1 X111, . . . , X11r X121, . . . , X12r X1k1, . . . , X1kr Instance 2 X211, . . . , X21r X221, . . . , X22r X2k1, . . . , X2kr . . . . . . . . . . . . Instance b Xb11, . . . , Xb1r Xb21, . . . , Xb2r Xbk1, . . . , Xbkr
21
Outline Experimental Analysis
◮ no transformation if the interest is in studying scaling ◮ standardization if a fixed time limit is used ◮ geometric mean (used for a set of numbers whose values are meant to
◮ otherwise, better to group homogeneously the instances
22
Outline Experimental Analysis
◮ no transformation if the interest is in studying scaling ◮ standardization if a fixed time limit is used ◮ geometric mean (used for a set of numbers whose values are meant to
◮ otherwise, better to group homogeneously the instances
22
◮ Distance or error from a reference value
◮ optimal value computed exactly or known by construction ◮ surrogate value such bounds or best known values
◮ Rank (no need for standardization but loss of information)
Outline Experimental Analysis
◮ We work with samples (instances, solution quality) drawn from
24
Outline Experimental Analysis
◮ We work with samples (instances, solution quality) drawn from
24
Outline Experimental Analysis
◮ Measure of central tendency, location ◮ Measure of dispersion
◮ a parameter if it refers to the population (Greek letters) ◮ a statistics if it is an estimation of a population parameter from the
25
◮ Arithmetic Average (Sample mean)
◮ Quantile: value above or below which lie a fractional part of the data
◮ Median
◮ Quartile
◮ q-quantile
◮ Mode
Outline Experimental Analysis
◮ Sample range
◮ Sample variance
◮ Standard deviation
◮ Inter-quartile range
27
Histogram 95 100 105 110 115 0.00 0.05 0.10 0.15 0.20 0.25 0.30 95 100 105 110 115 0.0 0.2 0.4 0.6 0.8 1.0 100 105 110 115 95 100 105 110 115 Boxplot 95 Density Fn(x) Empirical cumulative distribution function Median
Q3 Max Min Q1 IQR Q1−1.5*IQR Average
Outline Experimental Analysis Colors Density
0.00 0.05 0.10 0.15 0.20 0.25 80 82 84 86 88 90
Colors
TS1 TS2 TS3 80 82 84 86 88 90
30
Outline Experimental Analysis
> x<-runif (10 ,0 ,1) mean(x), median(x), quantile(x), quantile(x ,0.25) range(x), var(x), sd(x), IQR(x) > fivenum(x) #(minimum , lower -hinge , median , upper -hinge , maximum) [1] 0.18672 0.26682 0.28927 0.69359 0.92343 > summary(x) > aggregate(x,list(factors),median) > boxplot(x)
31
Outline Experimental Analysis
32
Outline Experimental Analysis
33
Outline Experimental Analysis
34
Outline Experimental Analysis
1 , A⊣ 2 , A⊣ 3 on class CΠ.
35
Outline Experimental Analysis
1 , A⊣ 2 , A⊣ 3 on class CΠ.
◮ Scatter plots of solution-cost and run-time
35
Outline Experimental Analysis
Outline Experimental Analysis
i ≤ x2 i for all i = 1, . . . , n
37
Outline Experimental Analysis
log= ''
y =ex
log= 'x'
y =ex
log= 'y'
y =ex
log= 'xy'
y =ex
log= ''
y =xe
log= 'x'
y =xe
log= 'y'
y =xe
log= 'xy'
y =xe
log= ''
y =log x
log= 'x'
y =log x
log= 'y'
y =log x
log= 'xy'
y =log x
38
Outline Experimental Analysis
size time
10^−4 10^−2 10^0 10^2
10^2.4 10^3.0
10^2.4 10^3.0
10^2.4 10^3.0
10^2.4 10^3.0
10^2.4 10^3.0 10^−4 10^−2 10^0 10^2
39
Outline Experimental Analysis
size time
10^−4 10^−2 10^0 10^2 10^2.4 10^2.6 10^2.8 10^3.0 10^3.2 10^3.4
DSATUR 071275 191076 250684 230183 270383 181180 ROS 240284
Outline Experimental Analysis
41
Outline Experimental Analysis
42
Outline Experimental Analysis
1 , A∞ 2 , A∞ 3 on class CΠ.
1 , A∞ 2 , A∞ 3 on class CΠ without interest in
43
Outline Experimental Analysis
1 , A∞ 2 , A∞ 3 on class CΠ.
1 , A∞ 2 , A∞ 3 on class CΠ without interest in
◮ Histograms (summary measures: mean or median or mode?) ◮ Boxplots ◮ Empirical cumulative distribution functions (ECDFs)
43
# # l o a d t h e d a t a > l o a d ( " r e s u l t s . r d a " ) > l e v e l s (DATA$ i n s t a n c e ) [ 1 ] " queen4 _ 4 . t x t " " queen5 _ 5 . t x t " " queen6 _ 6 . t x t " " queen7 _ 7 . t x t " [ 5 ] " queen8 _ 8 . t x t " " queen9 _ 9 . t x t " " queen10 _ 1 0 . t x t " " queen11 _ 1 1 . t x t " [ 9 ] " queen12 _ 1 2 . t x t " " queen13 _ 1 3 . t x t " " queen14 _ 1 4 . t x t " " queen15 _ 1 5 . t x t " [ 1 3 ] " queen16 _ 1 6 . t x t " " queen17 _ 1 7 . t x t " " queen18 _ 1 8 . t x t " " queen19 _ 1 9 . t x t " [ 1 7 ] " queen20 _ 2 0 . t x t " " queen21 _ 2 1 . t x t " " queen22 _ 2 2 . t x t " " queen23 _ 2 3 . t x t " [ 2 1 ] " queen24 _ 2 4 . t x t " " queen25 _ 2 5 . t x t " " queen26 _ 2 6 . t x t " " queen27 _ 2 7 . t x t " [ 2 5 ] " queen28 _ 2 8 . t x t " " queen29 _ 2 9 . t x t " " queen30 _ 3 0 . t x t " " queen31 _ 3 1 . t x t " [ 2 9 ] " queen32 _ 3 2 . t x t " > bwplot ( r e o r d e r ( a l g , col , m e d i a n ) ~ col , d a t a= DATA)
col
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190 10 20 30 40 50
> bwplot ( r e o r d e r ( a l g , col , m e d i a n ) ~ c o l | i n s t a n c e , d a t a= DATA, a s . t a b l e= TRUE)
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190
10 20 30 40 50
10 20 30 40 50
10 20 30 40 50
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190
200975 rlf 080986 290786 280881 040885 060511 100387 160783 230190 10 20 30 40 50
10 20 30 40 50
10 20 30 40 50
Outline Experimental Analysis Colors Density
0.00 0.05 0.10 0.15 0.20 0.25 80 82 84 86 88 90
Colors
TS1 TS2 TS3 80 82 84 86 88 90
46
Outline Experimental Analysis
TS2 TS3 −3 −2 −1 1 2 3
Standard error: x − x σ
TS1 TS2 TS3 0.2 0.4 0.6 0.8 1.0 1.2 1.4
Relative error: x − x(opt) x(opt)
TS2 TS3 0.1 0.2 0.3 0.4 0.5
Invariant error: x − x(opt) x(worst) − x(opt)
TS1 TS2 TS3 5 10 15 20 25 30
Ranks
47
Outline Experimental Analysis
−3 −2 −1 1 2 3 0.0 0.2 0.4 0.6 0.8 1.0
Standard error: x − x σ
Proportion <= x
TS1 TS2 TS3
0.2 0.4 0.6 0.8 1.0 1.2 1.4 0.0 0.2 0.4 0.6 0.8 1.0
Relative error: x − x(opt) x(opt)
Proportion <= x
TS1 TS2 TS3
0.1 0.2 0.3 0.4 0.5 0.0 0.2 0.4 0.6 0.8 1.0
Invariant error: x − x(opt) x(worst) − x(opt)
Proportion <= x
TS1 TS2 TS3
5 10 15 20 25 30 0.0 0.2 0.4 0.6 0.8 1.0
Ranks
Proportion <= x
TS1 TS2 TS3 47
Outline Experimental Analysis
15 20 25 30 35 40 45 0.0 0.2 0.4 0.6 0.8 1.0 x F(x) 20 30 40 50 0.0 0.2 0.4 0.6 0.8 1.0 x F(x)
48
> load("TS.class -G.dataR") > G[1:5 ,] alg inst run sol time.last.imp tot.iter parz.iter exit.iter exit.time
1 TS1 G -1000 -0.5 -30 -1.1. col 1 59 9.900619 5955 442 5955 10.02463 30 2 TS1 G -1000 -0.5 -30 -1.1. col 2 64 9.736608 3880 130 3958 10.00062 30 3 TS1 G -1000 -0.5 -30 -1.1. col 3 64 9.908618 4877 49 4877 10.03263 30 4 TS1 G -1000 -0.5 -30 -1.1. col 4 68 9.948622 6996 409 6996 10.07663 30 5 TS1 G -1000 -0.5 -30 -1.1. col 5 63 9.912620 3986 52 3986 10.04063 30 > > library(lattice) > bwplot(alg ~ sol | inst ,data=G)
> load("TS.class -G.dataR") > G[1:5 ,] alg inst run sol time.last.imp tot.iter parz.iter exit.iter exit.time
1 TS1 G -1000 -0.5 -30 -1.1. col 1 59 9.900619 5955 442 5955 10.02463 30 2 TS1 G -1000 -0.5 -30 -1.1. col 2 64 9.736608 3880 130 3958 10.00062 30 3 TS1 G -1000 -0.5 -30 -1.1. col 3 64 9.908618 4877 49 4877 10.03263 30 4 TS1 G -1000 -0.5 -30 -1.1. col 4 68 9.948622 6996 409 6996 10.07663 30 5 TS1 G -1000 -0.5 -30 -1.1. col 5 63 9.912620 3986 52 3986 10.04063 30 > > library(lattice) > bwplot(alg ~ sol | inst ,data=G)
◮ maintain the raw data, ◮ transform data in standard error, ◮ transform the data in relative error, ◮ transform the data in an invariant error, ◮ transform the data in ranks.
Outline Experimental Analysis
> par(mfrow=c(3 ,2),las=1,font.main=1,mar=c(2,3,3,1)) > #original data > boxplot(sol~alg ,data=G, horizontal =TRUE ,main="Original data")
50
Outline Experimental Analysis
> #standard error > T1 <- split(G$sol ,list(G$inst)) > T2 <- lapply(T1 ,scale ,center=TRUE ,scale=TRUE) > T3 <- unsplit(T2 ,list(G$inst)) > T4 <- split(T3 ,list(G$alg)) > T5 <- stack(T4) > boxplot(values~ind ,data=T5 , horizontal =TRUE ,main= expression (paste(" Standard error: ",frac(x-bar(x),sqrt(sigma))))) > library( latticeExtra ) > ecdfplot(~values ,group=ind ,data=T5 ,main=expression (paste("Standard error: ",frac(x-bar(x),sqrt(sigma))))) > #standard error > G$scale <- 0 > split(G$scale , G$inst) <- lapply(split(G$sol , G$inst), scale ,center= TRUE ,scale=TRUE)
51
Outline Experimental Analysis
> #relative error > G$err2 <- (G$sol -G$opt)/G$opt > boxplot(err2~alg ,data=G,horizontal=TRUE ,main= expression (paste(" Relative error: ",frac(x-x^( opt),x^( opt))))) > ecdfplot(G$err2 ,group=G$alg ,main= expression (paste("Relative error: ", frac(x-x^( opt),x^( opt)))))
52
Outline Experimental Analysis
> #error 3 > load("ROS.class -G.dataR") > F1 <- aggregate (F$sol ,list(inst=F$inst),median) > F2 <- split(F1$x,list(F1$inst)) > G$ref <- sapply(G$inst ,function(x) F2[[x]]) > G$err3 <- (G$sol -G$opt)/(G$ref -G$opt) > boxplot(err3~alg ,data=G,horizontal=TRUE ,main= expression (paste(" Invariant error: ",frac(x-x^( opt),x^( worst)-x^( opt))))) > ecdfplot(G$err3 ,group=G$alg ,main= expression (paste("Invariant error: ", frac(x-x^( opt),x^( worst)-x^( opt)))))
53
Outline Experimental Analysis
> #rank > G$rank <- G$sol > split(G$rank , G$inst) <- lapply(split(G$sol , D$inst), rank) > bwplot(rank~reorder(alg ,rank ,median),data=G,horizontal=TRUE ,main=" Ranks") > ecdfplot(rank ,group=alg ,data=G,main="Ranks")
54
> # # Let ’ s m a k e t h e r a n k s
t h e c o l o r s > T1 < - s p l i t (DATA[ " c o l " ] , DATA[ " i n s t a n c e " ] ) > T2 < - l a p p l y (T1 , r a n k , n a . l a s t = " keep " ) > T3 < - u n s p l i t (T2 , DATA[ " i n s t a n c e " ] ) > DATA$ r a n k < - T3 > > # # w e p l o t t h e r a n k s f o r a n a g g r e g a t e a n a l y s i s > # # r e o d e r s o r t t h e f a c t o r a l g o r i t h m b y m e d i a n v a l u e s > bwplot ( r e o r d e r ( a l g , r a n k , m e d i a n ) ~ r a n k , d a t a = DATA)
rank
rlf 200975 080986 290786 280881 040885 100387 160783 060511 230190 2 4 6 8 10
Outline Experimental Analysis
56
Outline Experimental Analysis
57
Outline Experimental Analysis
◮ Ti if Ti ≤ Li ◮ or Ti ≥ Li.
58
Outline Experimental Analysis
10 20 50 100 200 500 2000 0.0 0.2 0.4 0.6 0.8 1.0 Time to find the optimum ecdf Heuristic Exact
59
Outline Experimental Analysis
60
Outline Experimental Analysis
61
Outline Experimental Analysis
1 , A∞ 2 , A∞ 3 on instance π.
62
Outline Experimental Analysis
1 , A∞ 2 , A∞ 3 on instance π.
◮ Quality profiles
62
Outline Experimental Analysis
time cost 70 80 90 100 200 400 600 800 1000 1200 Novelty 200 400 600 800 1000 1200 Tabu Search
63
Outline Experimental Analysis
Time occasion Colors
70 80 90 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
70 80 90 100
63
Outline Experimental Analysis
time cost 70 80 90 100 200 400 600 800 1000 1200 Novelty Tabu Search
63
Outline Experimental Analysis
◮ make plots: histograms, boxplots, empirical cumulative distribution
◮ look at the numerical data and interpret them in practical terms:
◮ look for patterns
64
Outline Experimental Analysis
65
Outline Experimental Analysis
http://algo2.iti.uni-karlsruhe.de/sanders/courses/bergen/bergenPresenting.pdf
◮ Should the experimental setup from the exploratory phase be redesigned to
◮ What parameters should be varied? What variables should be measured? ◮ How are parameters chosen that cannot be varied? ◮ Can tables be converted into curves, bar charts, scatter plots or any other
◮ Should tables be added in an appendix? ◮ Should a 3D-plot be replaced by collections of 2D-curves? ◮ Can we reduce the number of curves to be displayed? ◮ How many figures are needed? ◮ Should the x-axis be transformed to magnify interesting subranges?
67
◮ Should the x-axis have a logarithmic scale? If so, do the x-values used
◮ Is the range of x-values adequate? ◮ Do we have measurements for the right x-values, i.e., nowhere too dense
◮ Should the y-axis be transformed to make the interesting part of the
◮ Should the y-axis have a logarithmic scale? ◮ Is it misleading to start the y-range at the smallest measured value?
◮ Clip the range of y-values to exclude useless parts of curves? ◮ Can we use banking to 45o? ◮ Are all curves sufficiently well separated? ◮ Can noise be reduced using more accurate measurements? ◮ Are error bars needed? If so, what should they indicate? Remember that
Outline Experimental Analysis
◮ Connect points belonging to the same curve. ◮ Only use splines for connecting points if interpolation is sensible. ◮ Do not connect points belonging to unrelated problem instances. ◮ Use different point and line styles for different curves. ◮ Use the same styles for corresponding curves in different graphs. ◮ Place labels defining point and line styles in the right order and without
◮ Give axis units ◮ Captions should make figures self contained. ◮ Give enough information to make experiments reproducible. ◮ Golden ratio rule: make the graph wider than higher [Tufte 1983]. ◮ Rule of 7: show at most 7 curves (omit those clearly irrelevant). ◮ Avoid: explaining axes, connecting unrelated points by lines, cryptic
69
Outline Experimental Analysis
71