Class SL<T>

java.lang.Object
org.jreliability.sl.SL<T>
Type Parameters:
T - the type of the variables

public class SL<T> extends Object
The SL uses the concept of stochastic logic [A] to evaluate a given Term. [A] Aliee, H. and Zarandi, H.R.. Fault tree analysis using stochastic logic: A reliable and high speed computing. In Proceedings of the Annual Reliability and Maintainability Symposium (RAMS), 2011.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
    The length of the used bit streams for stochastic logic.
    protected Map<Term,Integer>
    The number of operands for each term which are then popped from the stack.
    protected Stack<BitSet>
    The stack to process the terms.
    protected Term
    The Term to be evaluated.
    protected Map<Term,BitSet>
    In stochastic logic, equal variables have to be modeled using exactly the same bit stream (since they are actually the same!).
    protected List<Term>
    A list that orders the terms in such a way that they can later be sequentially evaluated using a stack.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SL(Term term)
    Constructs an SL with a given Term.
    SL(Term term, int bitStreamLength)
    Constructs an SL with a given Term and a given length of the bit streams to use.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    evaluate(org.apache.commons.collections15.Transformer<T,Double> transformer)
    The evaluation performs the actual stochastic logic calculations by a sequential processing of the different terms according to their order and using a stack.
    protected void
    The evaluation of an ANDTerm with respective AND operation on the bit streams of the operands.
    protected void
    The evaluation of an NOTTerm with respective flip of the bit streams of the operand.
    protected void
    The evaluation of an ORTerm with respective OR operation on the bit streams of the operands.
    protected BitSet
    generateRandomBitstream(double probability)
    Generates a BitSet representing the bit stream where the ratio of 1s and 0s resembles the given probability.
    double
    getProbabiliy(org.apache.commons.collections15.Transformer<T,Double> transformer)
    Calculates the probability of the Term (i.e.
    protected void
    Initializes the SL by ordering the Term for the stack processing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • term

      protected Term term
      The Term to be evaluated.
    • bitStreamLength

      protected final int bitStreamLength
      The length of the used bit streams for stochastic logic.
    • termsForStackProcessing

      protected List<Term> termsForStackProcessing
      A list that orders the terms in such a way that they can later be sequentially evaluated using a stack.
    • numberOfOperands

      protected Map<Term,Integer> numberOfOperands
      The number of operands for each term which are then popped from the stack.
    • operandsStack

      protected Stack<BitSet> operandsStack
      The stack to process the terms.
    • termCache

      protected Map<Term,BitSet> termCache
      In stochastic logic, equal variables have to be modeled using exactly the same bit stream (since they are actually the same!). This is realized by the term cache.
  • Constructor Details

    • SL

      public SL(Term term)
      Constructs an SL with a given Term.
      Parameters:
      term - the term to evaluate
    • SL

      public SL(Term term, int bitStreamLength)
      Constructs an SL with a given Term and a given length of the bit streams to use.
      Parameters:
      term - the term to evaluate
      bitStreamLength - the length of the bit streams
  • Method Details

    • initialize

      protected void initialize(Term term)
      Initializes the SL by ordering the Term for the stack processing.
      Parameters:
      term - the term to initialize
    • getProbabiliy

      public double getProbabiliy(org.apache.commons.collections15.Transformer<T,Double> transformer)
      Calculates the probability of the Term (i.e. the top event) based on a given probabilities of the basic events.
      Parameters:
      transformer - the probabilities of the basic events
      Returns:
      the probability of the top event
    • evaluate

      protected void evaluate(org.apache.commons.collections15.Transformer<T,Double> transformer)
      The evaluation performs the actual stochastic logic calculations by a sequential processing of the different terms according to their order and using a stack. Note that this function leaves its current result on the stack - eventually, the result for the top event will remain on the stack!
      Parameters:
      transformer - the probability of the basic events
    • evaluateAND

      protected void evaluateAND(Term term)
      The evaluation of an ANDTerm with respective AND operation on the bit streams of the operands.
      Parameters:
      term - the ANDTerm to evaluate
    • evaluateOR

      protected void evaluateOR(Term term)
      The evaluation of an ORTerm with respective OR operation on the bit streams of the operands.
      Parameters:
      term - the ORTerm to evaluate
    • evaluateNOT

      protected void evaluateNOT(Term term)
      The evaluation of an NOTTerm with respective flip of the bit streams of the operand.
      Parameters:
      term - the NOTTerm to evaluate
    • generateRandomBitstream

      protected BitSet generateRandomBitstream(double probability)
      Generates a BitSet representing the bit stream where the ratio of 1s and 0s resembles the given probability. This implementation does not apply this probability on a per-bit basis but considers the bit length with respective rounding effects!
      Parameters:
      probability - the probability to model with the bit stream
      Returns:
      the bit stream