• Manual
  • HAPI Namespace
Show / Hide Table of Contents
  • HAPI
    • AbsExpression
    • AddExpression
    • AggregateExpression
    • AndExpression
    • Attribute
    • BetaDistribution
    • BinomialDistribution
    • BooleanDCNode
    • BooleanDDNode
    • BooleanDFNode
    • BooleanExpression
    • CeilExpression
    • Class
    • ClassCollection
    • ClassList
    • ClassParseListener
    • Clique
    • CliqueList
    • CompositeExpression
    • ConstantExpression
    • ContinuousChanceNode
    • CosExpression
    • CoshExpression
    • DataSet
    • DefaultClassParseListener
    • DiscreteChanceNode
    • DiscreteDecisionNode
    • DiscreteFunctionNode
    • DiscreteNode
    • DistributionDistribution
    • DivideExpression
    • Domain
    • Domain.Equilibrium
    • Domain.EvidenceMode
    • Domain.TriangulationMethod
    • EqualsExpression
    • ExceptionArgumentNotAlive
    • ExceptionBadKBFormat
    • ExceptionBadKBPassword
    • ExceptionBadKBVersion
    • ExceptionCGEvidenceIncorporated
    • ExceptionCGLIMIDsNotSupported
    • ExceptionCaseStateTooLarge
    • ExceptionChainGraph
    • ExceptionCompressed
    • ExceptionComputationFailed
    • ExceptionCyclicFunctionalDependency
    • ExceptionCyclicInstanceHierarchy
    • ExceptionCyclicNetwork
    • ExceptionDemo
    • ExceptionDivisionByZero
    • ExceptionEnumeration
    • ExceptionError
    • ExceptionExpiredLicense
    • ExceptionFastRetraction
    • ExceptionFunctionalDependency
    • ExceptionHugin
    • ExceptionIO
    • ExceptionIllegalBinding
    • ExceptionInappropriateArguments
    • ExceptionInconsistencyOrUnderflow
    • ExceptionInsufficientStateRange
    • ExceptionInvalidEvidence
    • ExceptionInvalidExpression
    • ExceptionInvalidLicense
    • ExceptionInvalidName
    • ExceptionInvalidProbabilityPotential
    • ExceptionInvalidStateValues
    • ExceptionLocale
    • ExceptionLowDensity
    • ExceptionMemory
    • ExceptionNoEquilibrium
    • ExceptionNoValue
    • ExceptionNormalization
    • ExceptionNotCompiled
    • ExceptionObjectNotAlive
    • ExceptionOverflow
    • ExceptionParse
    • ExceptionRounding
    • ExceptionSizeTooLarge
    • ExceptionSyntax
    • ExceptionTableTooLarge
    • ExceptionTwice
    • ExceptionUsage
    • ExceptionZeroVariance
    • ExpExpression
    • ExponentialDistribution
    • Expression
    • Expression.Operator
    • ExpressionList
    • FloorExpression
    • FunctionNode
    • GammaDistribution
    • GeometricDistribution
    • GreaterThanExpression
    • GreaterThanOrEqualsExpression
    • IfExpression
    • InstanceNode
    • IntervalDCNode
    • IntervalDDNode
    • IntervalDFNode
    • JunctionTree
    • JunctionTreeList
    • LabelExpression
    • LabelledDCNode
    • LabelledDDNode
    • LabelledDFNode
    • LessThanExpression
    • LessThanOrEqualsExpression
    • Log10Expression
    • Log2Expression
    • LogExpression
    • LogNormalDistribution
    • MaxExpression
    • MinExpression
    • ModExpression
    • Model
    • MultiplyExpression
    • NegateExpression
    • NegativeBinomialDistribution
    • NetworkModel
    • NetworkModel.Constraint
    • Node
    • Node.Category
    • Node.Kind
    • NodeExpression
    • NodeList
    • NoisyOrDistribution
    • NormalDistribution
    • NotEqualsExpression
    • NotExpression
    • NumberExpression
    • NumberedDCNode
    • NumberedDDNode
    • NumberedDFNode
    • NumericDiscreteNode
    • OrExpression
    • PERTDistribution
    • ParseListener
    • PoissonDistribution
    • PowerExpression
    • ProbabilityExpression
    • QuantileExpression
    • SinExpression
    • SinhExpression
    • SqrtExpression
    • StateIndexExpression
    • SubtractExpression
    • Table
    • TanExpression
    • TanhExpression
    • TriangularDistribution
    • TruncateExpression
    • UniformDistribution
    • UtilityNode
    • VarianceExpression
    • WeibullDistribution

