opt.single_objective.glob.max_function_one_variable_problem package
Submodules
opt.single_objective.glob.max_function_one_variable_problem.command_line module
The command_line
module is used for obtaining execution parameters for execution of the optimizers for max ones problem.
- opt.single_objective.glob.max_function_one_variable_problem.command_line.parse_arguments()
The parse_arguments function parses execution parameters for execution of the optimizers for max ones problem.
opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem module
- class opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem.MaxFunctionOneVariableMaxProblem(expression: str, domain_low: float, domain_high: float)
Bases:
Problem
- copy()
Copy the current target problem
- Returns:
new Problem instance with the same properties
- Return type:
- classmethod from_input_file(input_file_path: str, input_format: str)
Additional constructor. Create new MaxFunctionOneVariableMaxProblem instance when input file and input format are specified
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the target problem 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:
opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_bit_array_solution module
- class opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_bit_array_solution.FunctionOneVariableMaxProblemBitArraySolution(domain_from: float, domain_to: float, number_of_intervals: int, random_seed: int = None, evaluation_cache_is_used: bool = False, evaluation_cache_max_size: int = 0, distance_calculation_cache_is_used: bool = False, distance_calculation_cache_max_size: int = 0)
Bases:
Solution
[BitArray
,float
]- argument(representation: BitArray) float
Argument of the target solution
- Parameters:
representation (R_co) – internal representation of the solution
- Returns:
argument of the solution
- Return type:
A_co
- calculate_quality_directly(representation: int, problem: MaxFunctionOneVariableMaxProblem) QualityOfSolution
Fitness calculation of the target solution
- Parameters:
representation (R_co) – native representation of the solution for which objective value, fitness and feasibility are calculated
problem (Problem) – problem that is solved
- Returns:
objective value, fitness value and feasibility of the solution instance
- Return type:
QualityOfSolution
- copy()
Copy the current target solution
- Returns:
new
uo.solution.Solution
instance with the same properties- Return type:
- init_from(representation: BitArray, problem: MaxFunctionOneVariableMaxProblem) None
Initialization of the solution, by setting its native representation
- Parameters:
representation (R_co) – representation that will be ste to solution
problem (Problem) – problem which is solved by solution
- init_random(problem: MaxFunctionOneVariableMaxProblem) None
Random initialization of the solution
- Parameters:
problem (Problem) – problem which is solved by solution
- native_representation(representation_str: str) BitArray
Obtain native representation from solution code of the Solution instance
- Parameters:
representation_str (str) – solution’s representation as string (e.g. solution code)
- Returns:
solution’s native representation
- Return type:
R_co
- obtain_feasible_representation(problem: MaxFunctionOneVariableMaxProblem) BitArray
- representation_distance_directly(solution_code_1: str, solution_code_2: str) float
Calculates the distance between two binary representations of solutions.
- string_rep(delimiter: str = '\n', indentation: int = 0, indentation_symbol: str = ' ', group_start: str = '{', group_end: str = '}') str
String representation of the target solution 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:
- opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_bit_array_solution.random() x in the interval [0, 1).
opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_int_solution module
- class opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_int_solution.FunctionOneVariableMaxProblemIntSolution(domain_from: float, domain_to: float, number_of_intervals: int, random_seed: int = None, evaluation_cache_is_used: bool = False, evaluation_cache_max_size: int = 0, distance_calculation_cache_is_used: bool = False, distance_calculation_cache_max_size: int = 0)
-
- argument(representation: int) float
Argument of the target solution
- Parameters:
representation (R_co) – internal representation of the solution
- Returns:
argument of the solution
- Return type:
A_co
- calculate_quality_directly(representation: int, problem: MaxFunctionOneVariableMaxProblem) QualityOfSolution
Fitness calculation of the target solution
- Parameters:
representation (R_co) – native representation of the solution for which objective value, fitness and feasibility are calculated
problem (Problem) – problem that is solved
- Returns:
objective value, fitness value and feasibility of the solution instance
- Return type:
QualityOfSolution
- copy()
Copy the current target solution
- Returns:
new
uo.solution.Solution
instance with the same properties- Return type:
- init_from(representation: int, problem: MaxFunctionOneVariableMaxProblem) None
Initialization of the solution, by setting its native representation
- Parameters:
representation (R_co) – representation that will be ste to solution
problem (Problem) – problem which is solved by solution
- init_random(problem: MaxFunctionOneVariableMaxProblem) None
Random initialization of the solution
- Parameters:
problem (Problem) – problem which is solved by solution
- native_representation(representation_str: str) int
Obtain native representation from solution code of the Solution instance
- Parameters:
representation_str (str) – solution’s representation as string (e.g. solution code)
- Returns:
solution’s native representation
- Return type:
R_co
- obtain_feasible_representation(problem: MaxFunctionOneVariableMaxProblem)
- representation_distance_directly(solution_code_1: str, solution_code_2: str) float
Calculates the distance between two binary representations of solutions.
- string_rep(delimiter: str = '\n', indentation: int = 0, indentation_symbol: str = ' ', group_start: str = '{', group_end: str = '}') str
String representation of the target solution 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:
- opt.single_objective.glob.max_function_one_variable_problem.max_function_one_variable_problem_int_solution.random() x in the interval [0, 1).
opt.single_objective.glob.max_function_one_variable_problem.solver module
The opt.single_objective.comb.ones_count_max_problem.solver
contains programming code that optimize Max Ones Problem with various optimization techniques.
- opt.single_objective.glob.max_function_one_variable_problem.solver.main()
This function executes solver.
Which solver will be executed depends of command-line parameter algorithm.
- opt.single_objective.glob.max_function_one_variable_problem.solver.random() x in the interval [0, 1).