Skip to content

scram::core::Settings

Builder for analysis settings. More...

#include <settings.h>

Public Functions

Name
Settings &approximation(Approximation value)<br>Sets the approximation for quantitative analysis.
Settings &approximation(std::string_view value)
Algorithmalgorithm() const
Settings &algorithm(Algorithm value)<br>Sets the algorithm for Qualitative analysis.
Settings &algorithm(std::string_view value)<br>Provides a convenient wrapper for algorithm setting from a string.
Approximationapproximation() const
boolprime_implicants() const
Settings &prime_implicants(bool flag)<br>Sets a flag to calculate prime implicants instead of minimal cut sets.
intlimit_order() const
Settings &limit_order(int order)<br>Sets the limit order for products.
doublecut_off() const
Settings &cut_off(double prob)<br>Sets the cut-off probability for products to be considered for analysis.
intnum_quantiles() const
Settings &num_quantiles(int n)<br>Sets the number of quantiles for distributions.
intnum_bins() const
Settings &num_bins(int n)<br>Sets the number of bins for histograms.
intnum_trials() const
Settings &num_trials(int n)<br>Sets the number of trials for Monte Carlo simulations.
intseed() const
Settings &seed(int s)<br>Sets the seed for the pseudo-random number generator.
doublemission_time() const
Settings &mission_time(double time)<br>Sets the system mission time.
doubletime_step() const
Settings &time_step(double time)<br>Sets the time step for probability analyses.
boolprobability_analysis() const
Settings &probability_analysis(bool flag)<br>Sets the flag for probability analysis.
Settings &skip_products(bool flag)<br>Sets the flag for skipping products calculation.
boolskip_products() const
boolbit_pack_cut_sets() const
Settings &bit_pack_cut_sets(bool flag)<br>Enables/disables packed bit-vector cut set serialization.
boolrequires_products() const
boolsafety_integrity_levels() const
Settings &safety_integrity_levels(bool flag)<br>Sets the flag for calculation of the SIL metrics.
boolimportance_analysis() const
Settings &importance_analysis(bool flag)<br>Sets the flag for importance analysis.
booluncertainty_analysis() const
Settings &uncertainty_analysis(bool flag)<br>Sets the flag for uncertainty analysis.
boolccf_analysis() const
Settings &ccf_analysis(bool flag)<br>Sets the flag for CCF analysis.
booladaptive() const
Settings &adaptive(bool flag)<br>Sets the flag for adaptive quantification.
boolexpand_atleast_gates() const
boolexpand_xor_gates() const
boolkeep_null_gates() const
intcompilation_level() const
Settings &expand_xor_gates(const bool on)
Settings &expand_atleast_gates(const bool on)
Settings &keep_null_gates(const bool on)
Settings &compilation_level(const int level)
const std::vector< std::string > &input_files() const
Settings &input_files(const std::vector< std::string > & files)<br>Sets/overwrites the list of MEF input files (primarily called by CLI glue code).
mef::Model *model() const
Settings &model(mef::Model * model)<br>Sets/overwrites the list of MEF input files (primarily called by CLI glue code).

Public Attributes

Name
boolpreprocessor <br>Stop analysis after preprocessor.
boolprint <br>Print analysis results in a terminal friendly way.

Detailed Description

cpp
class scram::core::Settings;

Builder for analysis settings.

Warning:

  • Some settings with defaults and constraints may have side-effects on other settings.
  • The order of building the settings matters.

Analysis facilities are guaranteed not to throw or fail with an instance of this class.

Public Functions Documentation

function approximation

cpp
Settings & approximation(
    Approximation value
)

Sets the approximation for quantitative analysis.

Parameters:

  • value Approximation kind to be applied.

Exceptions:

  • SettingsError The approximation is not recognized or inappropriate for analysis.

Return: Reference to this object.

function approximation

cpp
Settings & approximation(
    std::string_view value
)

function algorithm

cpp
inline Algorithm algorithm() const

Return: The Qualitative analysis algorithm.

function algorithm

cpp
Settings & algorithm(
    Algorithm value
)

Sets the algorithm for Qualitative analysis.

Parameters:

  • value The algorithm kind.

Return: Reference to this object.

Appropriate defaults are given to other settings relevant to the algorithm.

