Iterated Local Search (ILS)¶
A local search for combinatorial problems such as tours and assignments. It leaves a local optimum by perturbing it and searching again from there.
ILS ¶
ILS(*, strength=3, perturbation='random', acceptance='restart', restart_after=100, temperature=0.01, improvement='first', batch=10, step_min=1e-08, **kwargs)
Iterated local search (Lourenço, Martin and Stützle 2003).
Each iteration perturbs the current local optimum with strength random moves, runs a
local search from the result to a new local optimum (hill climbing over all move kinds,
first or best improvement, halving the Real step down to step_min), and keeps the
new local optimum by the acceptance rule:
- "better": only when it is better than the current one.
- "restart" (default): as "better", and after
restart_afteriterations without a new best solution, the search starts again from a random solution. - "random_walk": always.
- "lsmc": when it is better, otherwise with probability exp(-d / temperature), where d is how much worse it is relative to the current value (as in simulated annealing at a fixed temperature). When either solution is infeasible, only a better one is kept.
Parameters
strength: random moves per perturbation (default 3)perturbation: "random" (default, moves of any kind, each touching different elements) or "double_bridge" (permutations are cut into four parts A B C D and rejoined as A C B D, the classic TSP kick; other variables get random moves)acceptance: "restart" (default), "better", "random_walk" or "lsmc"restart_after: iterations without a new best before a restart (default 100)temperature: relative temperature of "lsmc" (default 0.01)improvement: "first" (default) or "best" improvement in the local searchbatch,candidate_size,moves,real_moves,step,step_min: as inHillClimbing
Reference: H. R. Lourenço, O. C. Martin and T. Stützle, "Iterated local search", in Handbook of Metaheuristics, 2003, 321 to 353.
The moves of each variable type are listed in Neighborhoods.
Example¶
import ypea
problem = ypea.problems.random_tsp(50, seed=2)
alg = ypea.ILS(max_nfe=50_000)
result = alg.solve(problem, seed=1)
print(result.summary())
ILS on random_tsp50
best objective value: 580.736
feasible: True (violation 0)
evaluations: 50000, iterations: 10, time: 3.64 s, stopped by: max_nfe
Differs from Python: MATLAB draws its own cities and random numbers, so the tour length differs from Python's.
problem = ypea.problems.random_tsp(50, seed=2);
alg = ypea.ILS(max_nfe=50000);
result = alg.solve(problem, seed=1);
disp(result.summary())
ILS on random_tsp50
best objective value: 587.818
feasible: true (violation 0)
evaluations: 50000, iterations: 7, time: 2.86 s, stopped by: max_nfe