Class DiscreteNode

The discrete node class. Base class for all discrete nodes.

Note: Return and argument types for methods in this class vary depending on the particular API DLL (x86/x64 platform, single/double precision) being used. Please read the section Using the Hugin C#/.NET Core/.NET 5/.NET 6 API.

Inheritance
object
Node
DiscreteNode
DiscreteChanceNode
DiscreteDecisionNode
DiscreteFunctionNode
Implements
ICloneable
Inherited Members
Node.IsAlive()
Node.Delete()
Node.SetName(string)
Node.GetName()
Node.AddParent(Node)
Node.AddToInputs()
Node.AddToOutputs()
Node.Clone()
Node.EvidenceIsEntered()
Node.EvidenceIsPropagated()
Node.EvidenceToPropagate()
Node.GetAttribute(string)
Node.GetAttributes()
Node.GetChildren()
Node.GetEdgeConstraint(Node)
Node.GetHome()
Node.GetHomeClass()
Node.GetHomeDomain()
Node.GetInstance()
Node.GetJunctionTree()
Node.GetLabel()
Node.GetMaster()
Node.GetParents()
Node.GetPosition()
Node.SetPosition(Point)
Node.GetUserData()
Node.SetUserData(object)
Node.GetSource()
Node.LikelihoodIsEntered()
Node.LikelihoodIsPropagated()
Node.RemoveFromInputs()
Node.RemoveFromOutputs()
Node.RemoveParent(Node)
Node.ReverseEdge(Node)
Node.SetAttribute(string, string)
Node.SetAttributes(List<Attribute>)
Node.SetEdgeConstraint(Node, NetworkModel.Constraint)
Node.SetLabel(string)
Node.SwitchParent(Node, Node)
Node.GetModel()
Node.GetTable()
Node.CreateTemporalClone()
Node.GetTemporalClone()
Node.GetTemporalMaster()
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public abstract class DiscreteNode : Node, ICloneable

Methods

CaseIsSet(ulong)

Tests if a value has been set for this DiscreteNode in a specific case.

Declaration
public bool CaseIsSet(ulong c)
Parameters
Type Name Description
ulong c

The case index.

Returns
Type Description
bool

Returns true if a value has been set for this DiscreteNode in case c; otherwise, returns false.

Remarks

Generic declaration: public bool CaseIsSet (size_t c)

Exceptions
Type Condition
ExceptionHugin

ComputeExplanationData(ulong, DiscreteNode, ulong, ulong)

Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size.

Declaration
public void ComputeExplanationData(ulong x, DiscreteNode Y, ulong y, ulong maxSubsetSize)
Parameters
Type Name Description
ulong x

State of the primary hypothesis node (this node).

DiscreteNode Y

The alternative hypothesis node.

ulong y

State of the alternative hypothesis node.

ulong maxSubsetSize

Data for all subsets of evidence nodes up to this size are computed.

Remarks

Two hypotheses are compared: (this node)=x and Y=y. For each subset of evidence nodes (up to the specified maximum size), the Bayes factor (the support for the first hypothesis relative to the second hypothesis) is computed. The results of the computations can be accessed using GetExplanation(ulong) and GetExplanationScore(ulong).

Generic declaration: public void ComputeExplanationData (size_t x, DiscreteNode Y, size_t y, size_t maxSubsetSize)

Exceptions
Type Condition
ExceptionHugin

ComputeExplanationData(ulong, ulong)

Computes "normalized likelihoods" for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size.

Declaration
public void ComputeExplanationData(ulong state, ulong maxSubsetSize)
Parameters
Type Name Description
ulong state

State of the hypothesis node (this node).

ulong maxSubsetSize

Data for all subsets of evidence nodes up to this size are computed.

Remarks

For each subset of evidence nodes (up to the specified maximum size), the normalized likelihood of the hypothesis is computed. The results of the computations can be accessed using GetExplanation(ulong) and GetExplanationScore(ulong).

Generic declaration: public void ComputeExplanationData (size_t state, size_t maxSubsetSize)

Exceptions
Type Condition
ExceptionHugin

EnterFinding(ulong, float)

Specifies a state value for a given state with all other states unaffected.

Declaration
public void EnterFinding(ulong state, float finding)
Parameters
Type Name Description
ulong state

The index of the state to be selected. States are numbered consecutively from 0 and upwards.

float finding

A non-negative real number as the state value.

Remarks

Generic declaration: public void EnterFinding (size_t state, h_number_t finding)

Exceptions
Type Condition
ExceptionHugin

