TeDDy 4.1.0
Decision diagram library.
|
Base class for reliability managers. More...
#include <reliability_manager.hpp>
Public Types | |
using | diagram_t = typename diagram_manager< double, Degree, Domain >::diagram_t |
![]() | |
using | diagram_t = diagram< double, Degree > |
Alias for the diagram type used in the functions of this manager. | |
Public Member Functions | |
template<probs::prob_vector Ps> requires (details::is_bss<Degree>) | |
auto | calculate_probabilities (Ps const &probs, diagram_t const &diagram) -> void |
Calculates probabilities of system states 0 and 1. | |
template<probs::prob_matrix Ps> | |
auto | calculate_probabilities (Ps const &probs, diagram_t const &diagram) -> void |
Calculates probabilities of all system states. | |
template<probs::prob_vector Ps> requires (details::is_bss<Degree>) | |
auto | calculate_probability (Ps const &probs, diagram_t const &diagram) -> double |
Calculates and returns probability of system state 1. | |
template<probs::prob_matrix Ps> | |
auto | calculate_probability (int32 state, Ps const &probs, diagram_t const &diagram) -> double |
Calculates and returns probability of a system state state . | |
auto | get_probability (int32 state) const -> double |
Returns probability of given system state. | |
template<probs::prob_vector Ps, class Foo = void> requires (details::is_bss<Degree>) | |
auto | calculate_availability (Ps const &probs, diagram_t const &diagram) -> utils::second_t< Foo, double > |
Calculates and returns availability of a BSS. | |
template<probs::prob_matrix Ps> | |
auto | calculate_availability (int32 state, Ps const &probs, diagram_t const &diagram) -> double |
Calculates and returns system availability with respect to the system state state . | |
template<class Foo = void> requires (details::is_bss<Degree>) | |
auto | get_availability () const -> utils::second_t< Foo, double > |
Returns availability of a BSS. | |
auto | get_availability (int32 state) const -> double |
Returns system availability with respect to the system state state . | |
template<probs::prob_matrix Ps, class Foo = void> requires (details::is_bss<Degree>) | |
auto | calculate_unavailability (Ps const &probs, diagram_t const &diagram) -> utils::second_t< Foo, double > |
Calculates and returns unavailability of a BSS. | |
template<probs::prob_matrix Ps> | |
auto | calculate_unavailability (int32 state, Ps const &probs, diagram_t const &diagram) -> double |
Calculates and returns system availability with respect to the system state state . | |
template<class Foo = void> requires (details::is_bss<Degree>) | |
auto | get_unavailability () -> utils::second_t< Foo, double > |
Returns system unavailability of a BSS. | |
auto | get_unavailability (int32 state) -> double |
Returns system unavailability with respect to the system state state . | |
auto | state_frequency (diagram_t const &diagram, int32 state) -> double |
Returns system state frequency of state state . | |
template<class FChange > | |
auto | dpld (var_change varChange, FChange fChange, diagram_t const &diagram) -> diagram_t |
Calculates Direct Partial Boolean Derivative. | |
auto | to_dpld_e (int32 varFrom, int32 varIndex, diagram_t const &dpld) -> diagram_t |
Transforms dpld into Extended DPLD. | |
auto | structural_importance (diagram_t const &dpld) -> double |
Calculates Structural Importace (SI) of a component. | |
template<probs::prob_matrix Ps> | |
auto | birnbaum_importance (Ps const &probs, diagram_t const &dpld) -> double |
Calculates Birnbaum importance (BI) of a component. | |
template<probs::prob_matrix Ps> | |
auto | fussell_vesely_importance (Ps const &probs, diagram_t const &dpld, double unavailability, int32 componentState, int32 componentIndex) -> double |
Calculates Fussell-Vesely importance (FVI) of a component. | |
template<out_var_values Vars> | |
auto | mcvs (diagram_t const &diagram, int32 state) -> std::vector< Vars > |
Finds all Minimal Cut Vector (MCVs) of the system with respect to the system state State . | |
template<out_var_values Vars> | |
auto | mpvs (diagram_t const &diagram, int32 state) -> std::vector< Vars > |
Finds all Minimal Path Vector (MPVs) of the system with respect to the system state state . | |
template<out_var_values Vars, std::output_iterator< Vars > Out> | |
auto | mcvs_g (diagram_t const &diagram, int32 state, Out out) -> void |
Finds all Minimal Cut Vector of the system with respect to the system state state . | |
template<out_var_values Vars, std::output_iterator< Vars > Out> | |
auto | mpvs_g (diagram_t const &diagram, int32 state, Out out) -> void |
Finds all Minimal Path Vector (MPVs) of the system with respect to the system state state . | |
![]() | |
auto | constant (int32 val) -> diagram_t |
Creates diagram representing constant function. | |
auto | variable (int32 index) -> diagram_t |
Creates diagram representing function of single variable. | |
auto | variable_not (int32 index) -> utils::second_t< Foo, diagram_t > |
Creates BDD representing function of complemented variable. | |
auto | operator() (int32 index) -> diagram_t |
Creates diagram representing function of single variable. | |
auto | variables (std::initializer_list< T > indices) -> std::vector< diagram_t > |
Creates vector of diagrams representing single variables. | |
auto | variables (I first, S last) -> std::vector< diagram_t > |
Creates vector of diagrams representing functions of single variables. | |
auto | variables (Is const &indices) -> std::vector< diagram_t > |
Creates vector of diagrams representing single variables. | |
auto | from_vector (I first, S last) -> diagram_t |
Creates diagram from a truth vector of a function. | |
auto | from_vector (R &&vector) -> diagram_t |
Creates diagram from a truth vector of a function. | |
auto | to_vector (diagram_t const &diagram) const -> std::vector< int32 > |
Creates truth vector from the diagram. | |
auto | to_vector_g (diagram_t const &diagram, O out) const -> void |
Creates truth vector from the diagram. | |
auto | from_pla (pla_file const &file, fold_type foldType=fold_type::Tree) -> utils::second_t< Foo, std::vector< diagram_t > > |
Creates BDDs defined by PLA file. | |
auto | from_expression_tree (Node const &root) -> diagram_t |
Creates diagram from an expression tree (AST). | |
auto | apply (diagram_t const &lhs, diagram_t const &rhs) -> diagram_t |
Merges two diagrams using given binary operation. | |
auto | apply_n (Diagram const &... diagrams) -> diagram_t |
TODO. | |
auto | left_fold (R const &diagrams) -> diagram_t |
Merges diagams in the range using the apply function and binary operation. | |
auto | left_fold (I first, S last) -> diagram_t |
Merges diagams in the range using the apply function and binary operation. | |
auto | tree_fold (R &diagrams) -> diagram_t |
Merges diagams in the range using the apply function and binary operation. | |
auto | tree_fold (I first, S last) -> diagram_t |
Merges diagams in the range using the apply function and binary operation. | |
auto | evaluate (diagram_t const &diagram, Vars const &values) const -> int32 |
Evaluates value of the function represented by the diagram. | |
auto | satisfy_count (int32 value, diagram_t const &diagram) -> int64 |
Calculates number of variable assignments for which the functions evaluates to certain value. | |
auto | satisfy_one (int32 value, diagram_t const &diagram) -> std::optional< Vars > |
Finds variable assignment for which diagram evaluates to value . | |
auto | satisfy_all (int32 value, diagram_t const &diagram) const -> std::vector< Vars > |
Enumerates all elements of the satisfying set. | |
auto | satisfy_all_g (int32 value, diagram_t const &diagram, O out) const -> void |
Enumerates all elements of the satisfying set. | |
auto | satisfy_all_g (int32 const value, diagram_t const &diagram, OutputIt out) const -> void |
auto | get_cofactor (diagram_t const &diagram, int32 varIndex, int32 varValue) -> diagram_t |
Calculates cofactor of the functions. | |
auto | get_cofactor (diagram_t const &diagram, std::vector< var_cofactor > const &vars) -> diagram_t |
auto | transform (diagram_t const &diagram, F transformer) -> diagram_t |
Transforms values of the function. | |
auto | negate (diagram_t const &diagram) -> utils::second_t< Foo, diagram_t > |
Negates Boolean function. | |
auto | get_dependency_set (diagram_t const &diagram) const -> std::vector< int32 > |
Enumerates indices of variables that the function depends on. | |
auto | get_dependency_set_g (diagram_t const &diagram, O out) const -> void |
Enumerates indices of variables that the function depends on. | |
auto | reduce (diagram_t const &diagram) -> diagram_t |
Reduces diagrams to its canonical form. | |
auto | get_node_count () const -> int64 |
Returns number of nodes that are currently used by the manager. | |
auto | get_node_count (diagram_t const &diagram) const -> int64 |
Returns number of nodes in the diagram including terminal nodes. | |
auto | to_dot_graph (std::ostream &out) const -> void |
Prints dot representation of the graph. | |
auto | to_dot_graph (std::ostream &out, diagram_t const &diagram) const -> void |
Prints dot representation of the diagram. | |
auto | force_gc () -> void |
Runs garbage collection. | |
auto | force_reorder () -> void |
Runs variable reordering heuristic. | |
auto | clear_cache () -> void |
Clears apply cache. | |
auto | get_var_count () const -> int32 |
Returns number of variables for this manager set in the constructor. | |
auto | get_order () const -> std::vector< int32 > const & |
Returns current order of variables. | |
auto | get_domains () const -> std::vector< int32 > |
Return domains of variables. | |
auto | set_cache_ratio (double ratio) -> void |
Sets the relative cache size w.r.t the number of nodes. | |
auto | set_gc_ratio (double ratio) -> void |
Sets ratio used to determine new node pool allocation. | |
auto | set_auto_reorder (bool doReorder) -> void |
Enables or disables automatic variable reordering. | |
diagram_manager (diagram_manager &&) noexcept=default | |
diagram_manager (diagram_manager const &)=delete | |
auto | operator= (diagram_manager &&) noexcept -> diagram_manager &=default |
auto | operator= (diagram_manager const &) -> diagram_manager &=delete |
Protected Member Functions | |
reliability_manager (int32 varCount, int64 nodePoolSize, int64 overflowNodePoolSize, std::vector< int32 > order) | |
reliability_manager (int32 varCount, int64 nodePoolSize, int64 overflowNodePoolSize, domains::mixed domain, std::vector< int32 > order) | |
![]() | |
diagram_manager (int32 varCount, int64 nodePoolSize, int64 extraNodePoolSize, std::vector< int32 > order) | |
Initializes diagram manager. | |
diagram_manager (int32 varCount, int64 nodePoolSize, int64 extraNodePoolSize, domains::mixed domain, std::vector< int32 > order) | |
Initializes diagram manager. | |
Additional Inherited Members | |
![]() | |
using | node_t = typename diagram< double, Degree >::node_t |
using | son_container = typename node_t::son_container |
![]() | |
node_manager< double, Degree, Domain > | nodes_ |
Base class for reliability managers.
Base class for reliability managers. Defines all functions for reliability analysis.
auto teddy::reliability_manager< Degree, Domain >::calculate_probabilities | ( | Ps const & | probs, |
diagram_t const & | diagram | ||
) | -> void |
Calculates probabilities of system states 0 and 1.
probs
[i] must return probability that i-th component is in state 1 After a call to this method you can acces individual system state probabilities using get_probability
method.
Type | that holds component state probabilities |
probs | vector of component state probabilities |
diagram | Structure function |
auto teddy::reliability_manager< Degree, Domain >::calculate_probabilities | ( | Ps const & | probs, |
diagram_t const & | diagram | ||
) | -> void |
Calculates probabilities of all system states.
probs
[i][k] must return probability that i-th component is in state k After a call to this method you can acces individual system state probabilities using get_probability
method.
Type | that holds component state probabilities |
probs | matrix of component state probabilities |
diagram | Structure function |
auto teddy::reliability_manager< Degree, Domain >::calculate_probability | ( | Ps const & | probs, |
diagram_t const & | diagram | ||
) | -> double |
Calculates and returns probability of system state 1.
probs
[i] must return probability that i-th component is in state 1
Type | that holds component state probabilities |
probs | vector of component state probabilities |
diagram | Structure function |
diagram
is in state 1 given probabilities probs
auto teddy::reliability_manager< Degree, Domain >::calculate_probability | ( | int32 | state, |
Ps const & | probs, | ||
diagram_t const & | diagram | ||
) | -> double |
Calculates and returns probability of a system state state
.
probs
[i][k] must return probability that i-th component is in state k
Type | that holds component state probabilities |
state | System state |
probs | matrix of component state probabilities |
diagram | Structure function |
diagran
is in state state
given probabilities probs
auto teddy::reliability_manager< Degree, Domain >::get_probability | ( | int32 | state | ) | const -> double |
Returns probability of given system state.
Call to calculate_probabilities
must proceed call to this funtion otherwise the result is undefined. This is a bit unfortunate but the idea is that probabilities are calculated once using calculate_probabilities
and later accessed using get_probability
state | System state |
state
auto teddy::reliability_manager< Degree, Domain >::calculate_availability | ( | Ps const & | probs, |
diagram_t const & | diagram | ||
) | -> utils::second_t<Foo, double> |
Calculates and returns availability of a BSS.
probs
[i] must return probability that i-th component is in state 1
Component | state probabilities |
Foo | Dummy parameter to enable SFINE |
probs | vector of component state probabilities |
diagram | Structure function |
auto teddy::reliability_manager< Degree, Domain >::calculate_availability | ( | int32 | state, |
Ps const & | probs, | ||
diagram_t const & | diagram | ||
) | -> double |
Calculates and returns system availability with respect to the system state state
.
probs
[i][k] must return probability that i-th component is in state k
Component | state probabilities |
state | System state |
probs | matrix of component state probabilities |
diagram | Structure function |
state
auto teddy::reliability_manager< Degree, Domain >::get_availability |
Returns availability of a BSS.
Call to calculate_probabilities
must proceed call to this funtion otherwise the result is undefined. This is a bit unfortunate but the idea is that probabilities are calculated once using calculate_probabilities
and availability and unavailability are later accessed using get_availability
and get_unavailability
auto teddy::reliability_manager< Degree, Domain >::get_availability | ( | int32 | state | ) | const -> double |
Returns system availability with respect to the system state state
.
Call to calculate_probabilities
must proceed call to this funtion otherwise the result is undefined. This is a bit unfortunate but the idea is that probabilities are calculated once using calculate_probabilities
and availability and unavailability are later accessed using get_availability
and get_unavailability
state | System state |
state
auto teddy::reliability_manager< Degree, Domain >::calculate_unavailability | ( | Ps const & | probs, |
diagram_t const & | diagram | ||
) | -> utils::second_t<Foo, double> |
Calculates and returns unavailability of a BSS.
probs
[i] must return probability that i-th component is in state 1
Component | state probabilities |
Foo | Dummy parameter to enable SFINE |
probs | vector of component state probabilities |
diagran | Structure function |
auto teddy::reliability_manager< Degree, Domain >::calculate_unavailability | ( | int32 | state, |
Ps const & | probs, | ||
diagram_t const & | diagram | ||
) | -> double |
Calculates and returns system availability with respect to the system state state
.
probs
[i][k] must return probability that i-th component is in state k
Component | state probabilities |
state | System state |
probs | matrix of component state probabilities |
diagram | Structure function |
state
auto teddy::reliability_manager< Degree, Domain >::get_unavailability |
Returns system unavailability of a BSS.
Call to calculate_probabilities
must proceed call to this funtion otherwise the result is undefined. This is a bit unfortunate but the idea is that probabilities are calculated once using calculate_probabilities
and availability and unavailability are later accessed using get_availability
and get_unavailability
auto teddy::reliability_manager< Degree, Domain >::get_unavailability | ( | int32 | state | ) | -> double |
Returns system unavailability with respect to the system state state
.
Call to calculate_probabilities
must proceed call to this funtion otherwise the result is undefined. This is a bit unfortunate but the idea is that probabilities are calculated once using calculate_probabilities
and availability and unavailability are later accessed using get_availability
and get_unavailability
state | System state |
state
auto teddy::reliability_manager< Degree, Domain >::state_frequency | ( | diagram_t const & | diagram, |
int32 | state | ||
) | -> double |
Returns system state frequency of state state
.
diagram | Structure function |
state | System state |
state
auto teddy::reliability_manager< Degree, Domain >::dpld | ( | var_change | varChange, |
FChange | fChange, | ||
diagram_t const & | diagram | ||
) | -> diagram_t |
Calculates Direct Partial Boolean Derivative.
varChange | Change of the value of a variable |
fChange | Change of the value of the system |
diagram | Structure function |
auto teddy::reliability_manager< Degree, Domain >::to_dpld_e | ( | int32 | varFrom, |
int32 | varIndex, | ||
diagram_t const & | dpld | ||
) | -> diagram_t |
Transforms dpld
into Extended DPLD.
varFrom | Value from whitch the variable changes |
varIndex | Index of the variable |
varFrom | Derivative |
auto teddy::reliability_manager< Degree, Domain >::structural_importance | ( | diagram_t const & | dpld | ) | -> double |
Calculates Structural Importace (SI) of a component.
Different types of DPLDs can be used for the calculation. It is up to the user to pick the one that suits his needs.
dpld | Direct Partial Boolean Derivative of any type |
auto teddy::reliability_manager< Degree, Domain >::birnbaum_importance | ( | Ps const & | probs, |
diagram_t const & | dpld | ||
) | -> double |
Calculates Birnbaum importance (BI) of a component.
Different types of DPLDs can be used for the calculation. It is up to the user to pick the one that suits his needs.
probs | Component state probabilities |
dpld | Direct Partial Boolean Derivative of any type |
auto teddy::reliability_manager< Degree, Domain >::fussell_vesely_importance | ( | Ps const & | probs, |
diagram_t const & | dpld, | ||
double | unavailability, | ||
int32 | componentState, | ||
int32 | componentIndex | ||
) | -> double |
Calculates Fussell-Vesely importance (FVI) of a component.
Different types of DPLDs can be used for the calculation. It is up to the user to pick the one that suits his needs.
probs | Component state probabilities |
dpld | Direct Partial Boolean Derivative of any type |
unavailability | System unavailability |
componentState | State of the component |
componentIndex | Component index |
auto teddy::reliability_manager< Degree, Domain >::mcvs | ( | diagram_t const & | diagram, |
int32 | state | ||
) | -> std::vector<Vars> |
Finds all Minimal Cut Vector (MCVs) of the system with respect to the system state State
.
This function uses satisfy_all
function. Please keep in mind that for bigger systems, there can be a huge number of MCVs.
Vars | Container type that defines operator [] and allows assigning integers e.g std::vector or std::array |
diagram | Structure function |
state | System state |
auto teddy::reliability_manager< Degree, Domain >::mpvs | ( | diagram_t const & | diagram, |
int32 | state | ||
) | -> std::vector<Vars> |
Finds all Minimal Path Vector (MPVs) of the system with respect to the system state state
.
This function uses satisfy_all
function. Please keep in mind that for bigger systems, there can be a huge number of MCVs
Vars | Container type that defines operator [] and allows assigning integers e.g std::vector or std::array |
diagram | Structure function |
state | System state |
auto teddy::reliability_manager< Degree, Domain >::mcvs_g | ( | diagram_t const & | diagram, |
int32 | state, | ||
Out | out | ||
) | -> void |
Finds all Minimal Cut Vector of the system with respect to the system state state
.
This function uses satisfy_all_g
function. Please keep in mind that for bigger systems, there can be a huge number of MCVs.
Vars | Container type that defines operator [] and allows assigning integers e.g std::vector or std::array |
diagram | Structure function |
state | System state |
out | Output iterator that is used to output instances of Vars |
auto teddy::reliability_manager< Degree, Domain >::mpvs_g | ( | diagram_t const & | diagram, |
int32 | state, | ||
Out | out | ||
) | -> void |
Finds all Minimal Path Vector (MPVs) of the system with respect to the system state state
.
This function uses satisfy_all
function. Please keep in mind that for bigger systems, there can be a huge number of MCVs
Vars | Container type that defines operator [] and allows assigning integers e.g std::vector or std::array |
diagram | Structure function |
state | System state |
out | Output iterator that is used to output instances of Vars . |