agent_urban_planning.PreferenceWeights¶
- class PreferenceWeights(alpha, beta, gamma, delta)[source]¶
Bases:
objectFour-axis preference weights for an agent or archetype.
Captures the relative importance an agent assigns to housing affordability, commute, services/facilities, and amenities. Values are stored unnormalized; call
normalized()to get a copy summing to 1.- Variables:
alpha – Weight on housing affordability.
beta – Weight on commute disutility.
gamma – Weight on services / facilities accessibility.
delta – Weight on neighborhood amenities.
- Parameters:
Examples
>>> from agent_urban_planning.core.agents import PreferenceWeights >>> w = PreferenceWeights(alpha=2.0, beta=1.0, gamma=1.0, delta=1.0) >>> w.normalized().alpha 0.4
- normalized()[source]¶
Return a normalized copy whose four weights sum to one.
- Return type:
- Returns:
New
PreferenceWeightswhose components are scaled soalpha + beta + gamma + delta == 1.0. If all weights are zero, returns equal weights (0.25 each) to avoid a division-by-zero downstream.
Examples
>>> from agent_urban_planning.core.agents import PreferenceWeights >>> PreferenceWeights(1.0, 1.0, 1.0, 1.0).normalized().alpha 0.25