| CEoptim {CEoptim} | R Documentation |
Cross-Entropy optimizer
Description
CEopt is an optimization function based on the Cross-Entropy method
Usage
CEoptim(f, f.arg=NULL, maximize=FALSE, continuous=NULL, discrete=NULL,
N=100L, rho=0.1, iterThr=1e4L, noImproveThr=5, verbose=FALSE)
Arguments
f |
Function to be optimized. Can have continuous and discrete arguments |
f.arg |
List of additional fixed arguments passed to function f. |
maximize |
Logical value determining whether to maximize or minimize the objective function |
continuous |
List of arguments for the continuous optimization part consisting of: |
-
meanVector of initial means. -
sdVector of initial standard deviations. -
smoothMeanSmoothing parameter for the vector of means. Default value 1 (no smoothing). -
smoothSdSmoothing parameter for the standard deviations. Default value 1 (no smoothing). -
sdThrPositive numeric convergence threshold. Check whether the maximum standard deviation is smaller thansdThr. Default value 0.001. -
conMatCoefficient matrix of linear constraintconMatx \leconVec. -
conVecValue vector of linear constraintconMatx \leconVec.
discrete |
List of arguments for the discrete optimization part, consisting of: |
-
categoriesInteger vector which defines the allowed values of the categorical variables. Theith categorical variable takes values in the set {0,1,...,categories(i)-1}. -
probsList of initial probabilities for the categorical variables. Defaults to equal (uniform) probabilities. -
smoothProbSmoothing parameter for the probabilities of the categorical sampling distribution. Default value 1 (no smoothing). -
ProbThrPositive numeric convergence threshold. Check whether all probabilities in the categorical sampling distributions deviate less thanProbThrfrom either 0 or 1. Default value 0.001.
N |
Integer representing the CE sample size. |
rho |
Value between 0 and 1 representing the elite proportion. |
iterThr |
Termination threshold on the largest number of iterations. |
noImproveThr |
Termination threshold on the largest number of iterations during which no improvement of the best function value is found. |
verbose |
Logical value set for CE progress output. |
Value
CEoptim returns an object of class "CEoptim" which is a list with the following components.
optimum Optimal value of
f.optimizer List of the location of the optimal value, consisting of:
continuous Continuous part of the optimizer.
discrete Discrete part of the optimizer.
termination List of termination information consisting of:
niter Total number of iterations upon termination.
convergence One of the following statements:
Not converged, if the number of iterations reachesiterThr;The optimum did not change for noImproveThr iterations, if the best value has not improved fornoImproveThriterations;Variances converged, otherwise.
states List of intermediate results computed at each iteration. It consists of the iteration number (
iter), the best overall value (optimum) and the worst value of the elite samples, (gammat). The means (mean) and maximum standard deviations (maxSd) of the elite set are also included for continuous cases, and the maximum deviations (maxProbs) of the sampling probabilities to either 0 or 1 are included for discrete cases.states.probs List of categorical sampling probabilities computed at each iteration. Will only be returned for discrete and mixed cases.
Note
Although partial parameter passing is allowed outside lists, it is recommended that parameters names are specified in full. Parameters inside lists have to specified completely.
Because CEoptim is a random function it is useful to (1)
set the seed for the random number generator (for testing purposes),
and (2)
investigate the quality of the results by repeating
the optimization a number of times.
Author(s)
Tim Benham, Qibin Duan, Dirk P. Kroese, Benoit Liquet
References
Benham T., Duan Q., Kroese D.P., Liquet B. (2017) CEoptim: Cross-Entropy R package for optimization. Journal of Statistical Software, 76(8), 1-29.
Rubinstein R.Y. and Kroese D.P. (2004). The Cross-Entropy Method. Springer, New York.
Examples
## Maximizing the Peaks Function
fun <- function(x){
return(3*(1-x[1])^2*exp(-x[1]^2 - (x[2]+1)^2)
-10*(x[1]/5-x[1]^3 - x[2]^5)*exp(-x[1]^2 - x[2]^2)
-1/3*exp(-(x[1]+1)^2 - x[2]^2))}
set.seed(1234)
mu0 <- c(-3,-3); sigma0 <- c(10,10)
res <- CEoptim(fun,continuous=list(mean=mu0, sd=sigma0), maximize=TRUE)
## To extract the Optimal value of fun
res$optimum
## To extract the location of the optimal value
res$optimizer$continuous
## print function gives the following default values
print(res)