Diagnostic session

<< Click to Display Table of Contents >>

Diagnostic session

With diagnostic attributes, such as node roles and (optionally) observation costs defined, we can start a diagnostic session in order to obtain a ranked observation list. The diagnostic session is represented by DSL_diagSession object. Its constructor requires a reference to the DSL_network, where diagnostic information is defined. The session object provides an API to pursue faults, instantiate observations, and retrieve the statistics for observations. During the diagnostic session, your program should use the DSL_diagSession instance to read information from the network.

DSL_diagSession diag(net); // net is our DSL_network

The diagnostic session instantiates the mandatory observation during its initialization. To obtain a ranking of un-instantiated observations, we need to calculate their cross-entropy, which is a dynamic measure, depending on the already instantiated observations and the fault or faults selected as the focus of reasoning (these faults are called "pursued faults"). There is no default selection of pursued faults when DSL_diagSession is initialized and we need to specify a fault or faults to pursue. From the diagnostic session point of view, the fault is a node/state pair (because one fault node can have more than one faulty state). The node/state pairs are referenced by their indices in the session's data. Do not use fault node handles directly when setting the pursued fault. If needed, convert the node handle/state pair to fault index with DSL_diagSession::FindFault.

If we work with a network containing only one fault, we can pass zero to DSL_diagSession::SetPursuedFault. For general purpose diagnostic application, the initial selection of the pursued fault can be performed with DSL_diagSession::FindMostLikelyFault:

diag.UpdateFaultBeliefs();

int faultIndex = diag.FindMostLikelyFault();

diag.SetPursuedFault(faultIndex);

Please note that we need to calculate the fault probabilities with DSL_diagSession::UpdateFaultBeliefs, otherwise FindMostLikelyFault will not work. With pursued fault initialized, we can execute the main diagnostic algorithm, which is computationally complex and involves a series of runs of a belief updating algorithm.

int res = diag.UpdateTestStrengths();

If the status returned from DSL_diagSession::UpdateTestStrengths is DSL_OKAY, we can retrieve the vector of observations with their diagnostic values. Note that only ranked observations are included in this list. The vector is not sorted, but std::sort algorithm can be trivially applied.

vector<DSL_diagTestInfo> stats = diag.GetTestStatistics();

sort(stats.begin(), stats.end(), 

 [](auto lhs, auto rhs) { return lhs.strength > rhs.strength; });

Each DSL_diagTestInfo structure contains an observation node handle, which can be used to create a user interface with a list of unperformed tests and their diagnostic values. Typical diagnostic application shows the lists of faults, and performed/unperformed observations. Users can change pursued fault(s) and instantiate observations. To instantiate an observation, call DSL_diagSession::InstantiateObservation with the observation node handle and its selected outcome index. This sets the evidence in the corresponding observation node and clears the internal data structures in the diagnostic session. DSL_diagSession::ReleaseObservation removes the evidence from an observation node.

Do not call DSL_nodeVal::SetEvidence and ClearEvidence directly on the observation nodes during the diagnostic session.

See DSL_diagSession reference for API details.