SIMO metaheuristic TABUSEARCH algorithm:
>>> epsilon = 0.00001
TabuSearch heuristic optimization algorithm implementation. Initialize with keyword arguments eg. maxiterations=1000, entrytenure=10, exittenure=20
Initialize optimizer:
>>> from simo.optimization.tabusearch import TabuSearch
>>> execfile('optimization/test/mocks4optimizer.py')
>>> chart_path = 'optimization/test'
>>> ts = TabuSearch(logger, logname, taskdef, simdbin, simdbout,
...                 False, False, False, chart_path, True, 'test', True,
...                 keyword1='test-kw')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "repeats" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "initial_solutions" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "maximum_iterations" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "entrytenure" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "exittenure" missing!')
>>> ts = TabuSearch(logger, logname, taskdef, simdbin, simdbout, False,
...                 False, False, chart_path, True, 'test', True,
...                 repeats=2, initial_solutions=100,
...                 maximum_iterations=5, entrytenure=2, exittenure=3)
Run tabu search optimization algorithm
Run TS algorithm for a single iteration/repeat
Parameters:
iteration -- current simulated iteration as int
>>> ts._stat_logger = ologger  # replace stat logger with a mock
>>> ts._data = omatrix2  # replace data handler with another mock
>>> ts._analyze_data()  
Called OMatrix.analyze_data(
    <Mock ... SimInputDB>,
    <bound method TabuSearch._add_info of
    <simo.optimization.tabusearch.TabuSearch object at ...>>)
True
>>> ts.set_data(0)  
Called OMatrix.construct_data(0)
True
>>> ts._run_TS()  
Called OMatrix.solution_feasibility(array([...]))
Called OMatrix.solution_utility(array([...]))
Called OMatrix.compare_utilities(...)
Called OLogger.add_round(array(...]), 1.0, 1.0)
...
Add a new taboo move to the set and decrease the tenure counter for existing taboos
Parameters
unit -- unit indice as int
b_from -- from branch indice as int
b_to -- to branch indice as int
>>> ts._exit_map[...] = False
>>> ts._entry_map[...] = False
>>> ts._exit_timer[...] = 0
>>> ts._entry_timer[...] = 0
>>> ts._exit_tenure = 4
>>> ts._entry_tenure = 2
>>> ts._update_tabu_set(0, 0, 1)
>>> ts._update_tabu_set(1, 2, 3)
>>> ts._update_tabu_set(2, 2, 3)
>>> ts._update_tabu_set(3, 0, 2)
>>> ts._exit_map
array([[ True, False, False, False, False, False],
       [False, False,  True, False, False, False],
       [False, False,  True, False, False, False],
       [ True, False, False, False, False, False],
       [False, False, False, False, False, False]], dtype=bool)
>>> ts._entry_map
array([[False, False, False, False, False, False],
       [False, False, False, False, False, False],
       [False, False, False,  True, False, False],
       [False, False,  True, False, False, False],
       [False, False, False, False, False, False]], dtype=bool)
>>> ts._exit_timer
array([[1, 0, 0, 0, 0, 0],
       [0, 0, 2, 0, 0, 0],
       [0, 0, 3, 0, 0, 0],
       [4, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0]])
>>> ts._entry_timer
array([[0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0],
       [0, 0, 0, 1, 0, 0],
       [0, 0, 2, 0, 0, 0],
       [0, 0, 0, 0, 0, 0]])
True if taboo, False if not
Parameters
unit -- unit indice as int
b_from -- from branch indice as int
b_to -- to branch indice as int
>>> ts._is_move_tabu(0, 0, 1)
True
>>> ts._is_move_tabu(1, 0, 1)
False
True if exit map value at (unit, frombranch) is False
Parameters
unit -- unit indice as int
b_from -- from branch indice as int
>>> ts._can_exit(0,0)
False
>>> ts._can_exit(0,1)
True
>>> ts._can_exit(2,2)
False
Get non-taboo neighbours of (unit, b_from)
Parameters
unit -- unit indice as int
b_from -- from branch indice as int
num_b -- number of branches as int
>>> ts._get_neighbourhood(1, 0)
array([False,  True,  True,  True,  True,  True], dtype=bool)