# Repository of R scripts used by IRIDIA members

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

# Boxplot of solution values by algorithm

```optimal_values<-read.table("optimal_values_100.txt",header=TRUE)

res<-rbind(resFC1x102OPT,resFC26102OPT,resFC27102OPT,resFC28102OPT,resFC29102OPT,resFC36102OPT,resFC37102OPT,resFC38102OPT,resFC39102OPT,resRW1x102OPT,resRW26102OPT,resRW27102OPT,resRW28102OPT,resRW29102OPT,resRW36102OPT,resRW37102OPT,resRW38102OPT,resRW39102OPT,resHC1x102OPT,resHC26102OPT,resHC27102OPT,resHC28102OPT,resHC29102OPT,resHC36102OPT,resHC37102OPT,resHC38102OPT,resHC39102OPT,resUR1x102OPT,resUR26102OPT,resUR27102OPT,resUR28102OPT,resUR29102OPT,resUR36102OPT,resUR37102OPT,resUR38102OPT,resUR39102OPT,resPIR2OPT,resSEQ2OPT,resSEQ22OPT)

linstance<-levels(res\$instance)

res.split<-split(1:nrow(res), list(res\$instance, res\$try, res\$idalgo), drop=TRUE)

min.list <- lapply(res.split, function(x){
x[match(min(res\$best[x]), res\$best[x])]
})

# matches return the first among all the values with min best!!!
# so is not the one with minimal time

min.vector <- unlist(min.list)

bestalgo<-res[min.vector,]

bestalgo.split <- split(1:nrow(bestalgo), bestalgo\$instance, drop=TRUE)

for (i in (1:length(bestalgo.split)))
{
bestalgo.vector <- unlist(bestalgo.split[i])
bestalgo.temp <- bestalgo[bestalgo.vector,]
l<-split(bestalgo.temp\$best,bestalgo.temp\$idalgo)

epsfile=paste(linstance[i],"_100_nolim.eps",sep="")
postscript(file=epsfile,onefile=TRUE,horizontal=TRUE)
par(mar=c(5,5,5,3),cex.axis=0.7,las=2,mgp=c(4, 1, 0))
title_plot=paste("100 iterations - instance ",linstance[i],sep="")
boxplot(l,xlab="",ylab="solution value",names=c(levels(bestalgo\$idalgo)),main=title_plot,yaxt="n",ylim=c(optimal_values[optimal_values\$instance==linstance[i],]\$optimum,max(bestalgo.temp\$best)))
axis(2, seq(from=optimal_values[optimal_values\$instance==linstance[i],]\$optimum,to=max(bestalgo.temp\$best),length.out=10))
abline(h=optimal_values[optimal_values\$instance==linstance[i],]\$optimum)
grid(nx=0, ny=55,col="gray5")
dev.off()
}
```