| Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
|---|---|
| License | BSD3 |
| Maintainer | David Sorokin <david.sorokin@gmail.com> |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Simulation.Aivika.Trans.Agent
Description
Tested with: GHC 8.0.1
This module introduces basic entities for the agent-based modeling.
- data Agent m
- data AgentState m
- newAgent :: MonadDES m => Simulation m (Agent m)
- newState :: MonadDES m => Agent m -> Simulation m (AgentState m)
- newSubstate :: MonadDES m => AgentState m -> Simulation m (AgentState m)
- selectedState :: MonadDES m => Agent m -> Event m (Maybe (AgentState m))
- selectedStateChanged :: Agent m -> Signal m (Maybe (AgentState m))
- selectedStateChanged_ :: MonadDES m => Agent m -> Signal m ()
- selectState :: MonadDES m => AgentState m -> Event m ()
- stateAgent :: AgentState m -> Agent m
- stateParent :: AgentState m -> Maybe (AgentState m)
- addTimeout :: MonadDES m => AgentState m -> Double -> Event m () -> Event m ()
- addTimer :: MonadDES m => AgentState m -> Event m Double -> Event m () -> Event m ()
- setStateActivation :: MonadDES m => AgentState m -> Event m () -> Event m ()
- setStateDeactivation :: MonadDES m => AgentState m -> Event m () -> Event m ()
- setStateTransition :: MonadDES m => AgentState m -> Event m (Maybe (AgentState m)) -> Event m ()
Documentation
data AgentState m Source #
Represents the agent state.
Instances
| MonadDES m => Eq (AgentState m) Source # | |
newState :: MonadDES m => Agent m -> Simulation m (AgentState m) Source #
Create a new state.
newSubstate :: MonadDES m => AgentState m -> Simulation m (AgentState m) Source #
Create a child state.
selectedState :: MonadDES 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_ :: MonadDES m => Agent m -> Signal m () Source #
Return a signal that notifies about every change of the selected state.
selectState :: MonadDES 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 :: MonadDES 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 :: MonadDES 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 :: MonadDES m => AgentState m -> Event m () -> Event m () Source #
Set the activation computation for the specified state.
setStateDeactivation :: MonadDES m => AgentState m -> Event m () -> Event m () Source #
Set the deactivation computation for the specified state.
setStateTransition :: MonadDES m => AgentState m -> Event m (Maybe (AgentState m)) -> Event 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.