Stability | experimental |
---|---|
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Safe Haskell | Safe-Inferred |
Tested with: GHC 7.6.3
This module introduces basic entities for the agent-based modeling.
WARNING: the module is not well tested. This caution is related mainly to managing the nested states.
At the same time, the timer and timeout handlers seem to be well tested as they are just light-weight wrappers creating the event handlers that are already processed by the event queue.
- data Agent
- data AgentState
- newAgent :: EventQueue -> Simulation Agent
- newState :: Agent -> Simulation AgentState
- newSubstate :: AgentState -> Simulation AgentState
- agentQueue :: Agent -> EventQueue
- agentState :: Agent -> Dynamics (Maybe AgentState)
- agentStateChanged :: Agent -> Signal (Maybe AgentState)
- agentStateChanged_ :: Agent -> Signal ()
- activateState :: AgentState -> Dynamics ()
- initState :: AgentState -> Dynamics ()
- stateAgent :: AgentState -> Agent
- stateParent :: AgentState -> Maybe AgentState
- addTimeout :: AgentState -> Double -> Dynamics () -> Dynamics ()
- addTimer :: AgentState -> Dynamics Double -> Dynamics () -> Dynamics ()
- stateActivation :: AgentState -> Dynamics () -> Simulation ()
- stateDeactivation :: AgentState -> Dynamics () -> Simulation ()
- setStateActivation :: AgentState -> Dynamics () -> Simulation ()
- setStateDeactivation :: AgentState -> Dynamics () -> Simulation ()
- setStateTransition :: AgentState -> Dynamics (Maybe AgentState) -> Simulation ()
Documentation
newAgent :: EventQueue -> Simulation AgentSource
Create an agent bound with the specified event queue.
newState :: Agent -> Simulation AgentStateSource
Create a new state.
newSubstate :: AgentState -> Simulation AgentStateSource
Create a child state.
agentQueue :: Agent -> EventQueueSource
Return the bound event queue.
agentState :: Agent -> Dynamics (Maybe AgentState)Source
Return the selected downmost active state.
agentStateChanged :: Agent -> Signal (Maybe AgentState)Source
Return a signal that notifies about every change of the state.
agentStateChanged_ :: Agent -> Signal ()Source
Return a signal that notifies about every change of the state.
activateState :: AgentState -> Dynamics ()Source
Select the next downmost active state. The activation is repeated while
there is the transition state defined by setStateTransition
.
initState :: AgentState -> Dynamics ()Source
Deprecated: Rewrite using the setStateTransition function instead.
Activate the child state during the direct activation of the parent state. This call is ignored in other cases.
stateAgent :: AgentState -> AgentSource
Return the corresponded agent.
stateParent :: AgentState -> Maybe AgentStateSource
Return the parent state or Nothing
.
addTimeout :: AgentState -> Double -> Dynamics () -> Dynamics ()Source
Add to the state a timeout handler that will be actuated in the specified time period, while the state remains active.
addTimer :: AgentState -> Dynamics Double -> Dynamics () -> Dynamics ()Source
Add to the state a timer handler that will be actuated in the specified time period and then repeated again many times, while the state remains active.
stateActivation :: AgentState -> Dynamics () -> Simulation ()Source
Deprecated: Use the setStateActivation function instead
Set the activation computation for the specified state.
stateDeactivation :: AgentState -> Dynamics () -> Simulation ()Source
Deprecated: Use the setStateDeactivation function instead
Set the deactivation computation for the specified state.
setStateActivation :: AgentState -> Dynamics () -> Simulation ()Source
Set the activation computation for the specified state.
setStateDeactivation :: AgentState -> Dynamics () -> Simulation ()Source
Set the deactivation computation for the specified state.
setStateTransition :: AgentState -> Dynamics (Maybe AgentState) -> Simulation ()Source
Set the transition state which will be next and which is used only
when activating the state directly with help of activateState
.
If the state was activated intermediately, when activating directly
another state, then this computation is not used.