Skip to content

Tabu Search (TS)

A local search for combinatorial problems such as tours and assignments. It also accepts worse moves and forbids undoing recent ones, so it can leave local optima.

TabuSearch

TabuSearch(*, tenure=(7, 20), tabu_rule='either', inversion_attribute='edges', aspiration=True, step=0.01, **kwargs)

Tabu search with short-term memory (Glover 1989, Glover and Laguna 1997).

Each iteration evaluates the candidate list (the whole neighborhood when it has at most candidate_size moves, otherwise a random sample of that size) and moves to the best candidate that is not tabu, even when it is worse than the current solution. A made move makes its attributes tabu for tenure iterations, so the search does not undo it: an item cannot go back to the position it left, a component cannot go back to its old value, and so on (see ypea.neighborhoods). A tabu move is allowed when it gives a solution better than the best so far (aspiration). When every candidate is tabu, the one whose tabu status ends first is taken.

Real variables use a fixed step (coordinate moves by default), so the search works at the resolution of step.

Parameters

  • tenure: how long a move stays tabu, in iterations: an int, a pair (low, high) for a tenure drawn at random each iteration (default (7, 20)), or "sqrt" for a random tenure between 0.5 sqrt(n) and 2 sqrt(n), where n is the number of elements (items or components). It is capped below the size of the neighborhood.
  • tabu_rule: "either" (default, a move is tabu when any of its attributes is tabu, for example either swapped item going back) or "both" (all of them)
  • inversion_attribute: for permutations, what an inversion makes tabu: "edges" (default, the two removed edges coming back, as for 2-opt on a tour) or "positions" (the end items going back)
  • aspiration: allow a tabu move that beats the best so far (default True)
  • step: the fixed Real step as a fraction of each range (default 0.01)
  • candidate_size, moves, real_moves: as in HillClimbing (default 1000, all kinds, "coordinate")

References: F. Glover, "Tabu search, Part I", ORSA Journal on Computing 1(3), 1989, 190 to 206. F. Glover and M. Laguna, "Tabu Search", Kluwer, 1997.

ypea.TS is the same class.

The moves of each variable type are listed in Neighborhoods.

Example

import ypea

problem = ypea.problems.random_tsp(50, seed=2)

alg = ypea.TabuSearch(max_nfe=50_000)
result = alg.solve(problem, seed=1)
print(result.summary())
TS on random_tsp50
  best objective value: 575.233
  feasible: True (violation 0)
  evaluations: 50000, iterations: 57, time: 0.309 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.TabuSearch(max_nfe=50000);
result = alg.solve(problem, seed=1);
disp(result.summary())
TS on random_tsp50
  best objective value: 590.776
  feasible: true (violation 0)
  evaluations: 50000, iterations: 57, time: 1.81 s, stopped by: max_nfe