Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 8.0.1
This module introduces basic entities for the agent-based modeling.
Synopsis
- data Agent
- data AgentState
- newAgent :: Simulation Agent
- newState :: Agent -> Simulation AgentState
- newSubstate :: AgentState -> Simulation AgentState
- selectedState :: Agent -> Event (Maybe AgentState)
- selectedStateChanged :: Agent -> Signal (Maybe AgentState)
- selectedStateChanged_ :: Agent -> Signal ()
- selectState :: AgentState -> Event ()
- stateAgent :: AgentState -> Agent
- stateParent :: AgentState -> Maybe AgentState
- addTimeout :: AgentState -> Double -> Event () -> Event ()
- addTimer :: AgentState -> Event Double -> Event () -> Event ()
- setStateActivation :: AgentState -> Event () -> Event ()
- setStateDeactivation :: AgentState -> Event () -> Event ()
- setStateTransition :: AgentState -> Event (Maybe AgentState) -> Event ()
Documentation
Represents an agent.
data AgentState Source #
Represents the agent state.
Instances
Eq AgentState Source # | |
Defined in Simulation.Aivika.Agent (==) :: AgentState -> AgentState -> Bool # (/=) :: AgentState -> AgentState -> Bool # |
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.