MFO {metaheuristicOpt} | R Documentation |
Optimization using Moth Flame Optimizer
Description
This is the internal function that implements Moth Flame Optimization
Algorithm. It is used to solve continuous optimization tasks.
Users do not need to call it directly,
but just use metaOpt
.
Usage
MFO(FUN, optimType = "MIN", numVar, numPopulation = 40,
maxIter = 500, rangeVar)
Arguments
FUN |
an objective function or cost function, |
optimType |
a string value that represent the type of optimization.
There are two option for this arguments: |
numVar |
a positive integer to determine the number variables. |
numPopulation |
a positive integer to determine the number populations. The default value is 40. |
maxIter |
a positive integer to determine the maximum number of iterations. The default value is 500. |
rangeVar |
a matrix ( |
Details
This algorithm was proposed (Mirjalili, 2015). The main inspiration of this optimizer is the navigation method of moths in nature called transverse orientation. Moths fly in night by maintaining a fixed angle with respect to the moon, a very effective mechanism for travelling in a straight line for long distances. However, these fancy insects are trapped in a useless/deadly spiral path around artificial lights.
In order to find the optimal solution, the algorithm follow the following steps.
Initialization: Initialize the first population of moth randomly, calculate the fitness of moth and find the best moth as the best flame obtained so far The flame indicate the best position obtained by motion of moth. So in this step, position of flame will same with the position of moth.
Update Moth Position: All moth move around the corresponding flame. In every iteration, the number flame is decreasing over the iteration. So at the end of iteration all moth will move around the best solution obtained so far.
Replace a flame with the position of moth if a moth becomes fitter than flame
Check termination criteria, if termination criterion is satisfied, return the best flame as the optimal solution for given problem. Otherwise, back to Update Moth Position steps.
Value
Vector [v1, v2, ..., vn]
where n
is number variable
and vn
is value of n-th
variable.
References
Seyedali Mirjalili, Moth-flame optimization algorithm: A novel nature-inspired heuristic paradigm, Knowledge-Based Systems, Volume 89, 2015, Pages 228-249, ISSN 0950-7051, https://doi.org/10.1016/j.knosys.2015.07.006
See Also
Examples
##################################
## Optimizing the schewefel's problem 2.22 function
# define schewefel's problem 2.22 function as objective function
schewefels2.22 <- function(x){
return(sum(abs(x)+prod(abs(x))))
}
## Define parameter
numVar <- 5
rangeVar <- matrix(c(-10,10), nrow=2)
## calculate the optimum solution using Moth Flame Optimizer
resultMFO <- MFO(schewefels2.22, optimType="MIN", numVar, numPopulation=20,
maxIter=100, rangeVar)
## calculate the optimum value using schewefel's problem 2.22 function
optimum.value <- schewefels2.22(resultMFO)