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 intThe 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 TermTheTermto 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 voidThe evaluation performs the actual stochastic logic calculations by a sequential processing of the different terms according to their order and using a stack.protected voidevaluateAND(Term term) The evaluation of anANDTermwith respective AND operation on the bit streams of the operands.protected voidevaluateNOT(Term term) The evaluation of anNOTTermwith respective flip of the bit streams of the operand.protected voidevaluateOR(Term term) The evaluation of anORTermwith respective OR operation on the bit streams of the operands.protected BitSetgenerateRandomBitstream(double probability) Generates aBitSetrepresenting the bit stream where the ratio of 1s and 0s resembles the given probability.doublegetProbabiliy(org.apache.commons.collections15.Transformer<T, Double> transformer) Calculates the probability of theTerm(i.e.protected voidinitialize(Term term)
-
Field Details
-
term
TheTermto 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 anANDTermwith respective AND operation on the bit streams of the operands.- Parameters:
term- the ANDTerm to evaluate
-
evaluateOR
The evaluation of anORTermwith respective OR operation on the bit streams of the operands.- Parameters:
term- the ORTerm to evaluate
-
evaluateNOT
The evaluation of anNOTTermwith respective flip of the bit streams of the operand.- Parameters:
term- the NOTTerm to evaluate
-
generateRandomBitstream
Generates aBitSetrepresenting 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
-