aivika-5.3.1: A multi-method 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.Agent

Description

Tested with: GHC 8.0.1

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

Synopsis

Documentation

data Agent Source #

Represents an agent.

Instances

Eq Agent Source # 

Methods

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

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

data AgentState Source #

Represents the agent state.

newAgent :: Simulation Agent Source #

Create an agent.

newState :: Agent -> Simulation AgentState Source #

Create a new state.

newSubstate :: AgentState -> Simulation AgentState Source #

Create a child state.

selectedState :: Agent -> Event (Maybe AgentState) Source #

Return the selected active state.

selectedStateChanged :: Agent -> Signal (Maybe AgentState) Source #

Return a signal that notifies about every change of the selected state.

selectedStateChanged_ :: Agent -> Signal () Source #

Return a signal that notifies about every change of the selected state.

selectState :: AgentState -> Event () Source #

Select the state. The activation and selection are repeated while there is the transition state defined by setStateTransition.

stateAgent :: AgentState -> Agent Source #

Return the corresponded agent.

stateParent :: AgentState -> Maybe AgentState Source #

Return the parent state or Nothing.

addTimeout :: AgentState -> Double -> Event () -> Event () Source #

Add to the state a timeout handler that will be actuated in the specified time period if the state will remain active.

addTimer :: AgentState -> Event Double -> Event () -> Event () 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 :: AgentState -> Event () -> Event () Source #

Set the activation computation for the specified state.

setStateDeactivation :: AgentState -> Event () -> Event () Source #

Set the deactivation computation for the specified state.

setStateTransition :: AgentState -> Event (Maybe AgentState) -> Event () 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.