BSAS-WPT is integration of BSAS and BAS-WPT. The main difference bettwen BSAS-WPT and BSAS is the parameters c2 used for searching distance update. The users just need specify c2 instead of adjusting much parameters about searching distance.

BSAS_WPT(fn, init = NULL, lower = c(-6, 0), upper = c(-1, 2),
  k = 5, constr = NULL, c2 = 5, step = 1, eta_step = 0.95,
  n = 200, seed = NULL, trace = T, steptol = 0.001, p_min = 0.2,
  p_step = 0.2, n_flag = 2, pen = 1e+05)

Arguments

constr

constraint function. For example, you can formulate \(x<=10\) as \(constr = function(x) return(x - 10)\).

c2

ratio of step-size and searching distance.$$d = \frac{step}{c2}$$

pen

penalty conefficient usually predefined as a large enough value, default 1e5

see BSASoptim.

Value

A list including best beetle position (parameters) and corresponding objective function value.

References

X. Y. Jiang, and S. Li, "Beetle Antennae Search without Parameter Tuning (BAS-WPT) for Multi-objective Optimization," arXiv:1711.02395v1.https://arxiv.org/abs/1711.02395

J. Y. Wang, and H. X. Chen, "BSAS: Beetle Swarm Antennae Search Algorithm for Optimization Problems," arXiv:1807.10470v1.https://arxiv.org/abs/1807.10470

Examples

#======== examples start ======================= # >>>> example with constraint: Mixed integer nonlinear programming <<<< pressure_Vessel <- list( obj = function(x){ x1 <- floor(x[1])*0.0625 x2 <- floor(x[2])*0.0625 x3 <- x[3] x4 <- x[4] result <- 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 0.00954*x3 - x2, 750.0*1728.0 - pi*x3^2*x4 - 4/3*pi*x3^3 ) } ) result <- BSAS_WPT(fn = pressure_Vessel$obj, k = 8, lower =c( 1, 1, 10, 10), upper = c(100, 100, 200, 200), constr = pressure_Vessel$con, c2 = 10, n = 200, step = 2, seed = 1, n_flag = 3, trace = FALSE, steptol = 1e-6) result$par
#> [1] 13.882270 7.434164 42.094999 176.932890
result$value
#> [1] 6065.478
# >>>> example without constraint: Michalewicz function <<<< mich <- function(x){ y1 <- -sin(x[1])*(sin((x[1]^2)/pi))^20 y2 <- -sin(x[2])*(sin((2*x[2]^2)/pi))^20 return(y1+y2) } result <- BSAS_WPT(fn = mich, lower = c(-6,0), upper = c(-1,2), seed = 11, n = 200, k=5, step = 1, c2 = 5, trace = FALSE)
#> ----step < steptol---------stop the iteration------
result$par
#> [1] -4.966329 1.571745
result$value
#> [1] -1.967804
# >>>> example with constraint: Himmelblau function <<<< himmelblau <- list( obj = function(x){ x1 <- x[1] x3 <- x[3] x5 <- x[5] result <- 5.3578547*x3^2 + 0.8356891*x1*x5 + 37.29329*x[1] - 40792.141 }, con = function(x){ x1 <- x[1] x2 <- x[2] x3 <- x[3] x4 <- x[4] x5 <- x[5] g1 <- 85.334407 + 0.0056858*x2*x5 + 0.00026*x1*x4 - 0.0022053*x3*x5 g2 <- 80.51249 + 0.0071317*x2*x5 + 0.0029955*x1*x2 + 0.0021813*x3^2 g3 <- 9.300961 + 0.0047026*x3*x5 + 0.0012547*x1*x3 + 0.0019085*x3*x4 c( -g1, g1-92, 90-g2, g2 - 110, 20 - g3, g3 - 25 ) } ) result <- BSAS_WPT(fn = himmelblau$obj, k = 10, lower =c(78,33,27,27,27), upper = c(102,45,45,45,45), constr = himmelblau$con, c2 = 5, n = 200, step = 1.6, pen = 1e5,trace = FALSE,seed = 11)
#> ----step < steptol---------stop the iteration------
result$par # 78.00000 33.00000 27.07176 45.00000 44.96713
#> [1] 78.00000 33.00000 27.07176 45.00000 44.96713
result$value # -31025.47
#> [1] -31025.47
#======== examples end =======================