show_solutions_summary
site.SiteSolutionSet.show_solutions_summary(n_best=None, diff_against='default')Return a stakeholder-facing view of the solution table: a handful of plain-English columns with units in the header, in place of show_solutions()’s full ~30-40 column schema (jargon names, no units, and placeholder None/NaN/“N/A (No equity data)” columns whenever a given input – equity data, a coverage threshold, a baseline – wasn’t registered).
Always included: Sites in this option (site_names) and Sites not in this option (unselected_site_names), both joined into one readable string rather than a list pandas truncates mid-entry, Average travel time (mins) (weighted_average), and Longest journey (mins) (max). Rank is also included for a multi-solution SiteSolutionSet (from solve()), but omitted for a single directly-evaluated solution (evaluate_baseline() or evaluate_single_solution_single_objective()), which has no solution_rank column to show.
Additional sites chosen (site_names minus the sites flagged via add_sites(required_sites_col=...)) is only added when at least one required site is configured – e.g. for a “we have 4 sites and are opening 1 more” problem, it’s just the new site, rather than Sites in this option repeating the same 4 required names alongside it in every row.
Sites added (vs <reference>)/Sites removed (vs <reference>)/ Sites changed (vs <reference>) (a per-row site-name diff against diff_against, see below) are added whenever there’s more than one solution to tell apart (i.e. solution_rank exists) – this is what makes several near-identical top-N rows (e.g. a brute-force search that only ever swaps one or two sites out of many) distinguishable at a glance without scanning two long, truncated Sites in this option strings against each other by eye.
Coverage columns (People within <threshold> mins, % within <threshold> mins) are only added if threshold_for_coverage was set on this solve. Sites closed and Sites added (sites_closed_ vs_baseline/sites_added_vs_baseline, joined into readable strings) and the population-impact-vs-baseline columns (People with a longer/shorter journey, % of cohort with a longer/shorter journey, Avg increase/reduction for them (mins)) are only added if a baseline was supplied (solve(baseline=...) or evaluate_baseline()/evaluate_single_solution_single_ objective(baseline=...)). Equity columns (Equity gap (mins, best vs worst group) and the two plain-English equity verdicts) are only added if equity data was registered via add_equity_data(). A section absent from the input is omitted entirely rather than shown full of placeholders.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| n_best | int | Number of top-ranked solutions to include. If None, every row in solution_df is included. |
None |
| diff_against | (default, rank_1, previous_rank, required_sites) | What each row’s site-name diff columns are computed against. “default” resolves to “required_sites” if at least one site is flagged via add_sites(required_sites_col=...) (the closest thing to “what’s new beyond what we already have”), else falls back to “rank_1” silently. “rank_1” diffs every row against the top-ranked solution’s site_names – a single, stable reference point for comparing any row directly to the best one. “previous_rank” diffs every row against the row one rank better than it – reads as “what changes if you loosen the criteria one more notch”, though unlike “rank_1” the reference itself moves every row, so two non-adjacent ranks can’t be compared directly from this column alone. “required_sites” diffs directly against the required-sites set, raising ValueError if none are configured (an explicit request for a reference that doesn’t exist, unlike “default”’s silent fallback). See _resolve_site_diff for the full definition. |
"default" |
Returns
| Name | Type | Description |
|---|---|---|
| pandas.DataFrame | One row per solution, columns as described above. People counts are whole numbers, travel times are rounded to 1 decimal place, and coverage is given as both a headcount and a percentage. Any NaN (e.g. mean_reduction_among_improved when nobody’s journey actually improved) is filled with 0, since a stakeholder reading of “no one” is better served by 0 than an unexplained blank. |
Notes
This is a read-only, additive view – it never modifies solution_df, and show_solutions()’s own column set is unaffected. Use show_solutions() (optionally with expand_dict_columns=True) for the full underlying data, e.g. for further computation or export.
The equity verdict columns are full sentences and can exceed 50 characters. Displaying this DataFrame bare in Jupyter truncates any cell over pandas’ display.max_colwidth (50 by default) with “…” – run pd.set_option("display.max_colwidth", None) once at the top of a notebook to see them in full, or call .to_string() on the result.