GenerateTable()

Generates the conditional probability table of this DiscreteNode from its model (a missing model will trigger an ExceptionUsage).

Declaration
public void GenerateTable()
Exceptions
Type Condition
ExceptionHugin

GetBelief(ulong)

Returns the belief for the specified state of this DiscreteNode.

Declaration
public float GetBelief(ulong state)
Parameters
Type Name Description
ulong state

The index of the state to examine.

Returns
Type Description
float

A real number representing the belief.

Remarks

Note that if findings have been entered since the most recent propagation, the beliefs returned may not be up-to-date.

Generic declaration: public h_number_t GetBelief (size_t state)

Exceptions
Type Condition
ExceptionHugin

GetCaseState(ulong)

Returns the state of this DiscreteNode for case c.

Declaration
public ulong GetCaseState(ulong c)
Parameters
Type Name Description
ulong c

The case index.

Returns
Type Description
ulong
Remarks

Generic declaration: public size_t GetCaseState (size_t c)

Exceptions
Type Condition
ExceptionHugin

GetCategory()

Returns the Category of this Node

Declaration
public override abstract Node.Category GetCategory()
Returns
Type Description
Node.Category
Overrides
Node.GetCategory()

GetEnteredFinding(ulong)

Returns the entered finding for state state of this node.

Declaration
public float GetEnteredFinding(ulong state)
Parameters
Type Name Description
ulong state

The index of the state to examine.

Returns
Type Description
float

A real number representing the entered finding.

Remarks

Generic declaration: public h_number_t GetEnteredFinding (size_t state)

Exceptions
Type Condition
ExceptionHugin

GetEntropy()

Computes the entropy of this node.

Declaration
public double GetEntropy()
Returns
Type Description
double
Exceptions
Type Condition
ExceptionHugin

GetExpectedUtility(ulong)

Returns the expected utility associated with the specified action (state).

Declaration
public float GetExpectedUtility(ulong state)
Parameters
Type Name Description
ulong state

The index of the state to examine.

Returns
Type Description
float

A value expressing the expected utility associated with state.

Remarks

Generic declaration: public h_number_t GetExpectedUtility (size_t state)

Exceptions
Type Condition
ExceptionHugin

GetKind()

Returns the Kind of this Node.

Declaration
public override Node.Kind GetKind()
Returns
Type Description
Node.Kind

H_KIND_DISCRETE

Overrides
Node.GetKind()

GetMutualInformation(DiscreteNode)

Computes the mutual information between this node and the specified node.

Declaration
public double GetMutualInformation(DiscreteNode node)
Parameters
Type Name Description
DiscreteNode node

The other node.

Returns
Type Description
double
Exceptions
Type Condition
ExceptionHugin

GetNumberOfStates()

Returns the number of states of this node.

Declaration
public ulong GetNumberOfStates()
Returns
Type Description
ulong

The number of states.

Remarks

The states are numbered from 0 to N-1.

Generic declaration: public size_t GetNumberOfStates ()

Exceptions
Type Condition
ExceptionHugin

GetPredictedBelief(ulong, ulong)

Returns the predicted belief for the specified state of this DiscreteNode at the specified time point.

Declaration
public float GetPredictedBelief(ulong state, ulong time)
Parameters
Type Name Description
ulong state

an integer value representing the state to examine.

ulong time

time slice index (a nonnegative integer less than the number of predicted time slices).

Returns
Type Description
float
Remarks

This method accesses the predictions computed by a previous call to ComputeDBNPredictions(ulong).

Generic declaration: public h_number_t GetPredictedBelief (size_t state, size_t time)

Exceptions
Type Condition
ExceptionHugin

GetPropagatedFinding(ulong)

Returns the propagated finding. That is, it returns the finding value incorporated within the current JunctionTree potentials for the specified state of this discrete node.

Declaration
public float GetPropagatedFinding(ulong state)
Parameters
Type Name Description
ulong state

The index of the state to be examined.

Returns
Type Description
float

A real number expressing the propagated finding.

Remarks

Generic declaration: public h_number_t GetPropagatedFinding (size_t state)

Exceptions
Type Condition
ExceptionHugin

GetSampledState()

Returns the state index of this DiscreteNode for the configuration generated by the most recent call to Simulate().

Declaration
public ulong GetSampledState()
Returns
Type Description
ulong

The state index sampled for this discrete node in the last invocation of Simulate() on the Domain of the node.

Remarks

Generic declaration: public size_t GetSampledState ()

Exceptions
Type Condition
ExceptionHugin

