aivika-transformers-5.8: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Simulation.Aivika.Trans.Statistics

Contents

Description

Tested with: GHC 8.0.1

Represents statistics.

Synopsis

Simple Statistics

data SamplingStats a #

Describes when the statistics consists of only samples not bound to the simulation time.

Constructors

SamplingStats 

Fields

Instances
Eq a => Eq (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Show a => Show (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Generic (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (SamplingStats a) :: * -> * #

SamplingData a => Semigroup (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

SamplingData a => Monoid (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Binary a => Binary (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: SamplingStats a -> () #

ResultItemable (ResultValue (SamplingStats Double)) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: ResultValue (SamplingStats Double) m -> ResultName Source #

resultItemNamePath :: ResultValue (SamplingStats Double) m -> [ResultName] Source #

resultItemId :: ResultValue (SamplingStats Double) m -> ResultId Source #

resultItemIdPath :: ResultValue (SamplingStats Double) m -> [ResultId] Source #

resultItemSignal :: MonadDES m => ResultValue (SamplingStats Double) m -> ResultSignal m Source #

resultItemExpansion :: MonadDES m => ResultValue (SamplingStats Double) m -> ResultSource m Source #

resultItemSummary :: MonadDES m => ResultValue (SamplingStats Double) m -> ResultSource m Source #

resultItemAsIntValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: MonadDES m => ResultValue (SamplingStats Double) m -> Maybe (ResultValue String m) Source #

ResultItemable (ResultValue (SamplingStats Int)) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: ResultValue (SamplingStats Int) m -> ResultName Source #

resultItemNamePath :: ResultValue (SamplingStats Int) m -> [ResultName] Source #

resultItemId :: ResultValue (SamplingStats Int) m -> ResultId Source #

resultItemIdPath :: ResultValue (SamplingStats Int) m -> [ResultId] Source #

resultItemSignal :: MonadDES m => ResultValue (SamplingStats Int) m -> ResultSignal m Source #

resultItemExpansion :: MonadDES m => ResultValue (SamplingStats Int) m -> ResultSource m Source #

resultItemSummary :: MonadDES m => ResultValue (SamplingStats Int) m -> ResultSource m Source #

resultItemAsIntValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: MonadDES m => ResultValue (SamplingStats Int) m -> Maybe (ResultValue String m) Source #

type Rep (SamplingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingStats a) = D1 (MetaData "SamplingStats" "Simulation.Aivika.Statistics" "aivika-5.8-KvdUrWCTyNf3ClI5XaVCf6" False) (C1 (MetaCons "SamplingStats" PrefixI True) ((S1 (MetaSel (Just "samplingStatsCount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "samplingStatsMin") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) :*: (S1 (MetaSel (Just "samplingStatsMax") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: (S1 (MetaSel (Just "samplingStatsMean") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double) :*: S1 (MetaSel (Just "samplingStatsMean2") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double)))))

class Num a => SamplingData a where #

Specifies data type from which values we can gather the statistics.

Methods

emptySamplingStats :: SamplingStats a #

An empty statistics that has no samples.

addSamplingStats :: a -> SamplingStats a -> SamplingStats a #

Add a new sample to the statistics.

combineSamplingStats :: SamplingStats a -> SamplingStats a -> SamplingStats a #

Combine two statistics.

combineSamplingStatsEither :: SamplingData a => Either a (SamplingStats a) -> SamplingStats a -> SamplingStats a #

If allows combining statistics more efficiently if we know that the first argument can be a scalar.

samplingStatsVariance :: SamplingStats a -> Double #

Return the variance.

samplingStatsDeviation :: SamplingStats a -> Double #

Return the deviation.

samplingStatsSummary :: Show a => SamplingStats a -> Int -> ShowS #

Show the summary of the statistics using the specified indent.

returnSamplingStats :: SamplingData a => a -> SamplingStats a #

Return the statistics by a single sample.

listSamplingStats :: SamplingData a => [a] -> SamplingStats a #

Create the statistics by the specified list of data.

fromIntSamplingStats :: SamplingStats Int -> SamplingStats Double #

Convert the statistics from integer to double values.

Timing Statistics

data TimingStats a #

This is the timing statistics where data are bound to the time.

Constructors

TimingStats 

Fields

Instances
Eq a => Eq (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

(Show a, TimingData a) => Show (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Generic (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (TimingStats a) :: * -> * #

Methods

from :: TimingStats a -> Rep (TimingStats a) x #

to :: Rep (TimingStats a) x -> TimingStats a #

Binary a => Binary (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

put :: TimingStats a -> Put #

get :: Get (TimingStats a) #

putList :: [TimingStats a] -> Put #

NFData a => NFData (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: TimingStats a -> () #

ResultItemable (ResultValue (TimingStats Double)) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: ResultValue (TimingStats Double) m -> ResultName Source #

resultItemNamePath :: ResultValue (TimingStats Double) m -> [ResultName] Source #

resultItemId :: ResultValue (TimingStats Double) m -> ResultId Source #

resultItemIdPath :: ResultValue (TimingStats Double) m -> [ResultId] Source #

resultItemSignal :: MonadDES m => ResultValue (TimingStats Double) m -> ResultSignal m Source #

resultItemExpansion :: MonadDES m => ResultValue (TimingStats Double) m -> ResultSource m Source #

resultItemSummary :: MonadDES m => ResultValue (TimingStats Double) m -> ResultSource m Source #

resultItemAsIntValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: MonadDES m => ResultValue (TimingStats Double) m -> Maybe (ResultValue String m) Source #

ResultItemable (ResultValue (TimingStats Int)) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Methods

resultItemName :: ResultValue (TimingStats Int) m -> ResultName Source #

resultItemNamePath :: ResultValue (TimingStats Int) m -> [ResultName] Source #

resultItemId :: ResultValue (TimingStats Int) m -> ResultId Source #

resultItemIdPath :: ResultValue (TimingStats Int) m -> [ResultId] Source #

resultItemSignal :: MonadDES m => ResultValue (TimingStats Int) m -> ResultSignal m Source #

resultItemExpansion :: MonadDES m => ResultValue (TimingStats Int) m -> ResultSource m Source #

resultItemSummary :: MonadDES m => ResultValue (TimingStats Int) m -> ResultSource m Source #

resultItemAsIntValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue Int m) Source #

resultItemAsIntListValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue [Int] m) Source #

resultItemAsIntStatsValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue (SamplingStats Int) m) Source #

resultItemAsIntTimingStatsValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue (TimingStats Int) m) Source #

resultItemAsDoubleValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue Double m) Source #

resultItemAsDoubleListValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue [Double] m) Source #

resultItemAsDoubleStatsValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue (SamplingStats Double) m) Source #

resultItemAsDoubleTimingStatsValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue (TimingStats Double) m) Source #

resultItemAsStringValue :: MonadDES m => ResultValue (TimingStats Int) m -> Maybe (ResultValue String m) Source #

type Rep (TimingStats a) 
Instance details

Defined in Simulation.Aivika.Statistics

class Num a => TimingData a where #

Defines the data type from which values we can gather the timing statistics.

Methods

emptyTimingStats :: TimingStats a #

An empty statistics that has no samples.

addTimingStats :: Double -> a -> TimingStats a -> TimingStats a #

Add a sample with the specified time to the statistics.

timingStatsMean :: TimingStats a -> Double #

Return the average value.

timingStatsMean2 :: TimingStats a -> Double #

Return the average square value.

timingStatsVariance :: TimingStats a -> Double #

Return the variance.

timingStatsDeviation :: TimingData a => TimingStats a -> Double #

Return the deviation.

timingStatsSummary :: (Show a, TimingData a) => TimingStats a -> Int -> ShowS #

Show the summary of the statistics using the specified indent.

returnTimingStats :: TimingData a => Double -> a -> TimingStats a #

Return the statistics by single timing data.

fromIntTimingStats :: TimingStats Int -> TimingStats Double #

Convert the statistics from integer to double values.

normTimingStats :: TimingData a => Int -> TimingStats a -> SamplingStats a #

Convert the statistics to its normalised sampling-based representation, where the first argument specifies the number of pseudo-samples.

Simple Counter

data SamplingCounter a #

A counter for which the statistics is collected too.

Constructors

SamplingCounter 

Fields

Instances
Eq a => Eq (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Show a => Show (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Generic (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (SamplingCounter a) :: * -> * #

Binary a => Binary (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: SamplingCounter a -> () #

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Event m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Dynamics m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Simulation m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Parameter m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Signalable m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, MonadVar m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Var m (SamplingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

type Rep (SamplingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (SamplingCounter a) = D1 (MetaData "SamplingCounter" "Simulation.Aivika.Statistics" "aivika-5.8-KvdUrWCTyNf3ClI5XaVCf6" False) (C1 (MetaCons "SamplingCounter" PrefixI True) (S1 (MetaSel (Just "samplingCounterValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Just "samplingCounterStats") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (SamplingStats a))))

incSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a #

Increase the counter.

decSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a #

Decrease the counter.

setSamplingCounter :: SamplingData a => a -> SamplingCounter a -> SamplingCounter a #

Set a new value for the counter.

returnSamplingCounter :: SamplingData a => a -> SamplingCounter a #

Create a counter with the specified initial value.

Timing Counter

data TimingCounter a #

A counter for which the timing statistics is collected too.

Constructors

TimingCounter 

Fields

Instances
Eq a => Eq (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Ord a => Ord (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

(Show a, TimingData a) => Show (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Generic (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Associated Types

type Rep (TimingCounter a) :: * -> * #

Binary a => Binary (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

NFData a => NFData (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

Methods

rnf :: TimingCounter a -> () #

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Event m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Dynamics m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Simulation m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Parameter m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Signalable m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

(MonadDES m, MonadVar m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Var m (TimingCounter a)) m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

type Rep (TimingCounter a) 
Instance details

Defined in Simulation.Aivika.Statistics

type Rep (TimingCounter a) = D1 (MetaData "TimingCounter" "Simulation.Aivika.Statistics" "aivika-5.8-KvdUrWCTyNf3ClI5XaVCf6" False) (C1 (MetaCons "TimingCounter" PrefixI True) (S1 (MetaSel (Just "timingCounterValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: S1 (MetaSel (Just "timingCounterStats") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (TimingStats a))))

emptyTimingCounter :: TimingData a => TimingCounter a #

An empty counter.

incTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a #

Increase the counter at the specified time.

decTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a #

Decrease the counter at the specified time.

setTimingCounter :: TimingData a => Double -> a -> TimingCounter a -> TimingCounter a #

Set a new value for the counter at the specified time.

returnTimingCounter :: TimingData a => Double -> a -> TimingCounter a #

Create a timing counter with the specified initial value at the given time.