x <- c(1, 2, 3, 3.4, 3.5, 5, 6, 10)
# easy
z <- fixOverlap(x, thresh = 0.2, trace = TRUE)
# harder
z <- fixOverlap(x, thresh = 0.6, trace = TRUE)
# much harder
z <- fixOverlap(x, thresh = 0.9, trace = TRUE)
# interpret `trace` output
# relatively challenging
x <- c(1, 2, 3.4, 3.4, 3.4, 3.4, 6, 8, 10, 12, 13, 13, 15, 15.5)
# fix overlap, return debugging information
set.seed(10101)
z <- fixOverlap(x, thresh = 0.8, trace = TRUE)
# setup plot device
par(mar = c(4, 4, 1, 1))
layout(matrix(c(1,2,3)), widths = 1, heights = c(1,1,2))
# objective function = overlap + SSD
plot(
seq_along(z$stats), z$stats,
type = 'h', las = 1,
xlab = 'Iteration', ylab = 'Overlap',
cex.axis = 0.8
)
# SSD: deviation from original configuration
plot(
seq_along(z$ssd), z$ssd,
type = 'h', las = 1,
xlab = 'Iteration', ylab = 'Deviation',
cex.axis = 0.8
)
# adjustments at each iteration
matplot(
z$states, type = 'l',
lty = 1, las = 1,
xlab = 'Iteration', ylab = 'x-position'
)
# trace log
# B: boundary condition violation
# O: rank (order) violation
# +: accepted perturbation
# -: rejected perturbation
table(z$log)
Run the code above in your browser using DataLab