DEoptimR/0000755000175100001440000000000013014104362011745 5ustar hornikusersDEoptimR/inst/0000755000175100001440000000000013014064762012733 5ustar hornikusersDEoptimR/inst/NEWS.Rd0000644000175100001440000000135212736743116014006 0ustar hornikusers\name{NEWS} \title{News for package 'DEoptimR'} \section{Changes in DEoptimR version 1.0-6 (2016-07-05)}{ \itemize{ \item Argument \code{FUN} renamed to \code{compare_to}. } } \section{Changes in DEoptimR version 1.0-5 (2016-07-01)}{ \itemize{ \item Arguments \code{tau1}, \code{tau2} and \code{tau3} renamed to \code{tau_F}, \code{tau_CR} and \code{tau_pF}, respectively. } } \section{Changes in DEoptimR version 1.0-0 (2014-01-27)}{ \itemize{ \item First release of DEoptimR: implementation of a bespoke variant of the jDE algorithm. \item Constraint handling based on biasing feasible over unfeasible solutions by a parameter-less variant of the \eqn{\varepsilon}{epsilon}-constrained method. } }DEoptimR/inst/xtraR/0000755000175100001440000000000013014064762014033 5ustar hornikusersDEoptimR/inst/xtraR/opt-test-funs.R0000644000175100001440000001211112250315111016666 0ustar hornikusersswf <- function(x) { ## Schwefel problem ## ## -500 <= xi <= 500, i = {1, 2, ..., n} ## The number of local minima for a given n is not known, but the global minimum ## f(x*) = -418.9829n is located at x* = (s, s, ..., s), s = 420.97. ## ## Source: ## Ali, M. Montaz, Khompatraporn, Charoenchai, and Zabinsky, Zelda B. (2005). ## A numerical evaluation of several stochastic algorithms on selected ## continuous global optimization test problems. ## Journal of Global Optimization 31, 635-672. -crossprod( x, sin(sqrt(abs(x))) ) } sf1 <- function(x) { ## Schaffer 1 problem ## ## -100 <= x1, x2 <= 100 ## The number of local minima is not known but ## the global minimum is located at x* = (0, 0) with f(x*) = 0. ## ## Source: ## Ali, M. Montaz, Khompatraporn, Charoenchai, and Zabinsky, Zelda B. (2005). ## A numerical evaluation of several stochastic algorithms on selected ## continuous global optimization test problems. ## Journal of Global Optimization 31, 635-672. temp <- x[1]^2 + x[2]^2 0.5 + (sin(sqrt(temp))^2 - 0.5)/(1 + 0.001*temp)^2 } RND <- list(obj = function(x) { ## Reactor network design ## ## 1e-5 <= x5, x6 <= 16 ## It possesses two local solutions at x = (16, 0) with f = -0.37461 ## and at x = (0, 16) with f = -0.38808. ## The global optimum is (x5, x6; f) = (3.036504, 5.096052; -0.388812). ## ## Source: ## Babu, B. V., and Angira, Rakesh (2006). ## Modified differential evolution (MDE) for optimization of nonlinear ## chemical processes. ## Computers and Chemical Engineering 30, 989-1002. x5 <- x[1]; x6 <- x[2] k1 <- 0.09755988; k2 <- 0.99*k1; k3 <- 0.0391908; k4 <- 0.9*k3 -( k2*x6*(1 + k3*x5) + k1*x5*(1 + k2*x6) ) / ( (1 + k1*x5)*(1 + k2*x6)* (1 + k3*x5)*(1 + k4*x6) ) }, con = function(x) sqrt(x[1]) + sqrt(x[2]) - 4 ) HEND <- list(obj = function(x) { ## Heat exchanger network design ## ## 100 <= x1 <= 10000, 1000 <= x2, x3 <= 10000, ## 10 <= x4, x5 <= 1000 ## The global optimum is (x1, x2, x3, x4, x5; f) = (579.19, 1360.13, ## 5109.92, 182.01, 295.60; 7049.25). ## ## Source: ## Babu, B. V., and Angira, Rakesh (2006). ## Modified differential evolution (MDE) for optimization of nonlinear ## chemical processes. ## Computers and Chemical Engineering 30, 989-1002. x[1] + x[2] + x[3] }, con = function(x) { x1 <- x[1]; x2 <- x[2]; x3 <- x[3]; x4 <- x[4]; x5 <- x[5] c(100*x1 - x1*(400 -x4) + 833.33252*x4 -83333.333, x2*x4 - x2*(400 - x5 + x4) - 1250*x4 + 1250*x5, x3*x5 - x3*(100 + x5) - 2500*x5 + 1250000) }) alkylation <- list(obj = function(x) { ## Optimal operation of alkylation unit ## ## Variable Lower Bound Upper Bound ## ------------------------------------ ## x1 1500 2000 ## x2 1 120 ## x3 3000 3500 ## x4 85 93 ## x5 90 95 ## x6 3 12 ## x7 145 162 ## ------------------------------------ ## The maximum profit is $1766.36 per day, and the optimal ## variable values are x1 = 1698.256922, x2 = 54.274463, x3 = 3031.357313, ## x4 = 90.190233, x5 = 95.0, x6 = 10.504119, x7 = 153.535355. ## ## Source: ## Babu, B. V., and Angira, Rakesh (2006). ## Modified differential evolution (MDE) for optimization of nonlinear ## chemical processes. ## Computers and Chemical Engineering 30, 989-1002. x1 <- x[1]; x3 <- x[3] 1.715*x1 + 0.035*x1*x[6] + 4.0565*x3 +10.0*x[2] - 0.063*x3*x[5] }, con = function(x) { x1 <- x[1]; x2 <- x[2]; x3 <- x[3]; x4 <- x[4] x5 <- x[5]; x6 <- x[6]; x7 <- x[7] c(0.0059553571*x6^2*x1 + 0.88392857*x3 - 0.1175625*x6*x1 - x1, 1.1088*x1 + 0.1303533*x1*x6 - 0.0066033*x1*x6^2 - x3, 6.66173269*x6^2 + 172.39878*x5 -56.596669*x4 - 191.20592*x6 - 10000, 1.08702*x6 + 0.32175*x4 - 0.03762*x6^2 - x5 + 56.85075, 0.006198*x7*x4*x3 + 2462.3121*x2 -25.125634*x2*x4 - x3*x4, 161.18996*x3*x4 + 5000.0*x2*x4 - 489510.0*x2 - x3*x4*x7, 0.33*x7 - x5 + 44.333333, 0.022556*x5 - 0.007595*x7 - 1.0, 0.00061*x3 - 0.0005*x1 - 1.0, 0.819672*x1 - x3 + 0.819672, 24500.0*x2 - 250.0*x2*x4 - x3*x4, 1020.4082*x4*x2 - 1.2244898*x3*x4 - 100000*x2, 6.25*x1*x6 + 6.25*x1 - 7.625*x3 - 100000, 1.22*x3 - x6*x1 - x1 + 1.0) }) DEoptimR/tests/0000755000175100001440000000000013014064762013120 5ustar hornikusersDEoptimR/tests/JDEoptim-tst.R0000644000175100001440000000345212274017112015524 0ustar hornikusersrequire("DEoptimR") c.time <- function(...) cat('Time elapsed: ', ..., '\n') S.time <- function(expr) c.time(system.time(expr)) source(system.file("xtraR/opt-test-funs.R", package = "DEoptimR")) ## sf1(), swf() + RND, HEND, and alkylation list of $obj and $con testing functions (doExtras <- DEoptimR:::doExtras()) set.seed(2345) S.time(sf1. <- JDEoptim(c(-100, -100), c(100, 100), sf1, NP = 50, tol = 1e-7, maxiter = 800)) S.time(swf. <- JDEoptim(rep(-500, 10), rep(500, 10), swf, tol = 1e-7)) S.time(RND. <- JDEoptim(c(1e-5, 1e-5), c(16, 16), RND$obj, RND$con, NP = 40, tol = 1e-7)) S.time(HEND. <- JDEoptim(c( 100, 1000, 1000 , 10, 10), c(10000, 10000, 10000, 1000, 1000), fn = HEND$obj, constr = HEND$con, tol = 1e-4, trace = TRUE)) if(doExtras) S.time(alkylation. <- JDEoptim(c(1500, 1, 3000, 85, 90, 3, 145), c(2000, 120, 3500, 93, 95, 12, 162), fn = alkylation$obj, constr = alkylation$con, tol = 0.1, trace = TRUE)) bare.p.v <- function(r) unlist(unname(r[c("par", "value")])) stopifnot( all.equal( bare.p.v(sf1.), c(0, 0, 0), tolerance = 1e-4 ), all.equal( bare.p.v(swf.), c(rep(420.97, 10), -418.9829*10), tolerance = 1e-4 ), all.equal( bare.p.v(RND.), c(3.036504, 5.096052, -0.388812), tolerance = 1e-2 ), all.equal( bare.p.v(HEND.), c(579.19, 1360.13, 5109.92, 182.01, 295.60, 7049.25), tolerance = 1e-3 ), if(doExtras) all.equal( bare.p.v(alkylation.), c(1698.256922, 54.274463, 3031.357313, 90.190233, 95.0, 10.504119, 153.535355, -1766.36), tolerance = 1e-2 ) else TRUE ) c.time(proc.time()) DEoptimR/NAMESPACE0000644000175100001440000000006612552735372013207 0ustar hornikusersimportFrom( stats, runif, median ) export( JDEoptim ) DEoptimR/R/0000755000175100001440000000000013014064761012156 5ustar hornikusersDEoptimR/R/JDEoptim.R0000644000175100001440000002657112736263712013776 0ustar hornikusersJDEoptim <- function(lower, upper, fn, constr = NULL, meq = 0, eps = 1e-5, NP = 10*d, Fl = 0.1, Fu = 1, tau_F = 0.1, tau_CR = 0.1, tau_pF = 0.1, jitter_factor = 0.001, tol = 1e-15, maxiter = 200*d, fnscale = 1, compare_to = c("median", "max"), add_to_init_pop = NULL, trace = FALSE, triter = 1, details = FALSE, ...) # Copyright 2013, 2014, 2016, Eduardo L. T. Conceicao # Available under the GPL (>= 2) { handle.bounds <- function(x, u) { # Check feasibility of bounds and enforce parameters limits # by a deterministic variant of bounce-back resetting # Price, KV, Storn, RM, and Lampinen, JA (2005) # Differential Evolution: A Practical Approach to Global Optimization. # Springer, p 206 bad <- x > upper x[bad] <- 0.5*(upper[bad] + u[bad]) bad <- x < lower x[bad] <- 0.5*(lower[bad] + u[bad]) x } performReproduction <- function() { ignore <- runif(d) > CRtrial if (all(ignore)) # ensure that trial gets at least ignore[sample(d, 1)] <- FALSE # one mutant parameter # Source for trial is the base vector plus weighted differential trial <- if (runif(1) <= pFtrial) X.base + Ftrial*(X.r1 - X.r2) else X.base + 0.5*(Ftrial + 1)*(X.r1 + X.r2 - 2*X.base) # or trial parameter comes from target vector X.i itself. trial[ignore] <- X.i[ignore] trial } which.best <- if (!is.null(constr)) function(x) { ind <- TAVpop <= mu if (all(ind)) which.min(x) else if (any(ind)) which(ind)[which.min(x[ind])] else which.min(TAVpop) } else which.min # Check input parameters compare_to <- match.arg(compare_to) d <- length(lower) if (length(upper) != d) stop("'lower' must have same length as 'upper'") stopifnot(is.numeric(lower), is.numeric(upper), is.finite(lower), is.finite(upper), lower <= upper, length(fnscale) == 1, is.finite(fnscale), fnscale > 0, is.function(fn)) if (!is.null(constr)) { stopifnot(is.function(constr)) stopifnot(length(meq) == 1, meq == as.integer(meq), meq >= 0, is.numeric(eps), is.finite(eps), eps > 0) if (length(eps) == 1) eps <- rep.int(eps, meq) else if (length(eps) != meq) stop("eps must be either of length meq, or length 1") } stopifnot(length(NP) == 1, NP == as.integer(NP), length(Fl) == 1, is.numeric(Fl), length(Fu) == 1, is.numeric(Fu), Fl <= Fu) stopifnot(length(tau_F) == 1, is.numeric(tau_F), 0 <= tau_F, tau_F <= 1, length(tau_CR) == 1, is.numeric(tau_CR), 0 <= tau_CR, tau_CR <= 1, length(tau_pF) == 1, is.numeric(tau_pF), 0 <= tau_pF, tau_pF <= 1) if (!is.null(jitter_factor)) stopifnot(length(jitter_factor) == 1, is.numeric(jitter_factor)) stopifnot(length(tol) == 1, is.numeric(tol), length(maxiter) == 1, maxiter == as.integer(maxiter), length(triter) == 1, triter == as.integer(triter)) if (!is.null(add_to_init_pop)) stopifnot(NROW(add_to_init_pop) == d, is.numeric(add_to_init_pop), add_to_init_pop >= lower, add_to_init_pop <= upper) # Initialization: child <- if (is.null(constr)) { expression({ ftrial <- fn1(trial) # Evaluate trial with your function if (ftrial <= fpop[i]) { pop[, i] <- trial fpop[i] <- ftrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial } }) } else if (meq > 0) { # equality constraints are present # alongside the inequalities # Zhang, Haibo, and Rangaiah, G. P. (2012). # An efficient constraint handling method with integrated differential # evolution for numerical and engineering optimization. # Computers and Chemical Engineering 37, 74-88. expression({ htrial <- constr1(trial) TAVtrial <- sum( pmax(htrial, 0) ) if (TAVtrial > mu) { if (TAVtrial <= TAVpop[i]) { # trial and target are both pop[, i] <- trial # unfeasible, the one with smaller hpop[, i] <- htrial # constraint violation is chosen F[, i] <- Ftrial # or trial vector when both are CR[i] <- CRtrial # solutions of equal quality pF[i] <- pFtrial TAVpop[i] <- TAVtrial } } else if (TAVpop[i] > mu) { # trial is feasible and target is not pop[, i] <- trial fpop[i] <- fn1(trial) hpop[, i] <- htrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial TAVpop[i] <- TAVtrial } else { # between two feasible solutions, the ftrial <- fn1(trial) # one with better objective function if (ftrial <= fpop[i]) { # value is chosen pop[, i] <- trial # or trial vector when both are fpop[i] <- ftrial # solutions of equal quality hpop[, i] <- htrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial TAVpop[i] <- TAVtrial FF <- sum(TAVpop <= mu)/NP mu <- mu*(1 - FF/NP) } } }) } else { # only inequality constraints are present expression({ htrial <- constr1(trial) TAVtrial <- sum( pmax(htrial, 0) ) if (TAVtrial > mu) { if (TAVtrial <= TAVpop[i]) { # trial and target both unfeasible pop[, i] <- trial hpop[, i] <- htrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial TAVpop[i] <- TAVtrial } } else if (TAVpop[i] > mu) { # trial is feasible and target is not pop[, i] <- trial fpop[i] <- fn1(trial) hpop[, i] <- htrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial TAVpop[i] <- TAVtrial FF <- sum(TAVpop <= mu)/NP mu <- mu*(1 - FF/NP) } else { # two feasible solutions ftrial <- fn1(trial) if (ftrial <= fpop[i]) { pop[, i] <- trial fpop[i] <- ftrial hpop[, i] <- htrial F[, i] <- Ftrial CR[i] <- CRtrial pF[i] <- pFtrial TAVpop[i] <- TAVtrial FF <- sum(TAVpop <= mu)/NP mu <- mu*(1 - FF/NP) } } }) } fn1 <- function(par) fn(par, ...) if (!is.null(constr)) constr1 <- if (meq > 0) { eqI <- 1:meq function(par) { h <- constr(par, ...) h[eqI] <- abs(h[eqI]) - eps h } } else function(par) constr(par, ...) use.jitter <- !is.null(jitter_factor) # Zielinski, Karin, and Laur, Rainer (2008). # Stopping criteria for differential evolution in # constrained single-objective optimization. # In: U. K. Chakraborty (Ed.), Advances in Differential Evolution, # SCI 143, Springer-Verlag, pp 111-138 conv <- expression( ( do.call(compare_to, list(fpop)) - fpop[x.best.ind] )/fnscale ) pop <- matrix(runif(NP*d, lower, upper), nrow = d) if (!is.null(add_to_init_pop)) { pop <- unname(cbind(pop, add_to_init_pop)) NP <- ncol(pop) } stopifnot(NP >= 4) F <- if (use.jitter) (1 + jitter_factor*runif(d, -0.5, 0.5)) %o% runif(NP, Fl, Fu) else matrix(runif(NP, Fl, Fu), nrow = 1) CR <- runif(NP) pF <- runif(NP) fpop <- apply(pop, 2, fn1) if (!is.null(constr)) { hpop <- apply(pop, 2, constr1) if ( any(is.na(hpop)) ) stop("value of meq is invalid") if (is.vector(hpop)) dim(hpop) <- c(1, length(hpop)) TAVpop <- apply( hpop, 2, function(x) sum(pmax(x, 0)) ) mu <- median(TAVpop) } popIndex <- 1:NP x.best.ind <- which.best(fpop) converge <- eval(conv) rule <- if (!is.null(constr)) expression(converge >= tol || any(hpop[, x.best.ind] > 0)) else expression(converge >= tol) convergence <- 0 iteration <- 0 while (eval(rule)) { # generation loop if (iteration >= maxiter) { warning("maximum number of iterations reached without convergence") convergence <- 1 break } iteration <- iteration + 1 for (i in popIndex) { # Start loop through population # Equalize the mean lifetime of all vectors # Price, KV, Storn, RM, and Lampinen, JA (2005) # Differential Evolution: A Practical Approach to # Global Optimization. Springer, p 284 i <- ((iteration + i) %% NP) + 1 # Fi update # Combine jitter with dither # Storn, Rainer (2008). # Differential evolution research - trends and open questions. # In: U. K. Chakraborty (Ed.), Advances in Differential Evolution, # SCI 143, Springer-Verlag, pp 11-12 Ftrial <- if (runif(1) <= tau_F) { if (use.jitter) runif(1, Fl, Fu) * (1 + jitter_factor*runif(d, -0.5, 0.5)) else runif(1, Fl, Fu) } else F[, i] # CRi update CRtrial <- if (runif(1) <= tau_CR) runif(1) else CR[i] # pFi update pFtrial <- if (runif(1) <= tau_pF) runif(1) else pF[i] # DE/rand/1/either-or/bin X.i <- pop[, i] # Randomly pick 3 vectors all diferent from target vector r <- sample(popIndex[-i], 3) X.base <- pop[, r[1L]] X.r1 <- pop[, r[2L]] X.r2 <- pop[, r[3L]] trial <- handle.bounds(performReproduction(), X.base) eval(child) x.best.ind <- which.best(fpop) } converge <- eval(conv) if (trace && (iteration %% triter == 0)) cat(iteration, ":", "<", converge, ">", "(", fpop[x.best.ind], ")", pop[, x.best.ind], if (!is.null(constr)) paste("{", which(hpop[, x.best.ind] > 0), "}"), fill = TRUE) } res <- list(par = pop[, x.best.ind], value = fpop[x.best.ind], iter = iteration, convergence = convergence) if (details) { res$poppar <- pop res$popcost <- fpop } res } ## Not exported, and only used because CRAN checks must be faster doExtras <- function() { interactive() || nzchar(Sys.getenv("R_DEoptimR_check_extra")) || identical("true", unname(Sys.getenv("R_PKG_CHECKING_doExtras"))) } DEoptimR/MD50000644000175100001440000000062213014104362012255 0ustar hornikusers8db8b5b6588aba2e6938e6389534b9db *DESCRIPTION e957909d8b7160ad012b9ffd6d073b10 *NAMESPACE 135be8835a40cfeab6e57579ee671d89 *R/JDEoptim.R 0a39e5a9ed7e519bc70694890f929a7e *build/partial.rdb 849572cd1a881420ddf27c46d8ce59c2 *inst/NEWS.Rd b4a11b18bccefaffdfe2874c61b951a3 *inst/xtraR/opt-test-funs.R dd8a6792cb11a470d6116ad82a77bd86 *man/JDEoptim.Rd 5daa4617c3caed9a2354487ec6079026 *tests/JDEoptim-tst.R DEoptimR/build/0000755000175100001440000000000013014065130013043 5ustar hornikusersDEoptimR/build/partial.rdb0000644000175100001440000005021113014065130015167 0ustar hornikusersս |z6\ˣx`0< wjL$,[m֓,%H;RNIv(;Q8$Ω(s깾 c+~LcU}UW';STW+M-T7]o ܚ98TjkW OkK~<0={C?:Rہ{!mM_ v+s|hzo]λL6^/OV¿xmGk=?Qŏ~%l&:WRep73:4R)\vlx~}DϾ:{S eg>y@Qk=zUj`ERԺm*:w 0+.R?x ʃnmc7ݲxr}oP9߰-fe۳ˁcsX$׍$6pb ׍$ulI'1ģX;uP7x4s,ced͜Rhل.`fD{Pdg!5V'S f gEê2dRx8yPvX-1Bhc3Ud-%w@aRN!4f,=vx!7͎a 'D>#eJ׽B+u}*pݢ{O wlLk|\6e'}|3C)L冇ѣ{7$$*d舗6g"OFPoZ@%J:kO5 ~~MG v_.LSW^w6yв’L}p [ ʕAjVW(h )O%+f-eoBUJ/a*$ D>('"Q(d O0j`rlYhբ[ ^}WJE~V$ W&d if_8A`{O|zd6@3j@dMsn1(_I_Nc筢f{Ap6KWX$p9|ߙ]p4;q_p4d$65V>qNVfC[Fxim6Qgwk9^< =siS=UZ)uL_0#<1'dbշVZ9tQ4C5C߯7Ǻt(;x4s1IP"R epPtwQ`ȭޔb>jrd{N=iK;~Y>BY@) +% f.H%(QmʸocIȓDՎg;S&Ws:[1ģIc%Z.i~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<jTۻXpBQc)|C~lB8^j\|:IrLZݤ[~N$Kol Wd=H{:gEWzqP,^쵽-^ٺhwn]*4roܭeg6bxx^(F{RX;79Z= sq;_\rQfڵW|;4\[ $މO~"Ņ/1EV|oLw-yT\wg~ O,=]Zv/P6f:nız].8˱ζu[W7nyela&[_li܊)eUٔVѱx=e%_Û+!uعqdb޾mᕄjڔ1UغHլ bۻXhͦk)۳oT w,>^^䣑7]Ѫ¡GH54V VJ[.~i%ˉ_&|Zi#%q۳C$֫Y޺MSB7x6lv, 0߶/>6:=^ކ kk{}ޠ;ŪពWc%4R*رXKbC˿ޭ裸m엕7ƒJCs}N7n(m~öY~tK`շVoIٸE^lZJoG|;O$ۋb6AtE& ݶ6);? m3~U__:-W\Y(<'1ܙ-Fq2(.>ʢۚ?LN 244LGďA={LW ȎLnl W-\( Av&l˃A2typA|ᰝˎ ˅Aġb8w;JzeŸ႒I_΀>{pli|cq Л E51tZ ep;ísb \?{W\hR S͂N,XW%O[ ^}WU-eÏ0R}O5Av0 /ʟy>ޚ!'ԟGI!]'zӹG7>pL^(1!;= δ6T7˼T Ivc [&`Os J8,FKjf˩xv3[ߺ1+roC-kDEoptimR/DESCRIPTION0000644000175100001440000000241713014104362013457 0ustar hornikusersPackage: DEoptimR Version: 1.0-8 Date: 2016-11-19 Title: Differential Evolution Optimization in Pure R Authors@R: c(person("Eduardo L. T.", "Conceicao", role = c("aut", "cre"), email = "mail@eduardoconceicao.org"), person("Martin", "Maechler", role = "ctb", email = "maechler@stat.math.ethz.ch") ) Maintainer: Eduardo L. T. Conceicao Description: Differential Evolution (DE) stochastic algorithms for global optimization of problems with and without constraints. The aim is to curate a collection of its state-of-the-art variants that (1) do not sacrifice simplicity of design, (2) are essentially tuning-free, and (3) can be efficiently implemented directly in the R language. Currently, it only provides an implementation of the 'jDE' algorithm by Brest et al. (2006) . Imports: stats Enhances: robustbase License: GPL (>= 2) ByteCompile: yes Author: Eduardo L. T. Conceicao [aut, cre], Martin Maechler [ctb] Repository: CRAN Repository/R-Forge/Project: robustbase Repository/R-Forge/Revision: 746 Repository/R-Forge/DateTimeStamp: 2016-11-19 14:54:56 Date/Publication: 2016-11-19 18:16:34 NeedsCompilation: no Packaged: 2016-11-19 15:06:00 UTC; rforge DEoptimR/man/0000755000175100001440000000000013014064762012531 5ustar hornikusersDEoptimR/man/JDEoptim.Rd0000644000175100001440000004335413014063700014473 0ustar hornikusers\name{JDEoptim} \alias{JDEoptim} \title{Nonlinear Constrained and Unconstrained Optimization via Differential Evolution} \description{ An bespoke implementation of the \sQuote{jDE} variant by Brest \emph{et al.} (2006) \doi{10.1109/TEVC.2006.872133}. } \usage{ JDEoptim(lower, upper, fn, constr = NULL, meq = 0, eps = 1e-05, NP = 10*d, Fl = 0.1, Fu = 1, tau_F = 0.1, tau_CR = 0.1, tau_pF = 0.1, jitter_factor = 0.001, tol = 1e-15, maxiter = 200*d, fnscale = 1, compare_to = c("median", "max"), add_to_init_pop = NULL, trace = FALSE, triter = 1, details = FALSE, ...) } \arguments{ \item{lower, upper}{numeric vectors of \emph{lower} or \emph{upper} bounds, respectively, for the parameters to be optimized over. Must be finite (\code{\link{is.finite}}) as they bound the hyper rectangle of the initial random population.} \item{fn}{(nonlinear) objective \code{\link{function}} to be \emph{minimized}. It takes as first argument the vector of parameters over which minimization is to take place. It must return the value of the function at that point.} \item{constr}{an optional \code{\link{function}} for specifying the nonlinear constraints under which we want to minimize \code{fn}. Nonlinear equalities should be given first and defined to equal zero (\eqn{h_j(X) = 0}), followed by nonlinear inequalities defined as lesser than zero (\eqn{g_i(X) \le 0}). This function takes the vector of parameters as its first argument and returns a real vector with the length of the total number of constraints. It defaults to \code{NULL}, meaning that \emph{bound-constrained} minimization is used.} \item{meq}{an optional positive integer specifying that the first \code{meq} constraints are treated as \emph{equality} constraints, all the remaining as \emph{inequality} constraints. Defaults to \code{0} (inequality constraints only).} \item{eps}{maximal admissible constraint violation for equality constraints. An optional real vector of small positive tolerance values with length \code{meq} used in the transformation of equalities into inequalities of the form \eqn{|h_j(X)| - \epsilon \le 0}. A scalar value is expanded to apply to all equality constraints. Default is \code{1e-5}.} \item{NP}{an optional positive integer giving the number of candidate solutions in the randomly distributed initial population. Defaults to \code{10*length(lower)}.} \item{Fl}{an optional scalar which represents the minimum value that the \emph{scaling factor} \code{F} could take. Default is \code{0.1}, which is almost always satisfactory.} \item{Fu}{an optional scalar which represents the maximum value that the \emph{scaling factor} \code{F} could take. Default is \code{1}, which is almost always satisfactory.} \item{tau_F}{an optional scalar which represents the probability that the \emph{scaling factor} \code{F} is updated. Defaults to \code{0.1}, which is almost always satisfactory.} \item{tau_CR}{an optional constant value which represents the probability that the \emph{crossover probability} \code{CR} is updated. Defaults to \code{0.1}, which is almost always satisfactory.} \item{tau_pF}{an optional scalar which represents the probability that the \emph{mutation probability} \eqn{p_F}{pF} in the mutation strategy DE/rand/1/either-or is updated. Defaults to \code{0.1}.} \item{jitter_factor}{an optional tuning constant for \emph{jitter}. If \code{NULL} only \emph{dither} is used. Defaults to \code{0.001}.} \item{tol}{an optional positive scalar giving the tolerance for the stopping criterion. Default is \code{1e-15}.} \item{maxiter}{an optional positive integer specifying the maximum number of iterations that may be performed before the algorithm is halted. Defaults to \code{200*length(lower)}.} \item{fnscale}{an optional positive scalar specifying the typical magnitude of \code{fn}. It is used only in the \emph{stopping criterion}. Defaults to \code{1}. See \sQuote{Details}.} \item{compare_to}{an optional character string controlling which function should be applied to the \code{fn} values of the candidate solutions in a generation to be compared with the so-far best one when evaluating the \emph{stopping criterion}. If \dQuote{\code{median}} the \code{median} function is used; else, if \dQuote{\code{max}} the \code{max} function is used. It defaults to \dQuote{\code{median}}. See \sQuote{Details}.} \item{add_to_init_pop}{an optional real vector of length \code{length(lower)} or matrix with \code{length(lower)} rows specifying initial values of the parameters to be optimized which are appended to the randomly generated initial population. It defaults to \code{NULL}.} \item{trace}{an optional logical value indicating if a trace of the iteration progress should be printed. Default is \code{FALSE}.} \item{triter}{an optional positive integer that controls the frequency of tracing when \code{trace = TRUE}. Default is \code{triter = 1}, which means that \code{iteration : < value of stopping test > ( value of best solution ) best solution { index of violated constraints }} is printed at every iteration.} \item{details}{an optional logical value. If \code{TRUE} the output will contain the parameters in the final population and their respective \code{fn} values. Defaults to \code{FALSE}.} \item{...}{optional additional arguments passed to \code{fn()} \emph{and} \code{constr()} if that is not \code{NULL}.} } \details{ \describe{ \item{Overview:}{ The setting of the \emph{control parameters} of standard Differential Evolution (DE) is crucial for the algorithm's performance. Unfortunately, when the generally recommended values for these parameters (see, \emph{e.g.}, Storn and Price, 1997) are unsuitable for use, their determination is often difficult and time consuming. The jDE algorithm proposed in Brest \emph{et al.} (2006) employs a simple self-adaptive scheme to perform the automatic setting of control parameters scale factor \code{F} and crossover rate \code{CR}. This implementation differs from the original description, most notably in the use of the \emph{DE/rand/1/either-or} mutation strategy (Price \emph{et al.}, 2005), combination of \emph{jitter with dither} (Storn 2008), and for \emph{immediately replacing} each worse parent in the current population by its newly generated better or equal offspring (Babu and Angira 2006) instead of updating the current population with all the new solutions at the same time as in classical DE. } \item{Constraint Handling:}{ Constraint handling is done using the approach described in Zhang and Rangaiah (2012), but with a \emph{different reduction updating scheme} for the constraint relaxation value (\eqn{\mu}). Instead of doing it once for every generation or iteration, the reduction is triggered for two cases when the \emph{constraints only contain inequalities}. Firstly, every time a feasible solution is selected for replacement in the next generation by a new feasible trial candidate solution with a better objective function value. Secondly, whenever a current infeasible solution gets replaced by a feasible one. If the constraints \emph{include equalities}, then the reduction is not triggered in this last case. This constitutes an original feature of the implementation. The performance of the constraint handling technique is severely impaired by a small feasible region. Therefore, equality constraints are particularly difficult to handle due to the tiny feasible region they define. So, instead of explicitly including all equality constraints in the formulation of the optimization problem, it might prove advantageous to eliminate some of them. This is done by expressing one variable \eqn{x_k} in terms of the remaining others for an equality constraint \eqn{h_j(X) = 0} where \eqn{X = [x_1,\ldots,x_k,\ldots,x_d]} is the vector of solutions, thereby obtaining a relationship as \eqn{x_k = R_{k,j}([x_1,\ldots,x_{k-1},x_{k+1},\ldots,x_d])}. But this means that both the variable \eqn{x_k} and the equality constraint \eqn{h_j(X) = 0} can be removed altogether from the original optimization formulation, since the value of \eqn{x_k} can be calculated during the search process by the relationship \eqn{R_{k,j}}. Notice, however, that two additional inequalities \deqn{l_k \le R_{k,j}([x_1,\ldots,x_{k-1},x_{k+1},\ldots,x_d]) \le u_k,} where the values \eqn{l_k} and \eqn{u_k} are the lower and upper bounds of \eqn{x_k}, respectively, must be provided in order to obtain an equivalent formulation of the problem. For guidance and examples on applying this approach see Wu \emph{et al.} (2015). } \item{Discrete and Integer Variables:}{ Any DE variant is easily extended to deal with \emph{mixed integer nonlinear programming} problems using a small variation of the technique presented by Lampinen and Zelinka (1999). Integer values are obtained by means of the \code{floor()} function \emph{only} for the evaluation of the objective function. This is because DE itself works with continuous variables. Additionally, each upper bound of the integer variables should be added by \code{1}. Notice that the final solution needs to be \emph{converted with \code{floor()}} to obtain its \emph{integer} elements. } \item{Stopping Criterion:}{ The algorithm is stopped if \deqn{\frac{\mathrm{compare\_to}\{[\mathrm{fn}(X_1),\ldots,\mathrm{fn}(X_\mathrm{npop})]\} - \mathrm{fn}(X_\mathrm{best})}{\mathrm{fnscale}} \le \mathrm{tol}}{% ( compare_to{ [fn(X_1),\ldots,fn(X_npop)] } - fn(X_best) )/fnscale <= tol,} where the \dQuote{best} individual \eqn{X_\mathrm{best}}{X_best} is the \emph{feasible} solution with the lowest objective function value in the population and the total number of elements in the population, \code{npop}, is \code{NP+NCOL(add_to_init_pop)}. This is a variant of the \emph{Diff} criterion studied by Zielinski and Laur (2008), which was found to yield the best results. } } } \value{ A list with the following components: \item{par}{The best set of parameters found.} \item{value}{The value of \code{fn} corresponding to \code{par}.} \item{iter}{Number of iterations taken by the algorithm.} \item{convergence}{An integer code. \code{0} indicates successful completion. \code{1} indicates that the iteration limit \code{maxiter} has been reached.} and if \code{details = TRUE}: \item{poppar}{Matrix of dimension \code{(length(lower), npop)}, with columns corresponding to the parameter vectors remaining in the population.} \item{popcost}{The values of \code{fn} associated with \code{poppar}, vector of length \code{npop}.} } \note{ It is possible to perform a warm start, \emph{i.e.}, starting from the previous run and resume optimization, using \code{NP = 0} and the component \code{poppar} for the \code{add_to_init_pop} argument. } \author{ Eduardo L. T. Conceicao \email{mail@eduardoconceicao.org} } \references{ Babu, B. V. and Angira, R. (2006) Modified differential evolution (MDE) for optimization of non-linear chemical processes. \emph{Computers and Chemical Engineering} \bold{30}, 989--1002. Brest, J., Greiner, S., Boskovic, B., Mernik, M. and Zumer, V. (2006) Self-adapting control parameters in differential evolution: a comparative study on numerical benchmark problems. \emph{IEEE Transactions on Evolutionary Computation} \bold{10}, 646--657. Lampinen, J. and Zelinka, I. (1999). Mechanical engineering design optimization by differential evolution; in Corne, D., Dorigo, M. and Glover, F., Eds., \emph{New Ideas in Optimization}. McGraw-Hill, pp. 127--146. Price, K. V., Storn, R. M. and Lampinen, J. A. (2005) \emph{Differential Evolution: A practical approach to global optimization}. Springer, Berlin, pp. 117--118. Storn, R. (2008) Differential evolution research --- trends and open questions; in Chakraborty, U. K., Ed., \emph{Advances in differential evolution}. SCI 143, Springer-Verlag, Berlin, pp. 11--12. Storn, R. and Price, K. (1997) Differential evolution - a simple and efficient heuristic for global optimization over continuous spaces. \emph{Journal of Global Optimization} \bold{11}, 341--359. Wu, G., Pedrycz, W., Suganthan, P. N. and Mallipeddi, R. (2015) A variable reduction strategy for evolutionary algorithms handling equality constraints. \emph{Applied Soft Computing} \bold{37}, 774--786. Zhang, H. and Rangaiah, G. P. (2012) An efficient constraint handling method with integrated differential evolution for numerical and engineering optimization. \emph{Computers and Chemical Engineering} \bold{37}, 74--88. Zielinski, K. and Laur, R. (2008) Stopping criteria for differential evolution in constrained single-objective optimization; in Chakraborty, U. K., Ed., \emph{Advances in differential evolution}. SCI 143, Springer-Verlag, Berlin, pp. 111--138. } \seealso{ Function \code{\link[DEoptim]{DEoptim}()} in the \pkg{DEoptim} package has many more options than \code{JDEoptim()}, but does not allow constraints in the same flexible manner. } \examples{ \donttest{ # NOTE: Examples were excluded from testing # to reduce package check time. # Use a preset seed so test values are reproducible. set.seed(1234) # Bound-constrained optimization # Griewank function # # -600 <= xi <= 600, i = {1, 2, ..., n} # The function has a global minimum located at # x* = (0, 0, ..., 0) with f(x*) = 0. Number of local minima # for arbitrary n is unknown, but in the two dimensional case # there are some 500 local minima. # # Source: # Ali, M. Montaz, Khompatraporn, Charoenchai, and # Zabinsky, Zelda B. (2005). # A numerical evaluation of several stochastic algorithms # on selected continuous global optimization test problems. # Journal of Global Optimization 31, 635-672. griewank <- function(x) { 1 + crossprod(x)/4000 - prod( cos(x/sqrt(seq_along(x))) ) } JDEoptim(rep(-600, 10), rep(600, 10), griewank, tol = 1e-7, trace = TRUE, triter = 50) # Nonlinear constrained optimization # 0 <= x1 <= 34, 0 <= x2 <= 17, 100 <= x3 <= 300 # The global optimum is # (x1, x2, x3; f) = (0, 16.666667, 100; 189.311627). # # Source: # Westerberg, Arthur W., and Shah, Jigar V. (1978). # Assuring a global optimum by the use of an upper bound # on the lower (dual) bound. # Computers and Chemical Engineering 2, 83-92. fcn <- list(obj = function(x) { 35*x[1]^0.6 + 35*x[2]^0.6 }, eq = 2, con = function(x) { x1 <- x[1]; x3 <- x[3] c(600*x1 - 50*x3 - x1*x3 + 5000, 600*x[2] + 50*x3 - 15000) }) JDEoptim(c(0, 0, 100), c(34, 17, 300), fn = fcn$obj, constr = fcn$con, meq = fcn$eq, tol = 1e-7, trace = TRUE, triter = 50) # Designing a pressure vessel # Case A: all variables are treated as continuous # # 1.1 <= x1 <= 12.5*, 0.6 <= x2 <= 12.5*, # 0.0 <= x3 <= 240.0*, 0.0 <= x4 <= 240.0 # Roughly guessed* # The global optimum is (x1, x2, x3, x4; f) = # (1.100000, 0.600000, 56.99482, 51.00125; 7019.031). # # Source: # Lampinen, Jouni, and Zelinka, Ivan (1999). # Mechanical engineering design optimization # by differential evolution. # In: David Corne, Marco Dorigo and Fred Glover (Editors), # New Ideas in Optimization, McGraw-Hill, pp 127-146 pressure_vessel_A <- list(obj = function(x) { x1 <- x[1]; x2 <- x[2]; x3 <- x[3]; x4 <- x[4] 0.6224*x1*x3*x4 + 1.7781*x2*x3^2 + 3.1611*x1^2*x4 + 19.84*x1^2*x3 }, con = function(x) { x1 <- x[1]; x2 <- x[2]; x3 <- x[3]; x4 <- x[4] c(0.0193*x3 - x1, 0.00954*x3 - x2, 750.0*1728.0 - pi*x3^2*x4 - 4/3*pi*x3^3) }) JDEoptim(c( 1.1, 0.6, 0.0, 0.0), c(12.5, 12.5, 240.0, 240.0), fn = pressure_vessel_A$obj, constr = pressure_vessel_A$con, tol = 1e-7, trace = TRUE, triter = 50) # Mixed integer nonlinear programming # Designing a pressure vessel # Case B: solved according to the original problem statements # steel plate available in thicknesses multiple # of 0.0625 inch # # wall thickness of the # shell 1.1 [18*0.0625] <= x1 <= 12.5 [200*0.0625] # heads 0.6 [10*0.0625] <= x2 <= 12.5 [200*0.0625] # 0.0 <= x3 <= 240.0, 0.0 <= x4 <= 240.0 # The global optimum is (x1, x2, x3, x4; f) = # (1.125 [18*0.0625], 0.625 [10*0.0625], # 58.29016, 43.69266; 7197.729). pressure_vessel_B <- list(obj = function(x) { x1 <- floor(x[1])*0.0625 x2 <- floor(x[2])*0.0625 x3 <- x[3]; x4 <- x[4] 0.6224*x1*x3*x4 + 1.7781*x2*x3^2 + 3.1611*x1^2*x4 + 19.84*x1^2*x3 }, con = function(x) { x1 <- floor(x[1])*0.0625 x2 <- floor(x[2])*0.0625 x3 <- x[3]; x4 <- x[4] c(0.0193*x3 - x1, 0.00954*x3 - x2, 750.0*1728.0 - pi*x3^2*x4 - 4/3*pi*x3^3) }) res <- JDEoptim(c( 18, 10, 0.0, 0.0), c(200+1, 200+1, 240.0, 240.0), fn = pressure_vessel_B$obj, constr = pressure_vessel_B$con, tol = 1e-7, trace = TRUE, triter = 50) res # Now convert to integer x1 and x2 c(floor(res$par[1:2]), res$par[3:4]) } }