module Simulation.Aivika.Trans.Operation.Random
(newRandomUniformOperation,
newRandomUniformIntOperation,
newRandomTriangularOperation,
newRandomNormalOperation,
newRandomLogNormalOperation,
newRandomExponentialOperation,
newRandomErlangOperation,
newRandomPoissonOperation,
newRandomBinomialOperation,
newRandomGammaOperation,
newRandomBetaOperation,
newRandomWeibullOperation,
newRandomDiscreteOperation,
newPreemptibleRandomUniformOperation,
newPreemptibleRandomUniformIntOperation,
newPreemptibleRandomTriangularOperation,
newPreemptibleRandomNormalOperation,
newPreemptibleRandomLogNormalOperation,
newPreemptibleRandomExponentialOperation,
newPreemptibleRandomErlangOperation,
newPreemptibleRandomPoissonOperation,
newPreemptibleRandomBinomialOperation,
newPreemptibleRandomGammaOperation,
newPreemptibleRandomBetaOperation,
newPreemptibleRandomWeibullOperation,
newPreemptibleRandomDiscreteOperation) where
import Simulation.Aivika.Trans.DES
import Simulation.Aivika.Trans.Generator
import Simulation.Aivika.Trans.Event
import Simulation.Aivika.Trans.Process
import Simulation.Aivika.Trans.Process.Random
import Simulation.Aivika.Trans.Operation
newRandomUniformOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomUniformOperation #-}
newRandomUniformOperation :: Double -> Double -> Event m (Operation m a a)
newRandomUniformOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomUniformOperation Bool
False
newRandomUniformIntOperation :: MonadDES m
=> Int
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newRandomUniformIntOperation #-}
newRandomUniformIntOperation :: Int -> Int -> Event m (Operation m a a)
newRandomUniformIntOperation =
Bool -> Int -> Int -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Int -> Int -> Event m (Operation m a a)
newPreemptibleRandomUniformIntOperation Bool
False
newRandomTriangularOperation :: MonadDES m
=> Double
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomTriangularOperation #-}
newRandomTriangularOperation :: Double -> Double -> Double -> Event m (Operation m a a)
newRandomTriangularOperation =
Bool -> Double -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomTriangularOperation Bool
False
newRandomNormalOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomNormalOperation #-}
newRandomNormalOperation :: Double -> Double -> Event m (Operation m a a)
newRandomNormalOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomNormalOperation Bool
False
newRandomLogNormalOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomLogNormalOperation #-}
newRandomLogNormalOperation :: Double -> Double -> Event m (Operation m a a)
newRandomLogNormalOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomLogNormalOperation Bool
False
newRandomExponentialOperation :: MonadDES m
=> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomExponentialOperation #-}
newRandomExponentialOperation :: Double -> Event m (Operation m a a)
newRandomExponentialOperation =
Bool -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Event m (Operation m a a)
newPreemptibleRandomExponentialOperation Bool
False
newRandomErlangOperation :: MonadDES m
=> Double
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newRandomErlangOperation #-}
newRandomErlangOperation :: Double -> Int -> Event m (Operation m a a)
newRandomErlangOperation =
Bool -> Double -> Int -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Int -> Event m (Operation m a a)
newPreemptibleRandomErlangOperation Bool
False
newRandomPoissonOperation :: MonadDES m
=> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomPoissonOperation #-}
newRandomPoissonOperation :: Double -> Event m (Operation m a a)
newRandomPoissonOperation =
Bool -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Event m (Operation m a a)
newPreemptibleRandomPoissonOperation Bool
False
newRandomBinomialOperation :: MonadDES m
=> Double
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newRandomBinomialOperation #-}
newRandomBinomialOperation :: Double -> Int -> Event m (Operation m a a)
newRandomBinomialOperation =
Bool -> Double -> Int -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Int -> Event m (Operation m a a)
newPreemptibleRandomBinomialOperation Bool
False
newRandomGammaOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomGammaOperation #-}
newRandomGammaOperation :: Double -> Double -> Event m (Operation m a a)
newRandomGammaOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomGammaOperation Bool
False
newRandomBetaOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomBetaOperation #-}
newRandomBetaOperation :: Double -> Double -> Event m (Operation m a a)
newRandomBetaOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomBetaOperation Bool
False
newRandomWeibullOperation :: MonadDES m
=> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomWeibullOperation #-}
newRandomWeibullOperation :: Double -> Double -> Event m (Operation m a a)
newRandomWeibullOperation =
Bool -> Double -> Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomWeibullOperation Bool
False
newRandomDiscreteOperation :: MonadDES m
=> DiscretePDF Double
-> Event m (Operation m a a)
{-# INLINABLE newRandomDiscreteOperation #-}
newRandomDiscreteOperation :: DiscretePDF Double -> Event m (Operation m a a)
newRandomDiscreteOperation =
Bool -> DiscretePDF Double -> Event m (Operation m a a)
forall (m :: * -> *) a.
MonadDES m =>
Bool -> DiscretePDF Double -> Event m (Operation m a a)
newPreemptibleRandomDiscreteOperation Bool
False
newPreemptibleRandomUniformOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomUniformOperation #-}
newPreemptibleRandomUniformOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomUniformOperation Bool
preemptible Double
min Double
max =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomUniformProcess_ Double
min Double
max
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomUniformIntOperation :: MonadDES m
=> Bool
-> Int
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomUniformIntOperation #-}
newPreemptibleRandomUniformIntOperation :: Bool -> Int -> Int -> Event m (Operation m a a)
newPreemptibleRandomUniformIntOperation Bool
preemptible Int
min Int
max =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Int -> Int -> Process m ()
forall (m :: * -> *). MonadDES m => Int -> Int -> Process m ()
randomUniformIntProcess_ Int
min Int
max
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomTriangularOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomTriangularOperation #-}
newPreemptibleRandomTriangularOperation :: Bool -> Double -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomTriangularOperation Bool
preemptible Double
min Double
median Double
max =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Double -> Process m ()
randomTriangularProcess_ Double
min Double
median Double
max
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomNormalOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomNormalOperation #-}
newPreemptibleRandomNormalOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomNormalOperation Bool
preemptible Double
mu Double
nu =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomNormalProcess_ Double
mu Double
nu
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomLogNormalOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomLogNormalOperation #-}
newPreemptibleRandomLogNormalOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomLogNormalOperation Bool
preemptible Double
mu Double
nu =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomLogNormalProcess_ Double
mu Double
nu
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomExponentialOperation :: MonadDES m
=> Bool
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomExponentialOperation #-}
newPreemptibleRandomExponentialOperation :: Bool -> Double -> Event m (Operation m a a)
newPreemptibleRandomExponentialOperation Bool
preemptible Double
mu =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
randomExponentialProcess_ Double
mu
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomErlangOperation :: MonadDES m
=> Bool
-> Double
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomErlangOperation #-}
newPreemptibleRandomErlangOperation :: Bool -> Double -> Int -> Event m (Operation m a a)
newPreemptibleRandomErlangOperation Bool
preemptible Double
beta Int
m =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Int -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Int -> Process m ()
randomErlangProcess_ Double
beta Int
m
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomPoissonOperation :: MonadDES m
=> Bool
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomPoissonOperation #-}
newPreemptibleRandomPoissonOperation :: Bool -> Double -> Event m (Operation m a a)
newPreemptibleRandomPoissonOperation Bool
preemptible Double
mu =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
randomPoissonProcess_ Double
mu
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomBinomialOperation :: MonadDES m
=> Bool
-> Double
-> Int
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomBinomialOperation #-}
newPreemptibleRandomBinomialOperation :: Bool -> Double -> Int -> Event m (Operation m a a)
newPreemptibleRandomBinomialOperation Bool
preemptible Double
prob Int
trials =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Int -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Int -> Process m ()
randomBinomialProcess_ Double
prob Int
trials
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomGammaOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomGammaOperation #-}
newPreemptibleRandomGammaOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomGammaOperation Bool
preemptible Double
kappa Double
theta =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomGammaProcess_ Double
kappa Double
theta
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomBetaOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomBetaOperation #-}
newPreemptibleRandomBetaOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomBetaOperation Bool
preemptible Double
alpha Double
beta =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomBetaProcess_ Double
alpha Double
beta
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomWeibullOperation :: MonadDES m
=> Bool
-> Double
-> Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomWeibullOperation #-}
newPreemptibleRandomWeibullOperation :: Bool -> Double -> Double -> Event m (Operation m a a)
newPreemptibleRandomWeibullOperation Bool
preemptible Double
alpha Double
beta =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do Double -> Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Process m ()
randomWeibullProcess_ Double
alpha Double
beta
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
newPreemptibleRandomDiscreteOperation :: MonadDES m
=> Bool
-> DiscretePDF Double
-> Event m (Operation m a a)
{-# INLINABLE newPreemptibleRandomDiscreteOperation #-}
newPreemptibleRandomDiscreteOperation :: Bool -> DiscretePDF Double -> Event m (Operation m a a)
newPreemptibleRandomDiscreteOperation Bool
preemptible DiscretePDF Double
dpdf =
Bool -> (a -> Process m a) -> Event m (Operation m a a)
forall (m :: * -> *) a b.
MonadDES m =>
Bool -> (a -> Process m b) -> Event m (Operation m a b)
newPreemptibleOperation Bool
preemptible ((a -> Process m a) -> Event m (Operation m a a))
-> (a -> Process m a) -> Event m (Operation m a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
do DiscretePDF Double -> Process m ()
forall (m :: * -> *).
MonadDES m =>
DiscretePDF Double -> Process m ()
randomDiscreteProcess_ DiscretePDF Double
dpdf
a -> Process m a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a