Description Usage Arguments Value References Examples
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.
1 2 3 4 |
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 |
A list including best beetle position (parameters) and corresponding objective function value.
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #======== 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
result$value
# >>>> 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)
result$par
result$value
# >>>> 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)
result$par # 78.00000 33.00000 27.07176 45.00000 44.96713
result$value # -31025.47
#======== examples end =======================
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.