spotInterfacingTemplate <- function(spotConfig){ io.apdFileName=spotConfig$io.apdFileName; io.desFileName=spotConfig$io.desFileName; io.resFileName=spotConfig$io.resFileName; ## read default problem design source(io.apdFileName,local=TRUE) ## read doe/dace etc settings: print(io.desFileName) 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 } config<-nrow(des); attach(des) for (k in 1:config){ if(des$REPEATS[k]>=1){ for (i in 1:des$REPEATS[k]){ ### 1. Add user defined parameters here: if (exists("SIGMANULL")){ sigma0 <- des$SIGMANULL[k] } if (exists("VARA")){ a <- des$VARA[k] } if (exists("VARG")){ g <- round(des$VARG[k]) } ### End of user defined section. conf <- k if (exists("CONFIG")){ conf <- des$CONFIG[k] } spotStep<-NA if (exists("STEP")){ spotStep <- des$STEP[k] } seed <- des$SEED[k]+i ### 2. The call string has to be modified by the user: #browser() callString <- paste("java -jar simpleOnePlusOneES.jar", seed, steps, target, f, n, xp0, sigma0, a, g, px, py, sep = " ") ### End of user defined call string. y <-system(callString, intern= TRUE) res <- NULL res <- list(Y=as.numeric(as.character(y)), ### 3. User specific parameter values have to be added to the list: SIGMANULL=sigma0, VARA=a, VARG=g, ### End of user specific parameter values. Function=f, MAXITER=steps, DIM=n, TARGET=target, SEED=seed, CONFIG=conf ) if (exists("STEP")){ res=c(res,STEP=spotStep) } res <-data.frame(res) colNames = TRUE if (file.exists(io.resFileName)){ colNames = FALSE } ## quote = false is required for JAVA 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 } # end for i } # end if(des$REPEATS[k]>=1) } #end for k return(spotConfig); #detach(des) }