site.SiteSolutionSet
site.SiteSolutionSet(solution_df, site_problem, objectives, n_sites=None)Container for a set of evaluated site selection solutions.
This class stores and provides convenient access to a collection of candidate solutions from a brute-force or heuristic search, along with their associated evaluation metrics. It supports returning and plotting details of the best-performing solutions.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| solution_df | pandas.DataFrame | DataFrame containing one row per evaluated solution. Typically includes: - “site_indices”: Indices of selected sites for the solution. - One or more objective/metric columns (e.g., “weighted_average”, “unweighted_average”, “90th_percentile”, etc.). The DataFrame is reset to a zero-based index upon initialisation. | required |
| site_problem | object | The originating problem instance used to generate and evaluate the solutions. | required |
| objectives | str or list of str | Objective(s) used to evaluate and rank the solutions (e.g., “weighted_average”, “mclp”). | required |
| n_sites | int | Number of sites selected in each solution (e.g., p in a p-median or p-center problem). |
None |
Attributes
| Name | Type | Description |
|---|---|---|
| solution_df | pandas.DataFrame | DataFrame of evaluated solutions with metrics. |
| site_problem | object | Problem definition associated with the solutions. |
| objectives | str or list of str | Objective(s) used in evaluation. |
| n_sites | int or None | Number of sites in each solution. |
Notes
Solutions are typically pre-sorted before being passed to this class (e.g., by objective value and tie-breakers). The optional rank_on argument in methods allows overriding this ordering dynamically.
The structure of solution_df is assumed to be consistent with the outputs of the optimisation or search routine that generated it.
Methods
| Name | Description |
|---|---|
| show_solutions | Return the solution DataFrame with rounded values. |
| return_best_combination_details | Return details of the top-ranked solution(s). |
| return_best_combination_site_indices | Return the site indices for the best-performing solution. |
| return_best_combination_site_names | Return the site names for the best-performing solution. |
| plot_simple_pareto_front | Plot a Pareto front for two selected solution metrics. |
| plot_all_metric_pareto_front | Plot Pareto fronts for all pairs of solution metrics. |
| plot_n_best_combinations_bar | Plot a bar chart of the top-performing site combinations. |
| plot_best_combination | Plot a map of the best-performing site combination. |
| plot_n_best_combinations | Plot maps for the top-performing site combinations. |
| plot_travel_time_distribution | Plot travel time distributions for selected solutions. |
| check_solution_equity | Summarise and optionally plot equity metrics for a selected solution. |
| plot_top_n_solution_equity | Plot equity summaries for the top N solutions in a grid of subplots. |
| plot_combination_by_equity |