pyrimidine.local_search subpackage¶
pyrimidine.local_search.random_walk module¶
pyrimidine.local_search.simulated_annealing module¶
Simulated Annealing Algorithm
Ref S. Kirkpatrick, C. D. Gelatt, Jr., M. P. Vecchi. Optimization by Simulated Annealing. 1983: 220(4598): 671-679
- class pyrimidine.local_search.simulated_annealing.SimulatedAnnealing(*args, **kwargs)¶
Bases:
PhantomIndividualClass for Simulated Annealing
- params¶
parameters in SA
- Type:
dict
- alias = {'chromosomes': 'elements', 'n_chromosomes': 'n_elements'}¶
- apply(f, *args, **kwargs)¶
- property elements¶
- isa(cls)¶
- move(T)¶
Move phantom
- Parameters:
temperature (T {number} --)
- property n_elements¶
- params = {'ext_c': 0.99, 'initT': 100, 'int_c': 0.99, 'max_iter': 100, 'n_epochs': 200, 'termT': 0.0001}¶
- regester(name, key, force=True)¶
- regester_map(name, key=None, force=True)¶
- transition(*args, **kwargs)¶
The core method of the object.
This method transitions one state of the object to another state based on certain rules, such as crossing and mutating for individuals in GA, or the moving method in Simulated Annealing.
pyrimidine.local_search.tabu_search module¶
Tabu Search was created by Fred W. Glover in 1986 and formalized in 1989
References Glover, Fred W. and Manuel Laguna. “Tabu Search.” (1997). Glover, Fred W.. “Tabu Search - Part I.” INFORMS J. Comput. 1 (1989): 190-206. Glover, Fred W.. “Tabu Search - Part II.” INFORMS J. Comput. 2 (1989): 4-32.
- class pyrimidine.local_search.tabu_search.BaseTabuSearch(*args, **kwargs)¶
Bases:
BaseIndividualTabu Search algorithm
- alias = {'chromosomes': 'elements', 'n_chromosomes': 'n_elements'}¶
- apply(f, *args, **kwargs)¶
- backup(check=True)¶
Backup the fitness and other information
- Parameters:
check (bool, optional) – check whether the fitness increases.
- copy(*args, **kwargs)¶
copy the object
- Parameters:
type – the type of new object
element_class (None, optional) – the new element_class
- Returns:
a new object copy the data but with new type
- property elements¶
- property fitness¶
- get_neighbour(action)¶
to get a neighbour of an individual
e.g. mutate only one gene
- init()¶
- isa(cls)¶
- property memory¶
- property n_elements¶
- params = {'actions': [], 'max_iter': 100, 'tabu_list': [], 'tabu_size': 10, 'value': 0}¶
- regester(name, key, force=True)¶
- regester_map(name, key=None, force=True)¶
- set_memory(**d)¶
- property solution¶
get the attribute from memory, where the best solution is stored
- transition(*args, **kwargs)¶
The core method of the object.
This method transitions one state of the object to another state based on certain rules, such as crossing and mutating for individuals in GA, or the moving method in Simulated Annealing.
- update_tabu_list()¶
- class pyrimidine.local_search.tabu_search.SimpleTabuSearch(*args, **kwargs)¶
Bases:
BaseTabuSearch- alias = {'chromosomes': 'elements', 'n_chromosomes': 'n_elements'}¶
- apply(f, *args, **kwargs)¶
- property elements¶
- get_neighbour(action)¶
to get a neighbour of an individual
e.g. mutate only one gene
- isa(cls)¶
- property n_elements¶
- params = {'actions': [], 'max_iter': 100, 'tabu_list': [], 'tabu_size': 10, 'value': 0}¶
- regester(name, key, force=True)¶
- regester_map(name, key=None, force=True)¶
- pyrimidine.local_search.tabu_search.random() x in the interval [0, 1).¶