Skip to content

Imperialist Competitive Algorithm (ICA)

A population method for continuous problems.

ICA

ICA(*, empire_count=10, selection_pressure=1.0, assimilation_coeff=2.0, revolution_prob=0.05, revolution_rate=0.1, revolution_step_size=0.1, revolution_step_size_damp=0.99, zeta=0.1, competition='paper', **kwargs)

Imperialist Competitive Algorithm (Atashpaz-Gargari and Lucas, 2007).

The population is split into countries. The best empire_count countries are imperialists, and the others are colonies shared among them. In every iteration the colonies move toward their imperialist (assimilation), some countries change at random (revolution), a colony that becomes better than its imperialist takes its place, and the empires compete: the weakest colony of the weakest empire goes to another empire. When the weakest empire has no colonies left, it collapses, and its imperialist becomes a colony of another empire. Only the weakest empire is checked, so an empty empire lasts until it is the weakest. With one empire left, the run continues with assimilation and revolution.

Parameters

  • pop_size: number of countries (imperialists and colonies)
  • empire_count: number of empires (imperialists) at the start, at least 2 and less than pop_size (default 10). The other pop_size - empire_count countries are colonies.
  • selection_pressure: pressure of the power-based probabilities (see below)
  • assimilation_coeff: beta. Each colony component moves by beta * U(0, 1) times its distance to the imperialist (default 2).
  • revolution_prob: probability that a colony makes a revolution (a random Gaussian move) in an iteration
  • revolution_rate: fraction of the code components changed by a revolution
  • revolution_step_size: initial standard deviation of the revolution (code units)
  • revolution_step_size_damp: the step size is multiplied by this after every iteration
  • zeta: weight of the mean colony cost in the total cost of an empire (default 0.1, the paper's xi)
  • competition: "paper" (default) uses the rule of the paper: with normalized total costs NTC_k = TC_k - max(TC), the possession probability is P_k = |NTC_k| / sum |NTC|, and the empire with the largest P_k - U(0, 1) wins. "roulette" draws the empire that wins the weakest colony with the probabilities below.

The defaults are the paper's values.

Rank-based costs

Every cost is the normalized rank of a country in the whole population, c = rank / (pop_size - 1), from 0 (best) to 1 (worst), so the method works for maximization, any objective scale, and constraints. The total cost of empire k is TC_k = c(imperialist) + zeta * mean(c(colonies)), or c(imperialist) without colonies. Probabilities are p_k proportional to exp(-selection_pressure * x_k / max(x)), where x is the imperialist costs (initial split) or the total costs (competition). In the competition the weakest empire gets p = 0.

Unlike the paper, the power is exponential in rank-based costs, and assimilation draws an independent U(0, beta) factor per component instead of using a random angle. The paper does not describe revolution: here each imperialist tries one Gaussian move per iteration and keeps it only if it is better, while a revolved colony always keeps it.

Reference: E. Atashpaz-Gargari and C. Lucas, "Imperialist competitive algorithm: an algorithm for optimization inspired by imperialistic competition," IEEE Congress on Evolutionary Computation, 2007, pp. 4661 to 4667.

Example

import ypea

problem = ypea.Problem(
    ypea.Real("x", shape=20, lb=-10, ub=10),
    lambda sol: ypea.benchmarks.sphere(sol.x),
    vectorized=True,
    name="sphere",
)

alg = ypea.ICA(max_nfe=20_000)
result = alg.solve(problem, seed=1)
print(result.summary())
ICA on sphere
  best objective value: 4.39167e-08
  feasible: True (violation 0)
  evaluations: 20000, iterations: 199, time: 0.0376 s, stopped by: max_nfe

Differs from Python: MATLAB draws its own random numbers, so the best value differs from Python's.

problem = ypea.Problem( ...
    vars=ypea.Real("x", shape=20, lb=-10, ub=10), ...
    objective=@(sol) ypea.benchmarks.sphere(sol.x), ...
    vectorized=true, ...
    name="sphere");

alg = ypea.ICA(max_nfe=20000);
result = alg.solve(problem, seed=1);
disp(result.summary())
ICA on sphere
  best objective value: 9.60939e-09
  feasible: true (violation 0)
  evaluations: 20000, iterations: 199, time: 0.194 s, stopped by: max_nfe

Search on Rastrigin

ICA solutions on Rastrigin at four iterations, and its convergence
ICA with default settings, 50 iterations on Rastrigin in two dimensions (seed 1). The red points are the countries. Stars mark the imperialists, and the dots their colonies. The open diamond is the best solution so far, and the plus sign the global minimum.