region.objective_function module¶
-
class
region.objective_function.ObjectiveFunction(metric=None)¶ Bases:
abc.ABC-
update(moving_area, recipient_region, labels, attr)¶ Calculate the difference in the objective value caused by moving moving_area to recipient_region.
Parameters: - moving_area (int) – The area to move.
- recipient_region (int) – The recipient region.
- labels (
numpy.ndarray) – The areas’ region labels before the move. Shape: number of areas. - attr (
numpy.ndarray) – The areas’ attributes. Shape: number of areas.
Returns: diff – The change in the objective function caused by moving moving_area to recipient_region.
Return type:
-
-
class
region.objective_function.ObjectiveFunctionCenter(metric=None, center=<function mean>, reduction=<function sum>)¶ Bases:
region.objective_function.ObjectiveFunction-
update(moving_area, recipient_region, labels, attr)¶
-
-
class
region.objective_function.ObjectiveFunctionPairwise(metric=None)¶ Bases:
region.objective_function.ObjectiveFunction-
update(moving_area, recipient_region, labels, attr)¶
-