Copyright | Copyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Tested with: GHC 7.8.3
This module introduces basic entities for the agent-based modeling.
- data Agent m
- data AgentState m
- newAgent :: MonadComp m => Simulation m (Agent m)
- newState :: MonadComp m => Agent m -> Simulation m (AgentState m)
- newSubstate :: MonadComp m => AgentState m -> Simulation m (AgentState m)
- selectedState :: MonadComp m => Agent m -> Event m (Maybe (AgentState m))
- selectedStateChanged :: Agent m -> Signal m (Maybe (AgentState m))
- selectedStateChanged_ :: MonadComp m => Agent m -> Signal m ()
- selectState :: MonadComp m => AgentState m -> Event m ()
- stateAgent :: AgentState m -> Agent m
- stateParent :: AgentState m -> Maybe (AgentState m)
- addTimeout :: MonadComp m => AgentState m -> Double -> Event m () -> Event m ()
- addTimer :: MonadComp m => AgentState m -> Event m Double -> Event m () -> Event m ()
- setStateActivation :: MonadComp m => AgentState m -> Event m () -> Simulation m ()
- setStateDeactivation :: MonadComp m => AgentState m -> Event m () -> Simulation m ()
- setStateTransition :: MonadComp m => AgentState m -> Event m (Maybe (AgentState m)) -> Simulation m ()
Documentation
newAgent :: MonadComp m => Simulation m (Agent m) Source
Create an agent.
newState :: MonadComp m => Agent m -> Simulation m (AgentState m) Source
Create a new state.
newSubstate :: MonadComp m => AgentState m -> Simulation m (AgentState m) Source
Create a child state.
selectedState :: MonadComp m => Agent m -> Event m (Maybe (AgentState m)) Source
Return the selected active state.
selectedStateChanged :: Agent m -> Signal m (Maybe (AgentState m)) Source
Return a signal that notifies about every change of the selected state.
selectedStateChanged_ :: MonadComp m => Agent m -> Signal m () Source
Return a signal that notifies about every change of the selected state.
selectState :: MonadComp m => AgentState m -> Event m () Source
Select the state. The activation and selection are repeated while
there is the transition state defined by setStateTransition
.
stateAgent :: AgentState m -> Agent m Source
Return the corresponded agent.
stateParent :: AgentState m -> Maybe (AgentState m) Source
Return the parent state or Nothing
.
addTimeout :: MonadComp m => AgentState m -> Double -> Event m () -> Event m () Source
Add to the state a timeout handler that will be actuated in the specified time period if the state will remain active.
addTimer :: MonadComp m => AgentState m -> Event m Double -> Event m () -> Event m () 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.
setStateActivation :: MonadComp m => AgentState m -> Event m () -> Simulation m () Source
Set the activation computation for the specified state.
setStateDeactivation :: MonadComp m => AgentState m -> Event m () -> Simulation m () Source
Set the deactivation computation for the specified state.
setStateTransition :: MonadComp m => AgentState m -> Event m (Maybe (AgentState m)) -> Simulation m () Source
Set the transition state which will be next and which is used only
when selecting the state directly with help of selectState
.
If the state was activated intermediately, when selecting
another state, then this computation is not used.