evaluate_single_solution_single_objective
site.SiteProblem.evaluate_single_solution_single_objective(
objective='p_median',
site_names=None,
site_indices=None,
capacitated=False,
threshold_for_coverage=None,
)Evaluate a specific set of facility sites against a single objective.
This method calculates the performance of a given facility configuration (a ‘solution’). It determines which demand points are assigned to which sites based on minimum travel cost and calculates coverage metrics if a threshold is provided.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| objective | str | The name of the objective function to evaluate. Must be a value defined in SUPPORTED_OBJECTIVES. |
"p_median" |
| site_names | list of str | A list of site identifiers (column names in the travel matrix) representing the chosen solution. | None |
| site_indices | list of int | A list of integer positions (column indices) representing the chosen solution. | None |
| capacitated | bool | Whether to consider site capacity constraints. Currently, only False is supported. |
False |
| threshold_for_coverage | float or int | A distance or time value. Demand points with a minimum travel cost lower than this value are flagged as ‘covered’. | None |
Returns
| Name | Type | Description |
|---|---|---|
| EvaluatedCombination | A results container containing the objective type, resolved site indices/names, and a detailed DataFrame of the demand assignments. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If an unsupported objective is passed, or if neither (or both) site_names and site_indices are provided. |
|
| KeyError | If provided site_names do not exist in the travel matrix columns. |
|
| IndexError | If provided site_indices are out of the bounds of the travel matrix. |
|
| NotImplementedError | If capacitated=True is requested. |
Notes
The method assumes an uncapacitated assignment logic where every demand point is assigned to its nearest (lowest cost) active facility.
If self.travel_and_demand_df has not been generated via a merge yet, this method calls _create_joined_demand_travel_df automatically.
See Also
EvaluatedCombination : The class used to wrap the output of this method.