BASoptim: Implementation of the BAS algorithm for optimization...

Description Usage Arguments Value References Examples

Description

You could find more information about BAS in https://arxiv.org/abs/1710.10724.

Usage

1
2
3
4
BASoptim(fn, init = NULL, lower = c(-6, 0), upper = c(-1, 2),
  constr = NULL, d0 = 0.001, d1 = 3, eta_d = 0.95, l0 = 0,
  l1 = 0, eta_l = 0.95, step = 0.8, eta_step = 0.95, n = 200,
  seed = NULL, trace = T, steptol = 0.01, pen = 1e+05)

Arguments

fn

objective function; function need to be optimized

init

default = NULL, it will generate randomly; Of course, you can specify it.

lower

lower of parameters to be estimated; Default = c(-6,0) because of the test on Michalewicz function of which thelower is c(-6,0); By the way, you should set one of init or lower parameter at least to make the code know the dimensionality of your problem.

upper

upper of parameters; Default = c(-1,2).

constr

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

d0

a constant to gurantee that sensing length of antennae d doesn't equal to zero. More specifically,

d^t = η_d * d^{t-1} + d_0

where attenuation coefficient η_d belongs to [0,1]

d1

initial value of antenae length. You can specify it according to your problem scale

eta_d

attenuation coefficient of sensing length of antennae

l0

position jitter factor constant.Default = 0.

l1

initial position jitter factor.Default = 0.

x = x - step * dir * sign(fn(left) - fn(right)) + l *random(npars)

eta_l

attenuation coefficient of jitter factor.

l^t = η_l * l^{t-1} + l_0

step

initial step-size of beetle

eta_step

attenuation coefficient of step-size.

step^t = η_{step} * step^{t-1}

n

iterations times

seed

random seed; default = NULL ; The results of BAS depend on random init value and random directions. Therefore, if you set a random seed, for example,seed = 1, the results will remain the same no matter how many times you repeat your experiments.

trace

default = T; trace the process of BAS iteration.

steptol

default = 0.01; Iteration will stop if step-size in current moment is less than steptol.

pen

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

Value

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

References

X. Y. Jiang, and S. Li, BAS: beetle antennae search algorithm for optimization problems, arXiv:1710.10724v1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#======== examples start =======================
# BAS application on Michalewicz function
library(rBAS)
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)
}
BASoptim(fn = mich,
         lower = c(-6,0), upper = c(-1,2),
         seed = 1, n = 100,trace = FALSE)
#======== examples end =======================

jywang2016/rBAS documentation built on May 21, 2019, 1:43 a.m.