Invasive Weed Optimization (IWO)¶
A population method for continuous problems that moves from global to local search over the run.
IWO ¶
IWO(*, pop_size=20, initial_pop_size=10, min_seed_count=0, max_seed_count=5, step_size=0.1, final_step_size=0.001, modulation_index=3.0, fitness='auto', **kwargs)
Invasive Weed Optimization (Mehrabian and Lucas, 2006).
Each weed spreads seeds around itself: the best weed gets max_seed_count seeds,
the worst min_seed_count, and the others a number in between. Seeds are Gaussian
with a standard deviation that shrinks over the run,
(1 - u) ** modulation_index * (step_size - final_step_size) + final_step_size,
where u is the share of the run used (max_nfe, max_iter or max_time,
whichever is largest). Weeds and seeds compete, and the best pop_size survive.
Weeds with an infinite or NaN objective value get the fewest seeds.
Parameters
pop_size: maximum population size (competitive exclusion keeps the best ones)initial_pop_size: number of weeds at the startmin_seed_count,max_seed_count: seeds produced by the worst and the best weedstep_size: initial standard deviation of seed dispersal (code units)final_step_size: standard deviation at the end of the runmodulation_index: exponent of the step size schedule (default 3, the paper's recommendation)fitness: "auto" (default), "paper" or "rank". "paper" sets the seed count linearly from the worst to the best objective value. "auto" does the same, but uses ranks when the problem has constraints, because an infeasible solution has no meaningful objective value. "rank" always uses ranks.
Reference: A. R. Mehrabian and C. Lucas, "A novel numerical optimization algorithm inspired from weed colonization", Ecological Informatics 1(4), 2006, 355 to 366.
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.IWO(max_nfe=20_000)
result = alg.solve(problem, seed=1)
print(result.summary())
IWO on sphere
best objective value: 0.00466622
feasible: True (violation 0)
evaluations: 20000, iterations: 821, time: 0.0686 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.IWO(max_nfe=20000);
result = alg.solve(problem, seed=1);
disp(result.summary())
IWO on sphere
best objective value: 0.00357754
feasible: true (violation 0)
evaluations: 20000, iterations: 803, time: 0.221 s, stopped by: max_nfe
Search on Rastrigin¶