module Simulation.Aivika.Trans.Process.Random
(randomUniformProcess,
randomUniformProcess_,
randomUniformIntProcess,
randomUniformIntProcess_,
randomTriangularProcess,
randomTriangularProcess_,
randomNormalProcess,
randomNormalProcess_,
randomLogNormalProcess,
randomLogNormalProcess_,
randomExponentialProcess,
randomExponentialProcess_,
randomErlangProcess,
randomErlangProcess_,
randomPoissonProcess,
randomPoissonProcess_,
randomBinomialProcess,
randomBinomialProcess_,
randomGammaProcess,
randomGammaProcess_,
randomBetaProcess,
randomBetaProcess_,
randomWeibullProcess,
randomWeibullProcess_,
randomDiscreteProcess,
randomDiscreteProcess_) where
import Control.Monad
import Control.Monad.Trans
import Simulation.Aivika.Trans.DES
import Simulation.Aivika.Trans.Generator
import Simulation.Aivika.Trans.Parameter
import Simulation.Aivika.Trans.Parameter.Random
import Simulation.Aivika.Trans.Process
randomUniformProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomUniformProcess #-}
randomUniformProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomUniformProcess Double
min Double
max =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomUniform Double
min Double
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomUniformProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomUniformProcess_ #-}
randomUniformProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomUniformProcess_ Double
min Double
max =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomUniform Double
min Double
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomUniformIntProcess :: MonadDES m
=> Int
-> Int
-> Process m Int
{-# INLINABLE randomUniformIntProcess #-}
randomUniformIntProcess :: forall (m :: * -> *). MonadDES m => Int -> Int -> Process m Int
randomUniformIntProcess Int
min Int
max =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Int -> Int -> Parameter m Int
randomUniformInt Int
min Int
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomUniformIntProcess_ :: MonadDES m
=> Int
-> Int
-> Process m ()
{-# INLINABLE randomUniformIntProcess_ #-}
randomUniformIntProcess_ :: forall (m :: * -> *). MonadDES m => Int -> Int -> Process m ()
randomUniformIntProcess_ Int
min Int
max =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Int -> Int -> Parameter m Int
randomUniformInt Int
min Int
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomTriangularProcess :: MonadDES m
=> Double
-> Double
-> Double
-> Process m Double
{-# INLINABLE randomTriangularProcess #-}
randomTriangularProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Double -> Process m Double
randomTriangularProcess Double
min Double
median Double
max =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Double -> Parameter m Double
randomTriangular Double
min Double
median Double
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomTriangularProcess_ :: MonadDES m
=> Double
-> Double
-> Double
-> Process m ()
{-# INLINABLE randomTriangularProcess_ #-}
randomTriangularProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Double -> Process m ()
randomTriangularProcess_ Double
min Double
median Double
max =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Double -> Parameter m Double
randomTriangular Double
min Double
median Double
max
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomNormalProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomNormalProcess #-}
randomNormalProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomNormalProcess Double
mu Double
nu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomNormal Double
mu Double
nu
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
t forall a. Ord a => a -> a -> Bool
> Double
0) forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomNormalProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomNormalProcess_ #-}
randomNormalProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomNormalProcess_ Double
mu Double
nu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomNormal Double
mu Double
nu
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
t forall a. Ord a => a -> a -> Bool
> Double
0) forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomLogNormalProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomLogNormalProcess #-}
randomLogNormalProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomLogNormalProcess Double
mu Double
nu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomLogNormal Double
mu Double
nu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomLogNormalProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomLogNormalProcess_ #-}
randomLogNormalProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomLogNormalProcess_ Double
mu Double
nu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomLogNormal Double
mu Double
nu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomExponentialProcess :: MonadDES m
=> Double
-> Process m Double
{-# INLINABLE randomExponentialProcess #-}
randomExponentialProcess :: forall (m :: * -> *). MonadDES m => Double -> Process m Double
randomExponentialProcess Double
mu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Double -> Parameter m Double
randomExponential Double
mu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomExponentialProcess_ :: MonadDES m
=> Double
-> Process m ()
{-# INLINABLE randomExponentialProcess_ #-}
randomExponentialProcess_ :: forall (m :: * -> *). MonadDES m => Double -> Process m ()
randomExponentialProcess_ Double
mu =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Double -> Parameter m Double
randomExponential Double
mu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomErlangProcess :: MonadDES m
=> Double
-> Int
-> Process m Double
{-# INLINABLE randomErlangProcess #-}
randomErlangProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Int -> Process m Double
randomErlangProcess Double
beta Int
m =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Double
randomErlang Double
beta Int
m
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomErlangProcess_ :: MonadDES m
=> Double
-> Int
-> Process m ()
{-# INLINABLE randomErlangProcess_ #-}
randomErlangProcess_ :: forall (m :: * -> *). MonadDES m => Double -> Int -> Process m ()
randomErlangProcess_ Double
beta Int
m =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Double
randomErlang Double
beta Int
m
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomPoissonProcess :: MonadDES m
=> Double
-> Process m Int
{-# INLINABLE randomPoissonProcess #-}
randomPoissonProcess :: forall (m :: * -> *). MonadDES m => Double -> Process m Int
randomPoissonProcess Double
mu =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Double -> Parameter m Int
randomPoisson Double
mu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomPoissonProcess_ :: MonadDES m
=> Double
-> Process m ()
{-# INLINABLE randomPoissonProcess_ #-}
randomPoissonProcess_ :: forall (m :: * -> *). MonadDES m => Double -> Process m ()
randomPoissonProcess_ Double
mu =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). MonadComp m => Double -> Parameter m Int
randomPoisson Double
mu
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomBinomialProcess :: MonadDES m
=> Double
-> Int
-> Process m Int
{-# INLINABLE randomBinomialProcess #-}
randomBinomialProcess :: forall (m :: * -> *). MonadDES m => Double -> Int -> Process m Int
randomBinomialProcess Double
prob Int
trials =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Int
randomBinomial Double
prob Int
trials
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomBinomialProcess_ :: MonadDES m
=>Double
-> Int
-> Process m ()
{-# INLINABLE randomBinomialProcess_ #-}
randomBinomialProcess_ :: forall (m :: * -> *). MonadDES m => Double -> Int -> Process m ()
randomBinomialProcess_ Double
prob Int
trials =
do Int
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Int
randomBinomial Double
prob Int
trials
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomGammaProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomGammaProcess #-}
randomGammaProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomGammaProcess Double
kappa Double
theta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomGamma Double
kappa Double
theta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomGammaProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomGammaProcess_ #-}
randomGammaProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomGammaProcess_ Double
kappa Double
theta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomGamma Double
kappa Double
theta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomBetaProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomBetaProcess #-}
randomBetaProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomBetaProcess Double
alpha Double
beta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomBeta Double
alpha Double
beta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomBetaProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomBetaProcess_ #-}
randomBetaProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomBetaProcess_ Double
alpha Double
beta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomBeta Double
alpha Double
beta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomWeibullProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomWeibullProcess #-}
randomWeibullProcess :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m Double
randomWeibullProcess Double
alpha Double
beta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomWeibull Double
alpha Double
beta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomWeibullProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomWeibullProcess_ #-}
randomWeibullProcess_ :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomWeibullProcess_ Double
alpha Double
beta =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomWeibull Double
alpha Double
beta
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomDiscreteProcess :: MonadDES m
=> DiscretePDF Double
-> Process m Double
{-# INLINABLE randomDiscreteProcess #-}
randomDiscreteProcess :: forall (m :: * -> *).
MonadDES m =>
DiscretePDF Double -> Process m Double
randomDiscreteProcess DiscretePDF Double
dpdf =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
MonadComp m =>
DiscretePDF a -> Parameter m a
randomDiscrete DiscretePDF Double
dpdf
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomDiscreteProcess_ :: MonadDES m
=> DiscretePDF Double
-> Process m ()
{-# INLINABLE randomDiscreteProcess_ #-}
randomDiscreteProcess_ :: forall (m :: * -> *).
MonadDES m =>
DiscretePDF Double -> Process m ()
randomDiscreteProcess_ DiscretePDF Double
dpdf =
do Double
t <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
MonadComp m =>
DiscretePDF a -> Parameter m a
randomDiscrete DiscretePDF Double
dpdf
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t