find_balanced_solution
site_solutions.SolutionComparator.find_balanced_solution(
top_n=25,
method='rank_balanced',
objective='weighted_average',
secondary_objective='max',
rank_weight=0.5,
return_details=False,
)Finds the most similar top solutions from each set to approximate a balanced compromise without deep optimization.
Parameters:
top_n : int Number of top solutions from each set to consider method : str Similarity metric to use: - ‘jaccard’: Jaccard similarity of site sets - ‘overlap’: Raw count of overlapping sites - ‘combined’: Weighted combination of Jaccard and normalized objectives - ‘rank_balanced’: Jaccard similarity penalised by the sum of their ranks (prioritises shared balance) rank_weight : float Only used if method=‘rank_balanced’. Determines the strength of the rank penalty. return_details : bool If True, returns full comparison details; if False, returns just the best pair
Returns:
dict or tuple If return_details=True: dict with best pair info and all comparisons If return_details=False: tuple of (solution_from_a, solution_from_b)