GetSensitivityConstants(ulong)

Returns the four constants of the specified sensitivity function.

Declaration
public float[] GetSensitivityConstants(ulong index)
Parameters
Type Name Description
ulong index

Specifies a conditional probability (or policy) parameter of this node (i.e., index is the index of an entry in the CPT/policy of this node).

Returns
Type Description
float[]

An array of size 4 containing the constants of the specified sensitivity function.

Remarks

The output probability of this function was specified in the preceding call to ComputeSensitivityData(ulong). If the results produced by that call have been invalidated, a usage exception is thrown.

Generic declaration: public h_number_t[] GetSensitivityConstants (size_t index)

Exceptions
Type Condition
ExceptionHugin

GetSensitivityConstants(ulong, ulong)

Returns the four constants of the specified sensitivity function.

Declaration
public float[] GetSensitivityConstants(ulong index, ulong output)
Parameters
Type Name Description
ulong index

Specifies a conditional probability (or policy) parameter of this node (i.e., index is the index of an entry in the CPT/policy of this node).

ulong output

Identifies one of the output probabilities specified in the call to ComputeSensitivityData(NodeList, ulong[]).

Returns
Type Description
float[]

An array of size 4 containing the constants of the specified sensitivity function.

Remarks

The output probability of this function must be one of the output probabilities specified in the preceding call to ComputeSensitivityData(NodeList, ulong[]). If the results produced by that call have been invalidated, a usage exception is thrown.

Generic declaration: public h_number_t[] GetSensitivityConstants (size_t index, size_t output)

Exceptions
Type Condition
ExceptionHugin

GetStateIndex(string)

Returns the index of the state matching the specified label. If there is no (unique) state with the specified state label, -1 is returned.

Declaration
public long GetStateIndex(string label)
Parameters
Type Name Description
string label

The state label to search for.

Returns
Type Description
long

The index of the state having the specified state label.

Remarks

Generic declaration: public h_index_t GetStateIndex (String label)

Exceptions
Type Condition
ExceptionHugin

GetStateLabel(ulong)

Returns the label of the specified state.

Declaration
public string GetStateLabel(ulong state)
Parameters
Type Name Description
ulong state

the index of the state; must be less than the number of states of the node.

Returns
Type Description
string

The label of the specified state.

Remarks

Generic declaration: public String GetStateLabel (size_t state)

Exceptions
Type Condition
ExceptionHugin

RetractFindings()

Retracts all findings for this node. This is equivalent to setting the finding value to 1 for all states of this node.

Declaration
public void RetractFindings()
Exceptions
Type Condition
ExceptionHugin

SelectState(ulong)

Selects the specified state of this discrete node.

Declaration
public void SelectState(ulong state)
Parameters
Type Name Description
ulong state

The index of the state to be selected. States are numbered consecutively from 0 and upwards.

Remarks

This is equivalent to specifying the finding value 1 for the specified state and 0 for all other states.

Generic declaration: public void SelectState (size_t state)

Exceptions
Type Condition
ExceptionHugin

SetCaseState(ulong, ulong)

Sets the state of this DiscreteNode to state in case c.

Declaration
public void SetCaseState(ulong c, ulong state)
Parameters
Type Name Description
ulong c

The case index.

ulong state

The state index.

Remarks

Generic declaration: public void SetCaseState (size_t c, size_t state)

Exceptions
Type Condition
ExceptionHugin

SetNumberOfStates(ulong)

Sets the number of states of this DiscreteNode.

Declaration
public void SetNumberOfStates(ulong newNumber)
Parameters
Type Name Description
ulong newNumber
Remarks

Generic declaration: public void SetNumberOfStates (size_t newNumber)

Exceptions
Type Condition
ExceptionHugin

SetStateLabel(ulong, string)

Sets the label of the specified state.

Declaration
public void SetStateLabel(ulong state, string newLabel)
Parameters
Type Name Description
ulong state

The index of the state; must be less than the number of states of the node.

string newLabel

The desired state label.

Remarks

Generic declaration: public void SetStateLabel (size_t state, String newLabel)

Exceptions
Type Condition
ExceptionHugin

UnsetCase(ulong)

Specifies that the state of this DiscreteNode is 'unknown' for case c.

Declaration
public void UnsetCase(ulong c)
Parameters
Type Name Description
ulong c

The case index.

Remarks

Generic declaration: public void UnsetCase (size_t c)

Exceptions
Type Condition
ExceptionHugin

Implements

ICloneable
In this article
Back to top Copyright (C) 2019-2025 Hugin Expert A/S