uo.algorithm.metaheuristic package
Subpackages
- uo.algorithm.metaheuristic.electro_magnetism_like_metaheuristic package
- uo.algorithm.metaheuristic.genetic_algorithm package
- uo.algorithm.metaheuristic.variable_neighborhood_search package
- Submodules
- uo.algorithm.metaheuristic.variable_neighborhood_search.problem_solution_vns_support module
- uo.algorithm.metaheuristic.variable_neighborhood_search.vns_optimizer module
VnsOptimizer
VnsOptimizerConstructionParameters
VnsOptimizerConstructionParameters.additional_statistics_control
VnsOptimizerConstructionParameters.finish_control
VnsOptimizerConstructionParameters.k_max
VnsOptimizerConstructionParameters.k_min
VnsOptimizerConstructionParameters.output_control
VnsOptimizerConstructionParameters.problem
VnsOptimizerConstructionParameters.random_seed
VnsOptimizerConstructionParameters.solution_template
VnsOptimizerConstructionParameters.vns_ls_support
VnsOptimizerConstructionParameters.vns_shaking_support
random()
- Module contents
Submodules
uo.algorithm.metaheuristic.metaheuristic module
The metaheuristic
module describes the class Metaheuristic
.
- class uo.algorithm.metaheuristic.metaheuristic.Metaheuristic(finish_control: FinishControl, problem: Problem, solution_template: Solution | None, name: str, output_control: OutputControl | None, random_seed: int | None, additional_statistics_control: AdditionalStatisticsControl | None)
Bases:
Algorithm
This class represent metaheuristic
- property additional_statistics_control: AdditionalStatisticsControl | None
Property getter for the structure that controls keeping of the statistic during metaheuristic execution
- Returns:
structure that controls that controls keeping of the statistic during metaheuristic execution
- Return type:
Optional[AdditionalStatisticsControl]
- abstract copy()
Copy the current metaheuristic
- Returns:
new Metaheuristic instance with the same properties
- Return type:
Metaheuristic
- determine_fields_val(fields_def: list[str], fields_val: list[str]) list[str]
Determines fields values upon fields definition and old values
- elapsed_seconds() float
Calculate time elapsed during execution of the metaheuristic algorithm
- Returns:
elapsed time (in seconds)
- Return type:
- property finish_control: FinishControl
Property getter for the structure that controls finish criteria for metaheuristic execution
- Returns:
structure that controls finish criteria for metaheuristic execution
- Return type:
FinishControl
- property random_seed: int
Property getter for the random seed used during metaheuristic execution
- Returns:
random seed
- Return type:
- should_finish() bool
Check if execution of the metaheuristic algorithm should finish
- Returns:
Should execution finish
- Return type:
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the Metaheuristic instance
- Parameters:
delimiter (str) – delimiter between fields
indentation (int, optional, default value 0) – level of indentation
indentation_symbol (str, optional, default value '') – indentation symbol
group_start (str, optional, default value '{') – group start string
group_end (str, optional, default value '}') – group end string
- Returns:
string representation of instance that controls output
- Return type:
- uo.algorithm.metaheuristic.metaheuristic.random() x in the interval [0, 1).
The single_solution_metaheuristic
module describes the class SingleSolutionMetaheuristic
.
- class uo.algorithm.metaheuristic.single_solution_metaheuristic.SingleSolutionMetaheuristic(finish_control: FinishControl, problem: Problem, solution_template: Solution | None, name: str, output_control: OutputControl | None, random_seed: int | None, additional_statistics_control: AdditionalStatisticsControl | None)
Bases:
Metaheuristic
This class represent single solution metaheuristic
- abstract copy()
Copy the current single solution metaheuristic
- Returns:
new SingleSolutionMetaheuristic instance with the same properties
- Return type:
SingleSolutionMetaheuristic
- property current_solution: Solution | None
Property getter for the current solution used during single solution metaheuristic execution
- Returns:
instance of the
uo.solution.Solution
class subtype – current solution of the problem- Return type:
Solution
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the SingleSolutionMetaheuristic instance
- Parameters:
delimiter (str) – delimiter between fields
indentation (int, optional, default value 0) – level of indentation
indentation_symbol (str, optional, default value '') – indentation symbol
group_start (str, optional, default value '{') – group start string
group_end (str, optional, default value '}') – group end string
- Returns:
string representation of instance that controls output
- Return type:
- uo.algorithm.metaheuristic.single_solution_metaheuristic.random() x in the interval [0, 1).
The population_based_metaheuristic
module describes the class PopulationBasedMetaheuristic
.
- class uo.algorithm.metaheuristic.population_based_metaheuristic.PopulationBasedMetaheuristic(finish_control: FinishControl, problem: Problem, solution_template: Solution | None, name: str, output_control: OutputControl | None, random_seed: int | None, additional_statistics_control: AdditionalStatisticsControl | None)
Bases:
Metaheuristic
This class represent population metaheuristic
- abstract copy() PopulationBasedMetaheuristic
Copy the current population based metaheuristic
- Returns:
new PopulationBasedMetaheuristic instance with the same properties
- Return type:
PopulationBasedMetaheuristic
- property current_population: list[Solution] | None
Property getter for the population of solutions within population based metaheuristic execution
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the SingleSolutionMetaheuristic instance
- Parameters:
delimiter (str) – delimiter between fields
indentation (int, optional, default value 0) – level of indentation
indentation_symbol (str, optional, default value '') – indentation symbol
group_start (str, optional, default value '{') – group start string
group_end (str, optional, default value '}') – group end string
- Returns:
string representation of instance that controls output
- Return type:
- uo.algorithm.metaheuristic.population_based_metaheuristic.random() x in the interval [0, 1).
- class uo.algorithm.metaheuristic.metaheuristic_void.MetaheuristicVoid(finish_control: FinishControl, problem: Problem, solution_template: Solution | None = None, name: str = 'metaheuristic-void', output_control: OutputControl | None = None, random_seed: int | None = None, additional_statistics_control: AdditionalStatisticsControl | None = None)
Bases:
Metaheuristic
- copy()
Copy the current metaheuristic
- Returns:
new Metaheuristic instance with the same properties
- Return type:
Metaheuristic
- init()
- uo.algorithm.metaheuristic.metaheuristic_void.random() x in the interval [0, 1).
- class uo.algorithm.metaheuristic.single_solution_metaheuristic_void.SingleSolutionMetaheuristicVoid(finish_control: ~uo.algorithm.metaheuristic.finish_control.FinishControl, problem: ~uo.problem.problem.Problem =, solution_template: ~uo.solution.solution.Solution | None = { fitness_value=-inf objective_value=-inf is_feasible=False representation()=None evaluation_cache_cs=Nonerepresentation_distance_cache_cs=None}, name: str = 'ss_metaheuristic_void', output_control: ~uo.algorithm.output_control.OutputControl | None = None, random_seed: int | None = None, additional_statistics_control: ~uo.algorithm.metaheuristic.additional_statistics_control.AdditionalStatisticsControl | None = None)
Bases:
SingleSolutionMetaheuristic
- copy()
Copy the current single solution metaheuristic
- Returns:
new SingleSolutionMetaheuristic instance with the same properties
- Return type:
SingleSolutionMetaheuristic
- init()
- uo.algorithm.metaheuristic.single_solution_metaheuristic_void.random() x in the interval [0, 1).
- class uo.algorithm.metaheuristic.population_based_metaheuristic_void.PopulationBasedMetaheuristicVoid(finish_control: ~uo.algorithm.metaheuristic.finish_control.FinishControl, problem: ~uo.problem.problem.Problem =, solution_template: ~uo.solution.solution.Solution | None = { fitness_value=-inf objective_value=-inf is_feasible=False representation()=None evaluation_cache_cs=Nonerepresentation_distance_cache_cs=None}, name: str = 'pop_metaheuristic_void', output_control: ~uo.algorithm.output_control.OutputControl | None = None, random_seed: int | None = None, additional_statistics_control: ~uo.algorithm.metaheuristic.additional_statistics_control.AdditionalStatisticsControl | None = None)
Bases:
PopulationBasedMetaheuristic
- copy()
Copy the current population based metaheuristic
- Returns:
new PopulationBasedMetaheuristic instance with the same properties
- Return type:
PopulationBasedMetaheuristic
- init()
- uo.algorithm.metaheuristic.population_based_metaheuristic_void.random() x in the interval [0, 1).