genoud
(fn, nvars, max=FALSE, pop.size=100, max.generations=100, wait.generations=10,
hard.generation.limit=TRUE, starting.values=NULL, MemoryMatrix=NULL, Debug=FALSE,
Domains=NULL, default.domains=10,
gradient.check=TRUE, boundary.enforcement=2,
solution.tolerance=0.001, BFGS=TRUE, data.type.int=FALSE, hessian=FALSE,
unif.seed=812821, int.seed=53058,
print.level=2, share.type=0, instance.number=0,
output.path="stdout", output.append=FALSE, project.path="genoud.pro",
P1=50, P2=50, P3=50, P4=50, P5=50, P6=50, P7=50, P8=50, P9=0)
sin()<
hard.generation
gradient.check
trigger has been
turned on, GENOUD will only start countinmax.generations
variable is a binding constraint for GENOUD. But it fails to be
binding if the hard.generation.limit is set to FALSE.
Please see MemoryMatrix
for some
interesting interactions with memnvars
$\times 2$
matrix. The fist column is the lower bound, and the second column is
the upper bound. None of GENOUD's starting population will be outside
of the bounds. But some of the operators may generate childreDomains
, GENOUD will create a
Domains matrix by setting the lower bound for all of the parameters
equal to -1 $\times$ default.domains
and the upper
bound equal to default.domains
.wait.generations
unless the gradients are zero or
solution.tolerance
close to
zero. This variable has not effect if the
max.generations
limit iboundary constraints
. Notwithstanding
the value of the variable, none of GENOUD's starting population will
be outside of the bounds. But some of the operators may genhessian
variable. They are:pop.size
for why this value may differ from the
population size the user requested.hessian
flag, the hessian
at the solution will be returned. The user may use this matrix to calculate standard
errors.print.level
BFGS
flag is false. It also implies
that Operator 9 (Local-Minimum Crossover) is set to zero and that
gradient checking (as a convergence criterion) is turned off. No
matter what the values of these other variables is, the value of
data.type.int takes precedence---i.e., if GENOUD is told that its is
searching over an integer parameter space all everything that
requires gradient information is turned off.
There is no option to mix the two types of data. If one wants to
mix the two, it is suggested that the user pick integer type and in
her objective function map a particular integer range into a
floating point number range. For example, tell GENOUD to search
from 0 to 100 and divide by 100 to obtain a search grid of 0 to 1.0
(by .1).nvars
)
reported in the Project File is different from the current GENOUD run,
GENOUD does not use the Project File (regardless of the value of
share.type) and generates the necessary starting population at
random.pop.size
variable and the operators sets must be such that
these three operators have an even number of individuals to
work with. If this does not occur, GENOUD (upwardly) adjusts the
population size to make this constraint hold.
Strong uniqueness checks have been built into the operators to help
ensure that the operators produce offspring different from their
parents, but this does not always happen!
Note that GENOUD always keeps the best individual each generation.
GENOUD's 9 operators are:
optim
.#maximize the sin function
sin1 <- genoud(sin, nvars=1, max=TRUE);
#minimize the sin function
sin2 <- genoud(sin, nvars=1, max=FALSE);
#maximimize a univariate normal mixture which looks like a claw
claw <- function(xx) {
Nd <- function(x, mu, sigma) {
w <- (1.0/sqrt(2.0*pi*sigma*sigma)) ;
z <- (x-mu)/sigma;
w <- w*exp(-0.5*z*z) ;
as.double(w);
}
x <- xx[1];
y <- (0.46*(Nd(x,-1.0,2.0/3.0) + Nd(x,1.0,2.0/3.0)) +
(1.0/300.0)*(Nd(x,-0.5,.01) + Nd(x,-1.0,.01) + Nd(x,-1.5,.01)) +
(7.0/300.0)*(Nd(x,0.5,.07) + Nd(x,1.0,.07) + Nd(x,1.5,.07))) ;
as.double(y);
}
claw1 <- genoud(claw, nvars=1,P9=100,max=TRUE);
#maximimize a bivariate normal mixture which looks like a claw
biclaw <- function(xx) {
mNd2 <- function(x1, x2, mu1, mu2, sigma1, sigma2, rho)
{
z1 <- (x1-mu1)/sigma1;
z2 <- (x2-mu2)/sigma2;
w <- (1.0/(2.0*pi*sigma1*sigma2*sqrt(1-rho*rho))) ;
w <- w*exp(-0.5*(z1*z1 - 2*rho*z1*z2 + z2*z2)/(1-rho*rho)) ;
as.double(w);
}
x1 <- xx[1]+1;
x2 <- xx[2]+1;
y <- (0.5*mNd2(x1,x2,0.0,0.0,1.0,1.0,0.0) +
0.1*(mNd2(x1,x2,-1.0,-1.0,0.1,0.1,0.0) +
mNd2(x1,x2,-0.5,-0.5,0.1,0.1,0.0) +
mNd2(x1,x2,0.0,0.0,0.1,0.1,0.0) +
mNd2(x1,x2,0.5,0.5,0.1,0.1,0.0) +
mNd2(x1,x2,1.0,1.0,0.1,0.1,0.0)));
as.double(y);
}
biclaw1 <- genoud(biclaw, nvars=2,P9=100,max=TRUE);
Run the code above in your browser using DataLab