genplanner.FunctionalZone¶
- class genplanner.FunctionalZone(zones_ratio, name)[source]¶
A composite zone describing a functional program of territorial zones.
FunctionalZone groups multiple TerritoryZone definitions with target area ratios. Ratios are validated and normalized to sum to 1.0.
The min_area of a functional zone is computed as the weighted sum of member zones’ min_area values (for TerritoryZone this corresponds to min_block_area), using the normalized ratios.
- Parameters:
zones_ratio – Mapping of TerritoryZone to a positive (unnormalized) target ratio.
name – Non-empty functional zone name.
- Raises:
ValueError – If name is empty, zones_ratio is empty, ratios are non-positive, or the ratio sum is invalid.
TypeError – If keys are not TerritoryZone or values are not finite numbers.
- property name¶
Functional zone name.
- Returns:
Name of the functional zone.
- Return type:
str
- property min_area¶
Weighted minimum area constraint for the functional zone.
Computed as sum(zone.min_area * ratio) using normalized ratios.
- Returns:
Weighted minimum area.
- Return type:
float
- property zones_ratio¶
Normalized zone ratio mapping.
- Returns:
A copy of the internal mapping where values sum to 1.0.
- Return type:
dict[TerritoryZone, float]
- validate()[source]¶
Validate functional zone invariants.
- Ensures:
name is a non-empty string,
zones_ratio is a non-empty dict,
keys are TerritoryZone,
values are finite numbers greater than 0.
- Raises:
ValueError – If name is empty, zones_ratio is empty, or any ratio is <= 0.
TypeError – If keys/values have incorrect types or ratios are not finite.