Package io.github.ai4ci.abm.mechanics
Interface State<BUILDER,HISTORY,STATE,X extends State<BUILDER,HISTORY,STATE,X>>
- Type Parameters:
BUILDER
- builder of either outbreak state (policy) or person state (behaviour).HISTORY
- builder of either outbreak history (policy) or person history (behaviour).STATE
- the current state of the entity (e.g. OutbreakState (policy) or behaviour state)X
- the super-type of allowable state models.
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
BehaviourModel
,PolicyModel
,StateMachine.BehaviourState
,StateMachine.PolicyState
,StateUtils.DefaultNoTesting
,StateUtils.DoesPCRIfSymptomatic
- All Known Implementing Classes:
LockdownIsolation
,NoControl
,NonCompliant
,ReactiveLockdown
,ReactiveTestAndIsolate
,SmartAgentLFTTesting
,SmartAgentTesting
,Test
public interface State<BUILDER,HISTORY,STATE,X extends State<BUILDER,HISTORY,STATE,X>>
extends Serializable
This abstraction lets us have policy and behaviour models sharing the same
state model framework, so outbreak and person updates can follow the same
pattern. This is the supertype for StateMachine.PolicyState and
StateMachine.BehaviourState.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
filter
(STATE person, StateMachineContext context, Sampler rng) default String
getName()
name()
nextState
(BUILDER builder, STATE current, StateMachineContext context, Sampler rng) This is the hook for changing the behaviour in the model in terms of mobility, compliance etc in person/behavioural models, or changing system wide properties in outbreak/policy models.void
updateHistory
(HISTORY builder, STATE current, StateMachineContext context, Sampler rng) Depending on the type this updated the outbreak or person history, and this is the hook for changing the testing, or adding in contacts / exposures if we are looking at people.
-
Method Details
-
filter
-
updateHistory
Depending on the type this updated the outbreak or person history, and this is the hook for changing the testing, or adding in contacts / exposures if we are looking at people. Use case is less clear for outbreak/policy, as there is less stored here. The implementation for outbreak (PolicyModel) makes this a no-op. This is called during the history stage of the update cycle.- Parameters:
builder
- the next PersonHistory builder (usually)current
- the current PersonHistoryrng
- the sampler
-
nextState
This is the hook for changing the behaviour in the model in terms of mobility, compliance etc in person/behavioural models, or changing system wide properties in outbreak/policy models. The implementation of the next state in policy models also can influence PersonState but should do so using StateUtils.branchPeopleTo which will force a change in individuals behaviour models. or iterating through the agents and calling ps.getStateMachine().forceTo(behaviour) on each of them; Other changes are possible by interacting with ps.getNextState (the next person state builder) but changes here may be changed back if dictated by the person's behaviour state so less reliable that creating a behaviour that updates the persons state in response to a policy state. This is done this way so that the behaviour state of an agent is pushed to a stack when behaviour is forced and allow it to revert after- Parameters:
builder
- the next PersonState builder.
-
name
String name() -
getName
-
getEnumClass
-