MOCUS and ZBDD based analyses run with the Rare-Event approximation by default. Whereas, BDD based analyses run with exact quantitative analysis.

function algorithm

cpp
Settings & algorithm(
    std::string_view value
)

Provides a convenient wrapper for algorithm setting from a string.

Parameters:

  • value The string representation of the algorithm.

Exceptions:

Return: Reference to this object.

function approximation

cpp
inline Approximation approximation() const

Return: The quantitative analysis approximation.

function prime_implicants

cpp
inline bool prime_implicants() const

Return: true if prime implicants are to be calculated instead of minimal cut sets.

function prime_implicants

cpp
Settings & prime_implicants(
    bool flag
)

Sets a flag to calculate prime implicants instead of minimal cut sets.

Parameters:

  • flag True for the request.

Exceptions:

Return: Reference to this object.

Prime implicants can only be calculated with BDD-based algorithms.

The request for prime implicants cancels the request for inapplicable quantitative analysis approximations.

function limit_order

cpp
inline int limit_order() const

Return: The limit on the size of products.

function limit_order

cpp
Settings & limit_order(
    int order
)

Sets the limit order for products.

Parameters:

  • order A non-negative number for the limit order.

Exceptions:

Return: Reference to this object.

function cut_off

cpp
inline double cut_off() const

Return: The minimum required probability for products.

function cut_off

cpp
Settings & cut_off(
    double prob
)

Sets the cut-off probability for products to be considered for analysis.

Parameters:

  • prob The minimum probability for products.

Exceptions:

Return: Reference to this object.

function num_quantiles

cpp
inline int num_quantiles() const

Return: The number of quantiles for distributions.

function num_quantiles

cpp
Settings & num_quantiles(
    int n
)

Sets the number of quantiles for distributions.

Parameters:

  • n A natural number for the number of quantiles.

Exceptions:

Return: Reference to this object.

function num_bins

cpp
inline int num_bins() const

Return: The number of bins for histograms.

function num_bins

cpp
Settings & num_bins(
    int n
)

Sets the number of bins for histograms.

Parameters:

  • n A natural number for the number of bins.

Exceptions:

Return: Reference to this object.

function num_trials

cpp
inline int num_trials() const

Return: The number of trials for Monte Carlo simulations.

function num_trials

cpp
Settings & num_trials(
    int n
)

Sets the number of trials for Monte Carlo simulations.

Parameters:

  • n A natural number for the number of trials.

Exceptions:

Return: Reference to this object.

function seed

cpp
inline int seed() const

Return: The seed of the pseudo-random number generator.

function seed

cpp
Settings & seed(
    int s
)

Sets the seed for the pseudo-random number generator.

Parameters:

  • s A positive number.

Exceptions:

Return: Reference to this object.

function mission_time

cpp
inline double mission_time() const

Return: The length time of the system under risk.

function mission_time

cpp
Settings & mission_time(
    double time
)

Sets the system mission time.

Parameters:

  • time A positive number in hours by default.

Exceptions:

Return: Reference to this object.

function time_step

cpp
inline double time_step() const

Return: The time step in hours for probability analyses. 0 if the time step doesn't apply.

function time_step

cpp
Settings & time_step(
    double time
)

Sets the time step for probability analyses.

Parameters:

  • time The time in hours to partition the mission time.

Exceptions:

  • SettingsError The time value is negative.
  • SettingsError The time step is being disabled (value 0) while the SIL metrics are requested.

Return: Reference to this object.

0 value signifies that the time step doesn't apply.

function probability_analysis

cpp
inline bool probability_analysis() const

Return: true if probability analysis is requested.

function probability_analysis

cpp
inline Settings & probability_analysis(
    bool flag
)

Sets the flag for probability analysis.

Parameters:

  • flag True or false for turning on or off the analysis.

Return: Reference to this object.

If another analysis requires probability analysis, it won't be possible to turn off probability analysis before the parent analysis.

function skip_products

cpp
inline Settings & skip_products(
    bool flag
)

Sets the flag for skipping products calculation.

Parameters:

  • flag True or false for turning on or off the products calculation.

Return: Reference to this object.

function skip_products

cpp
inline bool skip_products() const

Return: true if the products calculation will be skipped.

function bit_pack_cut_sets

