opt.single_objective.comb.min_set_cover_problem package
Submodules
opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem module
- class opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem.MinSetCoverProblem(universe: Set[int], subsets: list[Set[int]])
Bases:
Problem
Class representing the Minimum Set Cover Problem.
This class inherits from the TargetProblem class and is used to define and solve the Set Covering Problem Problem. The problem is defined by a set U and a list of subsets of U named S.
- __init__(universe
Set[int], subsets: list[Set[int]]): Initializes a new instance of the MinSetCoverProblem class.
- __load_from_files__(universe_file_path
str, subsets_file_path: str) -> tuple: Static function that reads problem data from files.
- from_input_files(universe_file_path
str, subsets_file_path: str): Creates a new MinSetCoverProblem instance when the input file and input format are specified.
- __copy__() MinSetCoverProblem
Internal copy of the MinSetCoverProblem problem.
- copy() MinSetCoverProblem
Copy the MinSetCoverProblem problem.
- string_rep(delimiter
str, indentation: int = 0, indentation_symbol: str = ‘’, group_start: str = ‘{’, group_end: str = ‘}’) -> str: String representation of the MinSetCoverProblem instance.
- copy() MinSetCoverProblem
Copy the MinSetCoverProblem problem
- Returns:
new MinSetCoverProblem instance with the same properties
- Return type:
- property dimension: int
Property getter for dimension of the target problem
- Returns:
dimension of the target problem instance
- Return type:
- classmethod from_input_files(universe_file_path: str, subsets_file_path: str) MinSetCoverProblem
Additional constructor. Create new MinSetCoverProblem instance when input file and input format are specified
- Parameters:
- Returns:
class instance
- Return type:
- classmethod from_universe_and_subset_files(universe: Set[int], subsets: list)
Additional constructor. Create new MinSetCoverProblem instance where the universe and subsets are specified.
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the MinSetCoverProblem 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.comb.min_set_cover_problem.min_set_cover_problem_bit_array_solution module
The set_covering_problem_bit_array_solution
contains class MinSetCoverProblemBitArraySolution
, that represents solution of the Minimum Set Cover Problem, where BitArray representation of the problem has been used.
- class opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem_bit_array_solution.MinSetCoverProblemBitArraySolution(random_seed: int | None = 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
,str
]- argument(representation: BitArray) str
Argument of the target solution
- Parameters:
representation (BitArray) – internal representation of the solution
- Returns:
solution code
- Return type:
- calc_fitness(representation: BitArray, universe: set[int], subsets: list[set[int]]) tuple[bool, float]
- calculate_quality_directly(representation: BitArray, problem: MinSetCoverProblem) QualityOfSolution
Fitness calculation of the set covering binary BitArray solution
- Parameters:
representation (BitArray) – native representation of solution whose fitness is calculated
problem (Problem) – problem that is solved
- Returns:
objective value, fitness value and feasibility of the solution instance
- Return type:
QualityOfSolution
- copy() MinSetCoverProblemBitArraySolution
Copy the MinSetCoverProblemBitArraySolution
- Returns:
new MinSetCoverProblemBitArraySolution instance with the same properties
- Return type:
MinSetCoverProblemBitArraySolution
- init_from(representation: BitArray, problem: Problem) None
Initialization of the solution, by setting its native representation
- Parameters:
representation (BitArray) – representation that will be ste to solution
problem (Problem) – problem which is solved by solution
- init_random(problem: Problem) None
Random initialization of the solution
- Parameters:
problem (Problem) – problem which is solved by solution
- native_representation(representation_str: str) BitArray
Obtain BitArray representation from string representation of the BitArray binary solution of the Set Covering Problem
- Parameters:
representation_str (str) – solution’s representation as string
- Returns:
solution’s representation as BitArray
- Return type:
BitArray
- representation_distance_directly(solution_code_1: str, solution_code_2: str) float
Calculating distance between two solutions determined by its code
- string_rep(delimiter: str = '\n', indentation: int = 0, indentation_symbol: str = ' ', group_start: str = '{', group_end: str = '}') str
String representation of the 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.comb.min_set_cover_problem.min_set_cover_problem_bit_array_solution.random() x in the interval [0, 1).
opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem_ilp_linopy module
- class opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem_ilp_linopy.MinSetCoverProblemIntegerLinearProgrammingSolution(sol: MinSetCoverProblemIntegerLinearProgrammingSolver)
Bases:
SolutionVoidObject
- class opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem_ilp_linopy.MinSetCoverProblemIntegerLinearProgrammingSolver(output_control: OutputControl = None, problem: MinSetCoverProblem = None)
Bases:
Optimizer
- copy()
Copy the current algorithm
- Returns:
new MinSetCoverProblemIntegerLinearProgrammingSolver instance with the same properties
- Return type:
:class:
MinSetCoverProblemIntegerLinearProgrammingSolver
- classmethod from_construction_tuple(construction_params: MinSetCoverProblemIntegerLinearProgrammingSolverConstructionParameters = None)
Additional constructor. Create new MinSetCoverProblemIntegerLinearProgrammingSolver instance from construction parameters
- Parameters:
construction_params (MinSetCoverProblemIntegerLinearProgrammingSolverConstructionParameters) – parameters for construction
- property model: Model
Property getter for the ILP model
- Returns:
model of the problem
- Return type:
Model
- optimize() MinSetCoverProblemIntegerLinearProgrammingSolution
Uses ILP model in order to solve MinSetCoverProblem
- string_rep(delimiter: str, indentation: int = 0, indentation_symbol: str = '', group_start: str = '{', group_end: str = '}') str
String representation of the ‘MinSetCoverProblemIntegerLinearProgrammingSolver’ 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:
- class opt.single_objective.comb.min_set_cover_problem.min_set_cover_problem_ilp_linopy.MinSetCoverProblemIntegerLinearProgrammingSolverConstructionParameters(problem: Problem = None, output_control: OutputControl | None = None)
Bases:
object
Instance of the class
MinSetCoverProblemIntegerLinearProgrammingSolverConstructionParameters
represents constructor parameters for set covering problem ILP solver.- property output_control: OutputControl
Property getter for the output control
- Returns:
output control
- Return type:
OutputControl