spotAlgStartSann <- function(spotConfig){
io.apdFileName=spotConfig$io.apdFileName;
io.desFileName=spotConfig$io.desFileName;
io.resFileName=spotConfig$io.resFileName;
x0<-NULL
maxit<-NULL
parscale<-NULL
f<-NULL
n<-NULL
if (spotConfig$spot.fileMode){ ##Check if spotConfig was passed to the algorithm, if yes the spot.fileMode is chosen with False wich means results have to be passed to spotConfig and not to res file.
writeLines(paste("Loading design file data from::", io.desFileName), con=stderr());
## read doe/dace etc settings:
des <- read.table( io.desFileName, sep=" ", header = TRUE);
}else{
des <- spotConfig$alg.currentDesign; ##The if/else should not be necessary anymore, since des will always be written into the spotConfig
}
source(io.apdFileName,local=TRUE)
pNames <- names(des);
config<-nrow(des);
for (k in 1:config){
for (i in 1:des$REPEATS[k]){
if (is.element("TEMP", pNames)){
temp <- des$TEMP[k]
}
if (is.element("TMAX", pNames)){
tmax <- round(des$TMAX[k])
}
conf <- k
if (is.element("CONFIG", pNames)){
conf <- des$CONFIG[k]
}
spotStep<-NA
if (is.element("STEP", pNames)){
spotStep <- des$STEP[k]
}
seed <- des$SEED[k]+i-1
set.seed(seed)
y <- optim(x0, spotNoisyBraninFunction, method="SANN",
control=list(maxit=maxit, temp=temp, tmax=tmax, parscale=parscale))
res <- NULL
res <- list(Y=y$value, TEMP=temp, TMAX=tmax, FUNCTION=f, DIM=n, SEED=seed, CONFIG=conf)
if (is.element("STEP", pNames)){
res=c(res,STEP=spotStep)
}
res <-data.frame(res)
if (spotConfig$spot.fileMode){ ##Log the result in the .res file, only if user didnt set fileMode==FALSE
colNames = TRUE
if (file.exists(io.resFileName)){
colNames = FALSE
}
write.table(res, file = io.resFileName, row.names = FALSE,
col.names = colNames, sep = " ", append = !colNames, quote = FALSE);
colNames = FALSE
}
spotConfig$alg.currentResult=rbind(spotConfig$alg.currentResult,res);#always log the results in spotConfig
}
}
return(spotConfig)
}
This interface is used to call SANN from SPOT.