aivika-transformers-5.9.1: Transformers for the Aivika simulation library
CopyrightCopyright (c) 2009-2017 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 8.0.1

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

Synopsis

Documentation

data Agent m Source #

Represents an agent.

Instances

Instances details
MonadDES m => Eq (Agent m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Agent

Methods

(==) :: Agent m -> Agent m -> Bool #

(/=) :: Agent m -> Agent m -> Bool #

data AgentState m Source #

Represents the agent state.

Instances

Instances details
MonadDES m => Eq (AgentState m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Agent

Methods

(==) :: AgentState m -> AgentState m -> Bool #

(/=) :: AgentState m -> AgentState m -> Bool #

newAgent :: MonadDES m => Simulation m (Agent m) Source #

Create an agent.

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.