aivika-lattice-0.6: Nested discrete event simulation module for the Aivika library using lattice

CopyrightCopyright (c) 2016-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Simulation.Aivika.Lattice.LIO

Contents

Description

Tested with: GHC 7.10.3

This module defines LIO as an instance of the MonadDES and EventIOQueueing type classes.

Synopsis

Documentation

data LIO a Source #

The LIO computation that can be run as nested one on the lattice node.

Instances

Monad LIO Source # 

Methods

(>>=) :: LIO a -> (a -> LIO b) -> LIO b #

(>>) :: LIO a -> LIO b -> LIO b #

return :: a -> LIO a #

fail :: String -> LIO a #

Functor LIO Source # 

Methods

fmap :: (a -> b) -> LIO a -> LIO b #

(<$) :: a -> LIO b -> LIO a #

MonadFix LIO Source # 

Methods

mfix :: (a -> LIO a) -> LIO a #

Applicative LIO Source # 

Methods

pure :: a -> LIO a #

(<*>) :: LIO (a -> b) -> LIO a -> LIO b #

(*>) :: LIO a -> LIO b -> LIO b #

(<*) :: LIO a -> LIO b -> LIO a #

MonadException LIO Source # 

Methods

catchComp :: Exception e => LIO a -> (e -> LIO a) -> LIO a #

finallyComp :: LIO a -> LIO b -> LIO a #

throwComp :: Exception e => e -> LIO a #

MonadIO LIO Source # 

Methods

liftIO :: IO a -> LIO a #

data Ref LIO # 
data Ref LIO = Ref {}
data Ref LIO # 
data Ref LIO = Ref {}
data EventQueue LIO # 
data Generator LIO # 
data StrategyQueue LIO FCFS # 
data StrategyQueue LIO LCFS # 

data LIOLattice Source #

Specifies the lattice.

lattice Source #

Arguments

:: Int

the lattice size

-> (Int -> Int -> Int)

get the parent member index by the specified time and member indices

-> LIOLattice 

Return a lattice by the specifed size and the parent member function.

newRandomLattice :: Int -> IO LIOLattice Source #

Create a new random lattice by the specified size with equal probabilities, whether the interior child node derives from the left or right parents.

newRandomLatticeWithProb :: Double -> Int -> IO LIOLattice Source #

Create a new random lattice by the specified probability and size, where the probabilty defines whether the interior child node derives from the right parent.

runLIO :: LIOLattice -> LIO a -> IO a Source #

Run the LIO computation using the specified lattice.

latticeTimeIndex :: LIO Int Source #

Return the lattice time index starting from 0. The index should be less than or equaled to latticeSize.

latticeMemberIndex :: LIO Int Source #

Return the lattice member index starting from 0. It is always less than or equaled to latticeTimeIndex.

latticeParentMemberIndex :: LIO (Maybe Int) Source #

Return the parent member index starting from 0 for non-root lattice nodes.

latticeSize :: LIO Int Source #

Return the lattice size.

latticeTime :: Parameter LIO Double Source #

Return the time for the current lattice node.

latticeTimes :: Parameter LIO [Double] Source #

Return the time values in the lattice nodes.

latticeTimeStep :: Parameter LIO Double Source #

Return the lattice time step.

findLatticeTimeIndex :: Double -> Parameter LIO Int Source #

Find the lattice time index by the specified modeling time.

enqueueEventWithLatticeTimes :: Event LIO () -> Event LIO () Source #

Actuate the event handler in the lattice node time points.

Orphan instances

EventIOQueueing LIO Source #

An implementation of the EventIOQueueing type class.

Methods

enqueueEventIO :: Double -> Event LIO () -> Event LIO () #

MonadDES LIO Source # 
MonadComp LIO Source #