Node

public class Node : Hashable

Nodes are one of the fundamental objects used in the construction of Bayesian networks and LIMIDs. All nodes need a Network (i.e., a Class or a Domain); that is, the network must exist before its nodes can be created.

  • Undocumented

    Declaration

    Swift

    public let category: Node.Category
  • Undocumented

    Declaration

    Swift

    public let kind: Node.Kind
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Is this Node object alive? This checks whether the node has been deleted.

    Declaration

    Swift

    public func isAlive() -> Bool
  • The category of a node indicates whether the node is a chance node, a decison node, a utility node, a (real-valued or a discrete) function node, or a class instance node (representing an instance of a class in an OOBN).

    See more

    Declaration

    Swift

    public enum Category
  • This is used to distinguish between discrete, continuous, and other nodes.

    See more

    Declaration

    Swift

    public enum Kind
  • This is used to distinguish between (sub)types of discrete nodes. All discrete nodes can have labels associated with the states (not just nodes of subtype label).

    See more

    Declaration

    Swift

    public enum Subtype
  • Delete this node, including all objects (such as Table objects) belonging to it. Deletion causes all these objects to be not-alive.

    Declaration

    Swift

    public func delete() throws
  • Declaration

    Swift

    public static func == (lhs: Node, rhs: Node) -> Bool
  • Returns the Class or Domain containing this Node.

    Declaration

    Swift

    public func getHome() throws -> Network

    Return Value

    The Network containing this Node.

  • Sets the subtype of this Node.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func setSubtype(_ subtype: Subtype) throws
  • Returns the subtype of this Node.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func getSubtype() throws -> Subtype
  • Sets the name of this Node. The name must be valid, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the network to which this Node belongs must have the same name.

    Declaration

    Swift

    public func setName(_ newName: String) throws

    Parameters

    newName

    the name of the Node (a String).

  • Returns the name of this Node. If this node has not previously been assigned a name, a valid name will automatically be assigned.

    Declaration

    Swift

    public func getName() throws -> String

    Return Value

    the name of this node.

  • Sets the label of this Node.

    Declaration

    Swift

    public func setLabel(_ newLabel: String) throws

    Parameters

    newLabel

    the label (a String).

  • Returns the label of this Node.

    Declaration

    Swift

    public func getLabel() throws -> String?
  • Sets a value for a particular attribute in the attribute list for this Node. If no value (nil) is provided, the attribute is removed.

    Declaration

    Swift

    public func setAttribute(_ key: String, _ value: String?) throws

    Parameters

    key

    a String identifying the attribute in question.

    value

    a String containing the attribute value.

  • Returns the value associated with a particular attribute in the attribute list for this Node.

    Declaration

    Swift

    public func getAttribute(_ key: String) throws -> String?

    Parameters

    key

    a String identifying the attribute in question.

    Return Value

    A String containing the attribute value.

  • Returns the set of attributes (as a dictionary) associated with this Node.

    Declaration

    Swift

    public func getAttributes() throws -> [String : String]
  • Adds a node as a new parent of this Node. That is, it adds a directed link from the new parent to this Node.

    Declaration

    Swift

    public func addParent(_ parent: Node) throws

    Parameters

    parent

    the new parent Node.

  • Removes the directed link between a parent and this Node. The table (if any) of the Node will be updated such that the updated table will be the portion of the old table that corresponds to the parent being in its first state.

    Declaration

    Swift

    public func removeParent(_ parent: Node) throws

    Parameters

    parent

    the parent Node that will be removed.

  • Replace the given parent node with the new node. The old and new parent must be compatible. That is, they must be of the same class, and have an identical state set.

    Declaration

    Swift

    public func switchParent(_ oldParent: Node, _ newParent: Node) throws

    Parameters

    oldParent

    The old parent

    newParent

    The new parent

  • Reverses the edge between this Node and the specified neighbor. Both nodes must be chance nodes, and they must be of the same kind (that is, both nodes are discrete or both nodes are continuous).

    Declaration

    Swift

    public func reverseEdge(_ neighbor: Node) throws

    Parameters

    neighbor

    the neighbor in question.

  • Returns a list of nodes containing the parents of this Node.

    Declaration

    Swift

    public func getParents() throws -> [Node]
  • Returns a node list with the child Nodes of this Node.

    Declaration

    Swift

    public func getChildren() throws -> [Node]
  • Returns a list of nodes containing the requisite parents of this node.

    Requires

    This only applies to decision nodes in domains.

    Declaration

    Swift

    public func getRequisiteParents() throws -> [Node]
  • Returns a list of nodes containing the requisite ancestors of this Node.

    The requisite ancestors are found by augmenting the network with additional information links as prescribed by the “no-forgetting” rule (which states that past observations and decisions are taken into account by all future decisions) and applying the minimal reduction algorithm for LIMIDs.

    Requires

    This only applies to decision nodes in domains.

    Declaration

    Swift

    public func getRequisiteAncestors() throws -> [Node]
  • Sets the number of states of this node.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func setNumberOfStates(_ stateCount: Int) throws
  • Returns the number of states of this node. The states are numbered from 0 to N-1, where N is the number of states of the node.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func getNumberOfStates() throws -> Int
  • Sets the label of the specified state.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func setStateLabel(_ state: Int, _ newLabel: String) throws

    Parameters

    state

    the index (a nonnegative integer) of the state; must be less than the number of states of the node.

    newLabel

    the desired state label (a String).

  • Returns the label of the specified state.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func getStateLabel(_ state: Int) throws -> String

    Parameters

    state

    the index (a nonnegative integer) of the state; must be less than the number of states of the node

    Return Value

    the label (a String) of the specified state

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

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func getStateIndex(label: String) throws -> Int?

    Parameters

    label

    the state label to search for

    Return Value

    the index of the unique state having the specified state label.

  • Reorders the list of states of this node. The order list must contain the state labels of this node in the desired order.

    In addition to reordering the state labels of this node, the contents of all tables and models containing this node, and case data associated with this node, are updated to match the new ordering of the states.

    The states of this node must be uniquely labeled.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func reorderStates(_ order: [String]) throws

    Parameters

    order

    the new order (which must be a permutation of the current order) of the state labels of this node.

  • Sets the value associated with a particular state of this node.

    Requires

    This only applies to discrete nodes. The subtype of the node must be number or interval.

    Declaration

    Swift

    public func setStateValue(_ state: Int, _ value: Double) throws

    Parameters

    state

    the index of the state in question.

    value

    the new value for state state.

  • Returns the value associated with a particular state of this node.

    Requires

    This only applies to discrete nodes. The subtype of the node must be number or interval.

    Declaration

    Swift

    public func getStateValue(_ state: Int) throws -> Double

    Parameters

    state

    the index of the state in question.

  • Returns the index of the state matching the specified value. If there is no (unique) state matching the specified state value, nil is returned.

    Requires

    This only applies to discrete nodes. The subtype of the node must be number or interval.

    Declaration

    Swift

    public func getStateIndex(value: Double) throws -> Int?

    Parameters

    value

    the value to match against the states of this node.

    Return Value

    the index of the state matching the specified value.

  • Returns the Model for this Node.

    Declaration

    Swift

    public func getModel() throws -> Model?
  • Generates the table of this Node from its model (a missing model will trigger a HuginError.usage error).

    Declaration

    Swift

    public func generateTable() throws
  • Returns the JunctionTree to which this Node belongs.

    Declaration

    Swift

    public func getJunctionTree() throws -> JunctionTree
  • Returns the predicted belief for the specified state of this node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions(Int).

    Requires

    This only applies to discrete nodes in DBN runtime domains.

    Declaration

    Swift

    public func getPredictedBelief(_ state: Int, _ time: Int) throws -> Double

    Parameters

    state

    an integer value representing which state to examine.

    time

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

    Return Value

    A real number representing the belief.

  • Returns the predicted mean of the marginal distribution of this node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions(Int).

    Requires

    This only applies to continuous nodes in DBN runtime domains.

    Declaration

    Swift

    public func getPredictedMean(_ time: Int) throws -> Double

    Parameters

    time

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

  • Returns the predicted variance of the marginal distribution of this node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions(Int).

    Requires

    This only applies to continuous nodes in DBN runtime domains.

    Declaration

    Swift

    public func getPredictedVariance(_ time: Int) throws -> Double

    Parameters

    time

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

  • Returns the predicted value of this node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions(Int).

    Requires

    This only applies to real-valued function nodes in DBN runtime domains.

    Declaration

    Swift

    public func getPredictedValue(_ time: Int) throws -> Double

    Parameters

    time

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

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

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func enterFinding(_ state: Int, _ finding: Double) throws

    Parameters

    state

    an integer representing the state to be selected. States are numbered consecutively from 0 and upwards.

    finding

    A nonnegative real number as the finding value.

  • Returns the entered finding for the specified state of this node.

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getEnteredFinding(_ state: Int) throws -> Double

    Parameters

    state

    an integer value representing which state to examine.

    Return Value

    A real number representing the entered finding.

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

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getPropagatedFinding(_ state: Int) throws -> Double

    Parameters

    state

    an integer representing the state to be examined.

  • Retracts all evidence for this node.

    Requires

    This only applies to discrete/continuous nodes in domains.

    Declaration

    Swift

    public func retractFindings() throws
  • Enters evidence (observation of a numeric value) for this Node.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func enterValue(_ value: Double) throws
  • Returns the evidence (value) entered for this Node. If no value has been entered, nil is returned.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func getEnteredValue() throws -> Double?
  • Retrieves the value that has been propagated for this Node. That is, the value incorporated in the current junction tree potentials as the state of this node.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func getPropagatedValue() throws -> Double?
  • Returns true if the evidence potential, currently registered with this Node, is non-vacuous; otherwise, returns false.

    Requires

    This only applies to discrete/continuous nodes in domains.

    Declaration

    Swift

    public func evidenceIsEntered() throws -> Bool
  • Returns true if the evidence potential, currently registered with this Node, is a likelihood; otherwise, returns false.

    Requires

    This only applies to discrete/continuous nodes in domains.

    Declaration

    Swift

    public func likelihoodIsEntered() throws -> Bool
  • Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is non-vacuous; otherwise, returns false.

    Requires

    This only applies to discrete/continuous nodes in domains.

    Declaration

    Swift

    public func evidenceIsPropagated() throws -> Bool
  • Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, a likelihood; otherwise, returns false.

    Requires

    This only applies to discrete/continuous nodes in domains.

    Declaration

    Swift

    public func likelihoodIsPropagated() throws -> Bool
  • Returns the belief for the specified state of this DiscreteNode. Note that if findings have been entered since the most recent propagation, the beliefs returned may not be up-to-date.

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getBelief(_ state: Int) throws -> Double

    Parameters

    state

    an integer value representing which state to examine.

    Return Value

    A real number representing the belief.

  • Returns the mean of the marginal distribution of this node.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func getMean() throws -> Double
  • Returns the variance of the marginal distribution of this node.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func getVariance() throws -> Double
  • Returns the distribution for this node. The distribution for a continuous chance node is in general a mixture of several Gaussian distributions. This method computes a joint distribution of this CG node and a set of discrete nodes. These discrete nodes are chosen such that the computed marginal is a strong marginal, but it is not necessarily minimal.

    Requires

    This only applies to continuous nodes in domains.

    Declaration

    Swift

    public func getDistribution() throws -> Table

    Return Value

    A Table holding a strong marginal of this node and a set of discrete nodes.

  • If this node is a discrete node: Returns the expected utility associated with the specified action (state).

    If this node is a utility node: Returns the expected utility associated with the node.

    This is the utility value computed by the most recent inference operation.

    Requires

    This only applies to discrete nodes and utility nodes in domains.

    Declaration

    Swift

    public func getExpectedUtility(state: Int = 0) throws -> Double

    Parameters

    state

    An integer value designating which state to examine.

  • Returns the variance of the utility associated with this node. This is the variance of the utility value computed by the most recent inference operation.

    Requires

    This only applies to utility nodes in domains.

    Declaration

    Swift

    public func getVarianceOfUtility() throws -> Double
  • Returns the minimum possible utility associated with this node. This is the smallest utility value for this node with a positive probability as computed by the most recent inference operation.

    Requires

    This only applies to utility nodes in domains.

    Declaration

    Swift

    public func getMinUtility() throws -> Double
  • Returns the maximum possible utility associated with this node. This is the largest utility value for this node with a positive probability as computed by the most recent inference operation.

    Requires

    This only applies to utility nodes in domains.

    Declaration

    Swift

    public func getMaxUtility() throws -> Double
  • Returns the value of this node. The value is computed using the function associated with the node. If the function refers to other nodes, then the values of those nodes are derived from the results of the most recent inference operation.

    Requires

    This only applies to real-valued function nodes.

    Declaration

    Swift

    public func getValue() throws -> Double
  • Returns the table associated with this Node.

    If the node is a discrete chance node, the table is the conditional probability table for the node given its parents.

    If the node is a utility node, the table represents a utility function of the parents of the node.

    Declaration

    Swift

    public func getTable() throws -> Table
  • Returns the experience table of this node.

    Requires

    This only applies to chance nodes.

    Declaration

    Swift

    public func getExperienceTable() throws -> Table
  • Returns true if this node has an experience table; returns false otherwise.

    Requires

    This only applies to chance nodes.

    Declaration

    Swift

    public func hasExperienceTable() throws -> Bool
  • Returns the fading table of this node.

    Requires

    This only applies to discrete chance nodes.

    Declaration

    Swift

    public func getFadingTable() throws -> Table
  • Returns true if this node has a fading table; returns false otherwise.

    Requires

    This only applies to discrete chance nodes.

    Declaration

    Swift

    public func hasFadingTable() throws -> Bool
  • Sets the alpha component of the CG distribution of this node given the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func setAlpha(_ index: Int, _ alpha: Double) throws

    Parameters

    index

    the index of a discrete parent configuration.

    alpha

    the value of the alpha component.

  • Sets the beta component of the CG distribution of this node given a continuous parent and the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func setBeta(_ index: Int, _ parent: Node, _ beta: Double) throws

    Parameters

    index

    the index of a discrete parent configuration.

    parent

    a continuous parent of this node.

    beta

    the value of the beta component.

  • Sets the gamma component of the CG distribution of this node given the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func setGamma(_ index: Int, _ gamma: Double) throws

    Parameters

    index

    the index of a discrete parent configuration.

    gamma

    the value of the gamma component.

  • Returns the alpha component of the CG distribution of this node given the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func getAlpha(_ index: Int) throws -> Double

    Parameters

    index

    the index of a discrete parent configuration.

    Return Value

    the alpha component.

  • Returns the beta component of the CG distribution of this node given a continuous parent and the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func getBeta(_ index: Int, _ parent: Node) throws -> Double

    Parameters

    index

    the index of a discrete parent configuration.

    parent

    a continuous parent of this node.

    Return Value

    the beta component.

  • Returns the gamma component of the CG distribution of this node given the discrete parent configuration corresponding to index.

    Requires

    This only applies to continuous chance nodes.

    Declaration

    Swift

    public func getGamma(_ index: Int) throws -> Double

    Parameters

    index

    the index of a discrete parent configuration.

    Return Value

    the gamma component.

  • Selects the specified state of this node. This is equivalent to specifying the finding value 1 for the specified state and 0 for all other states.

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func selectState(_ state: Int) throws
  • Returns a list of Node objects belonging to classes, if this Node belongs to a runtime domain. Otherwise, nil is returned.

    The Domain.init(Class) initializer unfolds an OOBN (an object-oriented specification of a Bayesian network or a LIMID) into a regular Domain object.

    Nodes in this domain which originates from nodes residing in nested sub-networks (via instance nodes) can be uniquely related to a sequence of instance nodes and an ordinary node of the OOBN.

    Declaration

    Swift

    public func getSource() -> [Node]?

    Return Value

    An ordered list of nodes containing the instance nodes and the ordinary node identifying the source of this Node.

  • Sets the state of this node for the specified case.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func setCase(_ c: Int, state: Int) throws

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

    state

    the state of the specified case for this node

  • Returns the state of this node for the specified case. Returns nil if no state has been set.

    Requires

    This only applies to discrete nodes.

    Declaration

    Swift

    public func getCaseState(_ c: Int) throws -> Int?

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

  • Sets the value of this node for the specified case.

    Requires

    This only applies to continuous nodes.

    Declaration

    Swift

    public func setCase(_ c: Int, value: Double) throws

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

    value

    the value of the specified case for this Node

  • Returns the value of this node for the specified case. Returns nil if no value has been set.

    Requires

    This only applies to continuous nodes.

    Declaration

    Swift

    public func getCaseValue(_ c: Int) throws -> Double?

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

  • Specifies that the state or value of this node is “unknown” for the specified case.

    Declaration

    Swift

    public func unsetCase(_ c: Int) throws

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

  • Returns true if a state or a value has been set for this node in the specified case; otherwise, returns false.

    Declaration

    Swift

    public func caseIsSet(_ c: Int) throws -> Bool

    Parameters

    c

    the index of the case (an integer in the range 0, …, number of cases - 1)

  • Sets an edge constraint between this node and another node. The constraint must be an instance of Network.EdgeConstraint.

    Declaration

    Swift

    public func setEdgeConstraint (_ node: Node,
     _ constraint: Network.EdgeConstraint) throws

    Parameters

    node

    the other node in the constraint.

    constraint

    the constraint to set.

  • Returns the edge constraint between this node and another node.

    Declaration

    Swift

    public func getEdgeConstraint (_ node: Node)
    throws -> Network.EdgeConstraint

    Parameters

    node

    the other node in the constraint.

    Return Value

    The Network.EdgeConstraint set between the two nodes.

  • Returns true if the entered and the propagated evidence differ; otherwise, returns false.

    Declaration

    Swift

    public func evidenceToPropagate() throws -> Bool
  • Returns the state index of this node for the configuration generated by the most recent call to Domain.simulate().

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getSampledState() throws -> Int
  • Returns the value of this node for the configuration generated by the most recent call to Domain.simulate().

    Requires

    This only applies to continuous nodes and real-valued function nodes in domains.

    Declaration

    Swift

    public func getSampledValue() throws -> Double
  • Returns the sampled utility associated with this node. This is the utility value determined by the most recent call to Domain.simulate().

    Requires

    This only applies to utility nodes in domains.

    Declaration

    Swift

    public func getSampledUtility() throws -> Double
  • Computes the entropy of this node.

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getEntropy() throws -> Double
  • Computes the mutual information between this node and the specified node.

    Requires

    This only applies to discrete nodes in domains.

    Declaration

    Swift

    public func getMutualInformation(_ node: Node) throws -> Double

    Parameters

    node

    the other node (must be discrete)

  • Computes the constants of the sensitivity functions for the specified output probability and all CPT/policy parameters in the network.

    This method simply calls Domain.computeSensitivityData([Node],[Int]) with the specified output probability as argument.

    Declaration

    Swift

    public func computeSensitivityData(_ state: Int) throws

    Parameters

    state

    the index of a state of this node - the probability of this state is the desired output probability.

  • Returns the four constants of the specified sensitivity function. The output probability of this function was specified in the preceding call to Node.computeSensitivityData(Int). If the results produced by that call have been invalidated, a usage error is thrown.

    Declaration

    Swift

    public func getSensitivityConstants (_ input: Int)
    throws -> (Double, Double, Double, Double)

    Parameters

    input

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

    Return Value

    a 4-tuple containing the constants of the specified sensitivity function.

  • Returns the four constants of the specified sensitivity function. The output probability of this function must be one of the output probabilities specified in the preceding call to Domain.computeSensitivityData([Node],[Int]). If the results produced by that call have been invalidated, a usage error is thrown.

    Declaration

    Swift

    public func getSensitivityConstants (_ input: Int, _ output: Int)
    throws -> (Double, Double, Double, Double)

    Parameters

    input

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

    output

    identifies one of the output probabilities specified in the call to Domain.computeSensitivityData([Node],[Int]).

    Return Value

    a 4-tuple containing the constants of the specified sensitivity function.

  • Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size. 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 Domain.getExplanation(Int) and Domain.getExplanationScore(Int).

    Declaration

    Swift

    public func computeExplanationData (_ x: Int, _ Y: Node, _ y: Int,
    	_ maxSubsetSize: Int) throws

    Parameters

    x

    state of the primary hypothesis node (this node)

    Y

    the alternative hypothesis node (must be discrete)

    y

    state of the alternative hypothesis node

    maxSubsetSize

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

  • Computes “normalized likelihoods” for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size. 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 Domain.getExplanation(Int) and Domain.getExplanationScore(Int).

    Declaration

    Swift

    public func computeExplanationData (_ state: Int, _ maxSubsetSize: Int)
    throws

    Parameters

    state

    state of the hypothesis node (this node)

    maxSubsetSize

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

  • Makes this Node become an input node of its class.

    Requires

    This only applies to nodes in classes.

    Declaration

    Swift

    public func addToInputs() throws
  • Removes this Node from the set of input nodes of its class.

    Declaration

    Swift

    public func removeFromInputs() throws
  • Makes this Node become an output node of its class.

    Requires

    This only applies to nodes in classes.

    Declaration

    Swift

    public func addToOutputs() throws
  • Removes this Node from the set of output nodes of its class.

    Declaration

    Swift

    public func removeFromOutputs() throws
  • Returns the instance class of this instance node (i.e., the class on which this instance node is based).

    Requires

    This method only applies to instance nodes.

    Declaration

    Swift

    public func getInstanceClass() throws -> Class
  • Returns the “master” of this output clone.

    An “instance node” represents an instance of some Class in an OOBN. This class has a set of output nodes. When an instance of a class is created, clones of the output nodes of the instantiated class are created and associated with the instance node. The output nodes of the instantiated class are referred to as “masters” of the output clones.

    Declaration

    Swift

    public func getMaster() throws -> Node?

    Return Value

    The “master” of this Node if it is an output clone; otherwise, the method returns nil.

  • Returns the “instance node” associated with this output clone.

    An “instance node” represents an instance of some Class in an OOBN. This class has a set of output nodes. When an instance of a class is created, clones of the output nodes of the instantiated class are created and associated with the instance node.

    Declaration

    Swift

    public func getInstance() throws -> Node?

    Return Value

    The “instance node” associated with this output clone. If this node is not an output clone, nil is returned.

  • Returns the output clone associated with this instance node for the given output node (belonging to the class represented by this instance node).

    Requires

    This method only applies to instance nodes.

    Declaration

    Swift

    public func getOutput(_ output: Node) throws -> Node

    Parameters

    output

    an output node in the class that this node is an instance of.

    Return Value

    the output clone corresponding to output for this instance node.

  • Constructs a temporal clone of this Node object. This node (known as the “master” node) must not be an instance node, or a temporal or an output clone, and the node must belong to a class without input and output nodes. Moreover, this class must not be instantiated. Only one temporal clone can be created for each master node.

    Declaration

    Swift

    public func createTemporalClone() throws -> Node
  • Returns the “temporal clone” of this Node. If this node doesn’t have a temporal clone, nil is returned.

    Declaration

    Swift

    public func getTemporalClone() throws -> Node?
  • Returns the “temporal master” of this Node. If this node is not a temporal clone, nil is returned.

    Declaration

    Swift

    public func getTemporalMaster() throws -> Node?
  • Sets the position of this Node.

    Declaration

    Swift

    public func setPosition(_ x: Int, _ y: Int) throws
  • Returns the position of this Node.

    Declaration

    Swift

    public func getPosition() throws -> (Int, Int)

    Return Value

    The coordinates of the node as a pair of integers