june.policy.leisure_policies.ChangeLeisureProbability¶
-
class
june.policy.leisure_policies.
ChangeLeisureProbability
(start_time: str, end_time: str, leisure_activities_probabilities: Dict[str, Dict[str, Dict[str, float]]]) Changes the probability of the specified leisure activities.
start_time : starting time of the policy.
end_time : end time of the policy.
- leisure_activities_probabilitiesdictionary where the first key is an age range, and the second a
number with the new probability for the activity in that age. Example: * leisure_activities_probabilities = {“pubs” : {“men” :{“0-50” : 0.5, “50-99” : 0.2}, “women” : {“0-70” : 0.2, “71-99” : 0.8}}}
-
__init__
(start_time: str, end_time: str, leisure_activities_probabilities: Dict[str, Dict[str, Dict[str, float]]]) Changes the probability of the specified leisure activities.
start_time : starting time of the policy.
end_time : end time of the policy.
- leisure_activities_probabilitiesdictionary where the first key is an age range, and the second a
number with the new probability for the activity in that age. Example: * leisure_activities_probabilities = {“pubs” : {“men” :{“0-50” : 0.5, “50-99” : 0.2}, “women” : {“0-70” : 0.2, “71-99” : 0.8}}}
-
apply
(leisure: june.groups.leisure.leisure.Leisure) Changes probabilities of doing leisure activities according to the policies specified. The current probabilities are stored in the policies, and restored at the end of the policy time span. Keep this in mind when trying to stack policies that modify the same social venue.
-
get_spec
() → str Returns the speciailization of the policy.
-
is_active
(date: datetime.datetime) → bool Returns true if the policy is active, false otherwise
- date:
date to check
-
static
read_date
(date: Union[str, datetime.datetime]) → datetime.datetime Read date in two possible formats, either string or datetime.date, both are translated into datetime.datetime to be used by the simulator
- date:
date to translate into datetime.datetime
date in datetime format
-
_abc_impl
= <_abc_data object>