aivika-transformers-2.1: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Simulation.Aivika.Trans.Agent

Description

Tested with: GHC 7.8.3

This module introduces basic entities for the agent-based modeling.

Synopsis

Documentation

data Agent m Source

Represents an agent.

Instances

MonadComp m => Eq (Agent m) 

data AgentState m Source

Represents the agent state.

Instances

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.