Package org.jreliability.sl
Class SL<T>
java.lang.Object
org.jreliability.sl.SL<T>
- Type Parameters:
T
- the type of the variables
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
The length of the used bit streams for stochastic logic.The number of operands for each term which are then popped from the stack.The stack to process the terms.protected Term
TheTerm
to be evaluated.In stochastic logic, equal variables have to be modeled using exactly the same bit stream (since they are actually the same!).A list that orders the terms in such a way that they can later be sequentially evaluated using a stack. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
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
evaluateAND
(Term term) The evaluation of anANDTerm
with respective AND operation on the bit streams of the operands.protected void
evaluateNOT
(Term term) The evaluation of anNOTTerm
with respective flip of the bit streams of the operand.protected void
evaluateOR
(Term term) The evaluation of anORTerm
with respective OR operation on the bit streams of the operands.protected BitSet
generateRandomBitstream
(double probability) Generates aBitSet
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 theTerm
(i.e.protected void
initialize
(Term term)
-
Field Details
-
term
TheTerm
to be evaluated. -
bitStreamLength
protected final int bitStreamLengthThe length of the used bit streams for stochastic logic. -
termsForStackProcessing
A list that orders the terms in such a way that they can later be sequentially evaluated using a stack. -
numberOfOperands
The number of operands for each term which are then popped from the stack. -
operandsStack
The stack to process the terms. -
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
- Parameters:
term
- the term to evaluate
-
SL
- Parameters:
term
- the term to evaluatebitStreamLength
- the length of the bit streams
-
-
Method Details
-
initialize
- Parameters:
term
- the term to initialize
-
getProbabiliy
Calculates the probability of theTerm
(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
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
The evaluation of anANDTerm
with respective AND operation on the bit streams of the operands.- Parameters:
term
- the ANDTerm to evaluate
-
evaluateOR
The evaluation of anORTerm
with respective OR operation on the bit streams of the operands.- Parameters:
term
- the ORTerm to evaluate
-
evaluateNOT
The evaluation of anNOTTerm
with respective flip of the bit streams of the operand.- Parameters:
term
- the NOTTerm to evaluate
-
generateRandomBitstream
Generates aBitSet
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
-