Description Usage Arguments Details Value Examples
A main funtion to compute the optimal solution using a selected algorithm.
1 2 |
FUN |
an objective function or cost function, |
optimType |
a string value that represents the type of optimization.
There are two options for this arguments: |
algorithm |
a vector or single string value that represent the algorithm used to do optimization. There are currently twenty one implemented algorithm:
|
numVar |
a positive integer to determine the number variables. |
rangeVar |
a matrix (2 \times n) containing the range of variables,
where n is the number of variables, and first and second rows
are the lower bound (minimum) and upper bound (maximum) values, respectively.
If all variable have equal upper bound, you can define |
control |
a list containing all arguments, depending on the algorithm to use. The following list are parameters required for each algorithm.
|
seed |
a number to determine the seed for RNG. |
This function makes accessible all algorithm that are implemented in this package. All of the algorithm use this function as interface to find the optimal solution, so users do not need to call other functions. In order to obtain good results, users need to adjust some parameters such as the objective function, optimum type, number variable or dimension, number populations, the maximal number of iterations, lower bound, upper bound, or other algorithm-dependent parameters which are collected in the control parameter.
List
that contain list of variable, optimum value and execution time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ##################################
## Optimizing the sphere function
## Define sphere function as an objective function
sphere <- function(X){
return(sum(X^2))
}
## Define control variable
control <- list(numPopulation=40, maxIter=100, Vmax=2, ci=1.49445, cg=1.49445, w=0.729)
numVar <- 5
rangeVar <- matrix(c(-10,10), nrow=2)
## Define control variable
best.variable <- metaOpt(sphere, optimType="MIN", algorithm="PSO", numVar,
rangeVar, control)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.