Learn R Programming

ICAFF (version 1.0.1)

ICA: Finding a minimum value for the optimization variables of a cost function.

Description

ICA is a function for optimization by Imperialist Competitive Algorithm.

Usage

ICA(cost, nvar, ncountries = 80, nimp = 10, maxiter = 100, lb = rep(-10, nvar), ub = rep(10, nvar), beta = 2, P_revolve = 0.3, zeta = 0.02, ...)

Arguments

cost
A cost function to be minimized. The function accept the parameter values as a numerical vector as its principal argument. Additional arguments may be specified through the ... argument below.
nvar
Number of optimization variables of cost function
ncountries
Number of initial countries
nimp
Number of Initial Imperialists
maxiter
Maximum number of iterations allowed.
lb
Lower limit of the optimization region; a numeric vector of length nvar. Will be recycled if necessary.
ub
Upper limit of the optimization region; a numeric vector of length nvar. Will be recycled if necessary.
beta
Assimilation coefficient.
P_revolve
Revolution is the process in which the socio-political characteristics of a country change suddenly.
zeta
Total Cost of Empire = Cost of Imperialist + Zeta * mean(Cost of All Colonies)
...
Additional arguments, if needed, for the function cost.

Value

An object of class "ICA", a list with components:
call
The call used.
postion
The vector of components for the position of the minimum value found.
value
The minimum value at the optimal position.
nimp
The remaining number of imperialists at the conclusion of the procedure.
trace
A 1-column matrix of successive minimum values found at each iteration of the major loop.
time
The execution time taken to find the best solution.

Details

To use this code, you should only need to prepare your cost function.

References

Atashpaz-Gargari, E. and Lucas, C. (2007). Imperialist Competitive Algorithm: An algorithm for optimization inspired by imperialistic competition. IEEE Congress on Evolutionary Computation, Vol. 7, pp. 4661-4666.

Examples

Run this code

## --------cost function: f(x,y) = x * sin(4 * x) + 1.1 * y * sin(2 * y)
## --------search region: -10 <= x, y <= 10

cost <- function(x) {
  x[1] * sin(4 * x[1]) + 1.1 * x[2] * sin(2 * x[2])
}

ICAout <- ICA(cost, nvar = 2, ncountries = 80, nimp = 10,
              maxiter = 100, lb = -10, ub = 10, 
              beta = 2, P_revolve = 0.3, zeta = 0.02)

summary(ICAout)     ## same as the print method
coef(ICAout)        ## get the position of the minimum
cost(coef(ICAout))  ## cost at the minimum
plot(ICAout)        ## show the history of the process

Run the code above in your browser using DataLab