cpp
inline bool bit_pack_cut_sets() const

Return: true if cut sets should be serialized as packed bit-vectors.

function bit_pack_cut_sets

cpp
inline Settings & bit_pack_cut_sets(
    bool flag
)

Enables/disables packed bit-vector cut set serialization.

Note: Default is false to preserve existing XML output.

function requires_products

cpp
inline bool requires_products() const

Return: true if qualitative product enumeration is required for the requested analyses under current settings.

This is primarily used to skip cut set enumeration for BDD when only probability with exact calculation (no approximation) is requested. In all other cases (ZBDD/MOCUS algorithms, approximations, prime implicants, importance/uncertainty, or debug printing), products are required.

function safety_integrity_levels

cpp
inline bool safety_integrity_levels() const

Return: true if the SIL metrics are requested.

function safety_integrity_levels

cpp
Settings & safety_integrity_levels(
    bool flag
)

Sets the flag for calculation of the SIL metrics.

Parameters:

  • flag True or false for turning on or off the analysis.

Exceptions:

Return: Reference to this object.

This requires that time-step is set.

function importance_analysis

cpp
inline bool importance_analysis() const

Return: true if importance analysis is requested.

function importance_analysis

cpp
inline Settings & importance_analysis(
    bool flag
)

Sets the flag for importance analysis.

Parameters:

  • flag True or false for turning on or off the analysis.

Return: Reference to this object.

Importance analysis is performed together with probability analysis. Appropriate flags are turned on.

function uncertainty_analysis

cpp
inline bool uncertainty_analysis() const

Return: true if uncertainty analysis is requested.

function uncertainty_analysis

cpp
inline Settings & uncertainty_analysis(
    bool flag
)

Sets the flag for uncertainty analysis.

Parameters:

  • flag True or false for turning on or off the analysis.

Return: Reference to this object.

Uncertainty analysis implies probability analysis, so the probability analysis is turned on implicitly.

function ccf_analysis

cpp
inline bool ccf_analysis() const

Return: true if CCF groups must be incorporated into analysis.

function ccf_analysis

cpp
inline Settings & ccf_analysis(
    bool flag
)

Sets the flag for CCF analysis.

Parameters:

  • flag True or false for turning on or off the analysis.

Return: Reference to this object.

function adaptive

cpp
inline bool adaptive() const

Return: true if adaptive quantification is requested.

function adaptive

cpp
inline Settings & adaptive(
    bool flag
)

Sets the flag for adaptive quantification.

Parameters:

  • flag True or false for turning on or off adaptive mode.

Return: Reference to this object.

When enabled, products are sorted by probability and accumulated until the exact BDD probability is reached.

function expand_atleast_gates

cpp
inline bool expand_atleast_gates() const

function expand_xor_gates

cpp
inline bool expand_xor_gates() const

function keep_null_gates

cpp
inline bool keep_null_gates() const

function compilation_level

cpp
inline int compilation_level() const

function expand_xor_gates

cpp
inline Settings & expand_xor_gates(
    const bool on
)

function expand_atleast_gates

cpp
inline Settings & expand_atleast_gates(
    const bool on
)

function keep_null_gates

cpp
inline Settings & keep_null_gates(
    const bool on
)

function compilation_level

cpp
inline Settings & compilation_level(
    const int level
)

function input_files

cpp
inline const std::vector< std::string > & input_files() const

Return: the list of MEF input files provided for the analysis (can be empty).

function input_files

cpp
inline Settings & input_files(
    const std::vector< std::string > & files
)

Sets/overwrites the list of MEF input files (primarily called by CLI glue code).

A reference is not kept – a copy of the vector is stored inside the Settings instance.

function model

cpp
inline mef::Model * model() const

Return: an optional shared pointer to the MEF model

function model

cpp
inline Settings & model(
    mef::Model * model
)

Sets/overwrites the list of MEF input files (primarily called by CLI glue code).

A reference is not kept – a copy of the vector is stored inside the Settings instance.

Public Attributes Documentation

variable preprocessor

cpp
bool preprocessor = false;

Stop analysis after preprocessor.

variable print

cpp
bool print = false;

Print analysis results in a terminal friendly way.


Updated on 2026-01-09 at 21:59:12 +0000