The JAVA Implementation of the CMA-ES

The following implementation uses version
Last change: $Date: 2010-03-17 11:43:16 +0100 (Wed, 17 Mar 2010)
of Hansen's CMA-ES, see http://www.lri.fr/~hansen/javadoc/index.html. The function warnings() was modified in the following manner:
private void warning(String s) {
        // commented for SPOT: println(" CMA-ES warning: " + s);
    }
This modification has no negative impact on CMA-ES's performance or behaviour. No further modifications were performed.

We generated a jar file, cmaEs.jar, which implements the CMA-ES. It uses the following command-line arguments.

Example usage:
---
java -jar cmaEs.jar 1 22 100000 50 0 0.0 9 1 2.0 0.5 0.3  null null true

Usage:
---
usage: cmaEs seed d evals f frot arot s restrts ipsf tx isd ls us
  where
    seed    random seed ( e.g. 12345 )
    d       search space dimension ( e.g. 22 )
    evals   maximum number of fitness function evaluations ( e.g. 100000 )
    f       objective function index ( e.g. 50, 10 is Sphere )
    frot    objective function rotation (e.g. 0)
    arot    objective function axis rotation ( e.g. 0.0 )
    s       population size ( e.g. 9 )
    restarts number of restarts ( e.g. 1 )
    ipsf    increase population size factor ( e.g. 2.0 )
    tx      typical X ( e.g. 0.5 )
    isd     initial standard deviations ( e.g. 0.3 )
    ls      lower standard deviations (step sizes)
            ( null                = defaults are chosen by CMA-ES,
              c(ls_0,...,ls_n)   = the vector [ls_0,...,ls_n],
              [ls_0,...,ls_n]    = the vector [ls_0,...,ls_n],
              ls_0,...,ls_n      = the vector [ls_0,...,ls_n] )
    us      upper standard deviations (step sizes)
            ( null                = defaults are chosen by CMA-ES,
              c(us_0,...,us_n)   = the vector [us_0,...,us_n],
              [us_0,...,us_n]    = the vector [us_0,...,us_n],
              us_0,...,us_n      = the vector [us_0,...,us_n] )
    verbose print status messages during runs ( e.g. true )

The JAVA CMA-ES algorithm uses the parameters from Tab. 3. The first parameters are related to the algorithm design and will be specified in SPOT's ROI file, whereas the latter belong to the problem design and will be specified in SPOT's APD file.

Table 3: JAVA CMA-ES: Parameters as reported by the algorithm
\begin{table}
\begin{tabularx}{\textwidth}{lp{0.7\textwidth}}
Name & Parameter\\...
...ation ( e.g. 0.0 )\\
tx & typical X ( e.g. 0.5 )\\
\end{tabularx}\end{table}


Based on these information about the algorithm design, we can modify SPOT's generic interface to existing algorithms, which can be downloaded from the workshop's web site. The modified version looks like follows. It can be downloaded from the workshop's web site. Note, we replaced the variable name ls with varLs, because ls() is a basic R function and it is a bad idea to use existing function names as variable names.

spotAlgStartCmaEsJava <- function(io.apdFileName
		, io.desFileName
		, io.resFileName){
	## read default problem design
	source(io.apdFileName,local=TRUE)
	## read doe/dace etc settings:
	print(io.desFileName)
	des <- read.table(io.desFileName
			, sep=" "
			, header = TRUE
	);
	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("S")){
					s <- round(des$S[k])
				}
				if (exists("RESTARTS")){
					restarts <- round(des$RESTARTS[k])
				}
				if (exists("IPSF")){
					ipsf <- des$IPSF[k]
				}
				if (exists("ISD")){
					isd <- des$ISD[k]
				}
				if (exists("LS")){
					varLs <- des$LS[k]
				}
				if (exists("USPROP")){
					usprop <- des$USPROP[k]
					us <- usprop * (1+varLs)
				}
				## 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:			
				callString <- paste("java -jar cmaEs.jar", 
						seed, d, evals, f, frot, arot, s, restarts, ipsf, tx, isd, varLs, us, "null", "null", "false",
						sep = " ")
				### End of user defined call string.
				y <-system(callString, intern= TRUE)
				res <- NULL
				res <- list(Y=y,
						### 3. User specific parameter values have to be added to the list:  
						S=s,
						RESTARTS=restarts,
						IPSF = ipsf,
						ISD = isd,
						LS = varLs,
						USPROP = usprop,						
						### End of user specific parameter values.
						Function=f,
						EVALS=evals,
						D=d,
						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
			} # end for i
		} # end if(des$REPEATS[k]>=1)
	}	#end for k
	detach(des)
}
This interface can be used to call the CMA-ES from SPOT.

SPOT generates new design points (parameter settings for the CMA-ES) by building a meta model. These designs are based on information provided by the user. These information has to be specified in the following files:

How these information can be specified is described in the tutorial Performing experiments in the SPOT environment, which can be downloaded from the workshop's web site.

bartz 2010-07-08