SMILE.NET: Network
From DSL
This class holds most of the functionalities of the library.
Contents |
[edit] Interfaces
- IEnumerable
This interface returns IEnumerator iterating through nodes in the network returning their handles.
More information can be found on Microsoft's MSDN Web site.
- IDisposable
This interface takes care of freeing the memory. It deletes original SMILE DSL_network object, a reference to which is held in Network class).
More information can be found on Microsoft's MSDN Web site.
- ICloneable
This interface enables making copies of existing Network objects. It can be used when it is desired to have a new instance of a particular, already existing Network object rather than only a pointer to it. The usage is given below:
Network net01 = new Network(); ... Network net02 = (Network)net01.Clone();
Take heed to type casting.
Be aware that writing:
Network net02 = net01;
will effect in both net01 and net02 pointers referring to the very same object. Changes made "through" net01 will be visible in net02 and vice versa.
More information can be found on Microsoft's MSDN Web site.
[edit] Custom Data Types
- BayesianAlgorithmType
Enumerates algorithms to be used when updating a belief network (as opposed to an influence diagram). The values are: Lauritzen, Henrion, Pearl, LSampling, SelfImportance, HeuristicImportance, BackSampling, AisSampling, and EpisSampling.
For more detailed information on the above algorithms please consult SMILE On-Line Documentation.
- InfluenceDiagramAlgorithmType
Enumerates algorithms to be used when updating an influence diagram (as opposed to a belief network). The values are: PolicyEvaluation and FindBestPolicy.
For more detailed information on the above algorithms please consult SMILE On-Line Documentation.
- NodeType
Enumerates node types.
| Type of node | Description |
| Cpt | Conditional Probability Table
Represents a discrete random variable with a set of states representing the possible outcomes of the variable. The definition consist of one list of vectors of numbers, one vector for each combination of outcomes of the parents, each vector containing the conditional probability distribution over the outcomes of the variable. This list of vectors is implemented as a one-dimensional array. |
| TruthTable | Truth Table
Represents a discrete deterministic variable with a set of states representing the possible outcomes of the variable. The definition consists of one list of vectors of numbers, one vector for each combination of outcomes of the parents, each vector containing the state of the node for the given combination of parents. The outcome of the node is represented in this vector by assigning 1 to the probability of that outcome and 0 to the probability of the rest of the outcomes. |
| List | Decision
Represents a discrete decision variable with a set of states representing the possible choices of the variable. The definition consists of a list of strings naming the choices. |
| Table | Utility
Represents a continuous utility function with discrete parents. The definition consists of a vector of numbers expressing the utility of each combination of outcomes of the parents. This node can only have discrete nodes as parents. |
| Mau | Multi-Attribute Utility
Represents a continuous linearly additive utility function, i.e., a linear combination of its parents. The definition consists on one vector of numbers, one number for each of the node's parents, each number being the weight associated with the corresponding parent. This node can only have continuous nodes as parents. |
| NoisyMax | Local Conditional Probability Model
Represents a discrete random variable with a set of states representing the possible outcomes of the variable. The noisy-MAX model for local probability distribution is a compact, parametric representation of the conditional probability distribution, allowing to represent the noisy-OR, noisy-AND and noisy-MAX/MIN distributions. The definition consists of one list of vectors of numbers, one vector for each individual outcome of a parent for all parents. Each vector contains the conditional probability distribution over the outcomes of the variable. This list of vectors is implemented as a one-dimensional array. |
- NodeDiagType
Enumerates node diagnostic types.
| Type of node | Description |
| Faults | This type of node contains the possible faults (the states the user wishes to pursue) or fault states in a network, where each target node contains at least one fault state. |
| Observation | This type of node represents a possible test or observation that the user can perform during the diagnosis session. |
| Auxiliary | This type of node represents the nodes, which are neither target nor observation nodes. These nodes will serve no special purpose in the diagnosis session, apart from probabilistic influence or modeling purposes. |
[edit] Properties
- String Id (read, write)
String Name (read, write) String Description (read, write)
The id, name, and description of the network.
- BayesianAlgorithmType BayesianAlgorithm (read, write)
A type of the algorithm to be used when updating a belief network (as opposed to an influence diagram).
The available algorithms are enumerated in the BayesianAlgorithmType type.
- InfluenceDiagramAlgorithmType InfluenceDiagramAlgorithm (read, write)
A type of the algorithm to be used when updating an influence diagram (as opposed to a belief network). A Bayesian (belief) network algorithm used when solving an influence diagram will be the one set using BayesianAlgorithm property.
The available algorithms are enumerated in the InfluenceDiagramAlgorithmType type.
[edit] Operators
- String [int nodeHandle]
Returns the id of the specified node.
Usage examples:
...
Network net = new Network();
net.ReadFile("some_network.xdsl");
String nodeId = net[1];
...
...
Network net = new Network();
net.ReadFile("some_network.xdsl");
foreach (int handle in net)
Console.WriteLine("Node {0}, {1}, {2}", handle, net[handle],
net.GetNodeName(handle));
...
[edit] Methods: General
- Network()
The constructor.
- System::Object Clone()
Creates a copy of the Network object (System.Object is returned, so casting is required). Usage example:
Network net01 = new Network(); ... Network net02 = (Network)net01.Clone();
For more information consult ICloneable interface description.
- bool ReadFile(String fileName)
Fills the network with the contents of a specified file. The file name must include the full path if needed.
- bool WriteFile(String fileName)
Writes the contents of the network to a specified file. The file name must include the full path if needed.
- void UpdateBeliefs()
Updates the network using the algorithms set with BayesianAlgorithm and InfluenceDiagramAlgorithm properties. Only those nodes that are relevant to the nodes that are marked as targets will be updated. If no nodes are marked as targets, all the nodes of the network will be updated.
- int AddNode(NodeType nodeType)
Adds a node of a specified type to the network. If the node is correctly created, the returning value will be its handle. This handle is guaranteed to remain constant for the lifetime of the network (i.e., from the creation of a network object till its destruction; a handle is not saved to a file).
The available node types are enumerated in the NodeType type.
- int AddNode(NodeType nodeType, String nodeId)
Adds a node of a specified type and with a specified id to the network. If the node is correctly created, the returning value will be its handle. This handle is guaranteed to remain constant for the lifetime of the network (i.e., from the creation of a network object till its destruction; a handle is not saved to a file).
The available node types are enumerated in the NodeType type.
- int GetNodeType(int nodeHandle)
int GetNodeType(String nodeId)
Returns the type of a specified node.
The available node types are enumerated in the NodeType type.
- int DeleteNode(int nodeHandle)
int DeleteNode(String nodeId)
Deletes the specified node.
- int GetNodesCount()
Returns the number of nodes in the network.
- int GetFirstNode()
Returns the handle of the first node of the network. A combination of GetFirstNode() and GetNextNode() methods can be used to traverse the whole network.
If the network contains no nodes a negative value is returned.
- int GetNextNode(int nodeHandle)
Returns the handle of a node being next after the given node with a given handle (not necessarily is it nodeHandle+1). A combination of GetFirstNode() and GetNextNode() methods can be used to traverse the whole network.
If the specified node is the last one in the network a negative value is returned.
- int GetNode(String nodeId)
Returns the handle of a specified node.
- void SetNodeId(int nodeHandle, String id)
void SetNodeId(String oldId, String newId)
Sets the id of a specified node.
- String GetNodeId(int nodeHandle)
Returns the id of a specified node.
- void SetNodeName(int nodeHandle, String name)
void SetNodeName(String nodeId, String name)
Sets the name of a specified node.
- String GetNodeName(int nodeHandle)
String GetNodeName(String nodeId)
Returns the name of a specified node.
- int[] GetAllNodes()
Returns handles of all the nodes in the network.
- String[] GetAllNodeIds()
Returns ids of all the nodes in the network.
- void AddArc(int parentHandle, int childHandle)
void AddArc(String parentId, String childId)
Adds an arc from a parent to a child. For this method to succeed, all of the following conditions must be true:
1. parentHandle (parentId) and childHandle (childId) are valid node handles (ids),
2. the arc will not create a cycle,
3. there is no arc from the parent to the child, and
4. the child can have the parent as a parent given their type (e.g., a Mau-typed node cannot have a Cpt-typed one as a parent).
Affected nodes will be invalidated if relevance reasoning is active.
- void DeleteArc(int parentHandle, int childHandle)
void DeleteArc(String parentId, String childId)
Removes an arc from a parent to a child. For this method to succeed the parent and the child must be valid nodes and the arc must exist. If the node has a table indexed by the parent, this table will "shrunk", i.e., the dimension corresponding to the parent will be removed. The contents preserved correspond to the outcome 0 (zero) of the parent. Affected nodes will be invalidated if relevance is active.
- int GetOutcomeCount(int nodeHandle)
int GetOutcomeCount(String nodeId)
Returns the number of outcomes of a specified node.
- void AddOutcome(int nodeHandle, String outcomeId)
void AddOutcome(String nodeId, String outcomeId)
Adds the new outcome with a specified id to a specified node. The outcome will be added at the end of the outcomes list.
void InsertOutcome(int nodeHandle, int position, String outcomeId) void InsertOutcome(String nodeId, int position, String outcomeId)
Inserts the new outcome with a specified id to a specified node. The outcome will be added at the specified position.
- void DeleteOutcome(int nodeHandle, int outcomeIndex)
void DeleteOutcome(String nodeId, int outcomeIndex) void DeleteOutcome(int nodeHandle, String outcomeId) void DeleteOutcome(String nodeId, String outcomeId)
Removes the specified outcome from a specified node.
- void SetOutcomeId(int nodeHandle, int outcomeIndex, String id)
void SetOutcomeId(String nodeId, int outcomeIndex, String id)
Sets the id of a specified outcome of a specified node.
- String GetOutcomeId(int nodeHandle, int outcomeIndex)
String GetOutcomeId(String nodeId, int outcomeIndex)
Returns the id of a specified outcome of a specified node.
- String[] GetOutcomeIds(int nodeHandle)
String[] GetOutcomeIds(String nodeId)
Returns ids of all the outcomes of a specified node.
- int[] GetParents(int nodeHandle)
int[] GetParents(String nodeId)
Returns handles of all the parents of a specified node.
- String[] GetParentIds(int nodeHandle)
String[] GetParentIds(String nodeId)
Returns ids of all the parents of a specified node.
- int[] GetChildren(int nodeHandle)
int[] GetChildren(String nodeId)
Returns handles of all the children of a specified node.
- String[] GetChildIds(int nodeHandle)
String[] GetChildIds(String nodeId)
Returns ids of all the children of a specified node.
- void SetNodeDefinition(int nodeHandle, double definition[])
void SetNodeDefinition(String nodeId, double definition[])
Sets the definition of a specified node. Remember to always pass an array of the correct size.
Normally, when a node has no parents its definition is a vector (or a one-dimentional array). However, the definition can be a multidimensional array. It happens when one or more nodes index the node's definition, i.e., they are its parents. In that case those multiple dimensions have to be encoded into a vector.
The order of probabilities is given by considering the state of the first parent of the node as the most significant coordinate (thinking of the coordinates in terms of bits), then the second parent, and so on, and finally considering the coordinate of the node itself as the least significant one.
Consult Tutorial 1 for an example on setting a node's definition.
- double[] GetNodeDefinition(int nodeHandle)
double[] GetNodeDefinition(String nodeId)
Returns the definition of a specified node.
This function will always return a vector (or a one-dimentional array). If the node has one or more parents the multiple dimensions of the definitions will be encoded into a vector. You have to use the information on the number of parents and the number of their outcomes to decode the probabilities.
The order of probabilities, is given by considering the state of the first parent of the node as the most significant coordinate (thinking of the coordinates in terms of bits), then the second parent, and so on, and finally considering the coordinate of the node itself as the least significant one.
- double[] GetNodeValue(int nodeHandle)
double[] GetNodeValue(String nodeId)
Returns the value matrix of a specified node. Before this method can be called value has to be updated. Update the network to validate all the values.
- bool IsValueValid(int nodeHandle)
bool IsValueValid(String nodeId)
Checks if the value of the specified node is valid. To validate the value update the network.
- int[] GetValueIndexingParents(int nodeHandle)
int[] GetValueIndexingParents(String nodeId)
Returns handles of parents which index a value of a specified node.
String[] GetValueIndexingParentIds(int nodeHandle) String[] GetValueIndexingParentIds(String nodeId)
Returns ids of parents which index a value of a specified node.
- void SetNoisyParentStrengths(int nodeHandle, int parentIndex, int[] strengths)
void SetNoisyParentStrengths(String nodeId, int parentIndex, int[] strengths) void SetNoisyParentStrengths(int nodeHandle, String parentId, int[] strengths) void SetNoisyParentStrengths(String nodeId, String parentId, int[] strengths)
Allows to set parent's strengths for a specified node in its parent node defined by parentIndex. The array strengths should contain integers ranging from 0 to n-1, where n is the number of the parent's states and 0 corresponds to the strongest influence. The "distinguished" state for the noisy-MAX should have an index of n-1.
- int[] GetNoisyParentStrengths(int nodeHandle, int parentIndex)
int[] GetNoisyParentStrengths(String nodeId, int parentIndex) int[] GetNoisyParentStrengths(int nodeHandle, String parentId) int[] GetNoisyParentStrengths(String nodeId, String parentId)
Returns the array of indexes of outcomes of a specified node in a parent node defined by parentIndex, which is indexed by the strengths. The value of the array at 0th position indicates the strongest influence.
- void SetTarget(int nodeHandle, boolean target)
void SetTarget(String nodeId, boolean target)
Marks a specified node as a target node. When updating the network, only those nodes that are relevant to the target nodes will be taken into account. See the section on relevance reasoning for more details.
- bool IsTarget(int nodeHandle)
bool IsTarget(String nodeId)
Checks if aspecified node is marked as target.
- void ClearAllTargets()
Clears target marks for all nodes.
- void SetEvidence(int nodeHandle, int outcomeIndex)
void SetEvidence(String nodeId, int outcomeIndex) void SetEvidence(int nodeHandle, String outcomeId) void SetEvidence(String nodeId, String outcomeId)
Sets a specified outcome to be an evidence for a specified node. An outcome with the probability of 0 (zero) cannot be set as evidence.
- int GetEvidence(int nodeHandle)
int GetEvidence(String nodeId)
Returns the index of an outcome being an evidence for a specified node.
- String GetEvidenceId(int nodeHandle)
String GetEvidenceId(String nodeId)
Returns the id of an outcome being an evidence for a specified node.
- bool IsEvidence(int nodeHandle)
bool IsEvidence(String nodeId)
Checks if a specified node has an evidence set.
- void ClearEvidence(int nodeHandle)
void ClearEvidence(String nodeId)
Clears the evidence for a specified node. The node will be invalidated if relevance reasoning is active.
- void ClearAllEvidence()
Clears all the evidence in the network. Affected nodes will be invalidated if relevance reasoning is active.
[edit] Methods: Visual Properties
SMILE.NET allows for setting visual properties of the network (nodes, arc). Those visual properties are read when a model is opened in GeNIe.
- void SetNodePosition(int nodeHandle, int x, int y, int width, int height)
void SetNodePosition(String nodeId, int x, int y, int width, int height)
Sets the position of a specified node (this property is read by GeNIe). The (x, y) are the coordinates of the upper left corner of a node's rectangle.
- void SetNodePosition(int nodeHandle, System.Drawing.Rectangle rect)
void SetNodePosition(String nodeId, System.Drawing.Rectangle rect)
Sets the position of a specified node (this property is read by GeNIe).
More information on System.Drawing.Rectangle structure can be found on Microsoft's MSDN Web site.
- System.Drawing.Rectangle GetNodePosition(String nodeHandle)
System.Drawing.Rectangle GetNodePosition(String nodeId)
Returns the position of a specified node. It is returned as a System.Drawing.Rectangle structure. This structure gives an access to a number of interesting methods and properties, e.g.:
net.GetNodePosition("node_id").Right;
More information on System.Drawing.Rectangle structure can be found on Microsoft's MSDN Web site.
- void SetNodeBgColor(int nodeHandle, System.Drawing.Color color)
void SetNodeBgColor(String nodeId, System.Drawing.Color color)
Sets the background (interior) color for a specified node (this is read by GeNIe). System.Drawing.Color structure is used to pass the desired color. Using this structure you can use (1) predefined color constants, and (2) colors constructed with RGB components.
net.SetNodeBgColor("node_id", Color.Tomato);
net.SetNodeBgColor("node_id", Color.FromArgb(11, 22, 33));
The Color class supports alpha channel, but SMILE.NET does not, i.e., you always work without any transparency. That's why colors retrieved using GetXXX() methods will always have alpha channel set to 255 value. Value of alpha channel passed as an argument to SetXXX() methods is ignored.
More information on System.Drawing.Color structure can be found on Microsoft's MSDN Web site.
- System.Drawing.Color GetNodeBgColor(int nodeHandle)
System.Drawing.Color GetNodeBgColor(String nodeId)
Returns the background (interior) color for a specified node. A System.Drawing.Color structure is returned.
More information on System.Drawing.Color structure can be found on Microsoft's MSDN Web site.
- void SetNodeTextColor(int nodeHandle, System.Drawing.Color color)
void SetNodeTextColor(String nodeId, System.Drawing.Color color)
Sets the text (font) color for a specified node (this is read by GeNIe). System.Drawing.Color structure is used to pass the desired color. Using this structure you can use (1) predefined color constants, and (2) colors constructed with RGB components.
net.SetNodeTextColor("node_id", Color.Tomato);
net.SetNodeTextColor("node_id", Color.FromArgb(11, 22, 33));
The Color class supports alpha channel, but SMILE.NET does not, i.e., you always work without any transparency. That's why colors retrieved using GetXXX() methods will always have alpha channel set to 255 value. Value of alpha channel passed as an argument to SetXXX() methods is ignored.
More information on Color structure can be found on Microsoft's MSDN Web site.
- System.Drawing.Color GetNodeTextColor(int nodeHandle)
System.Drawing.Color GetNodeTextColor(String nodeId)
Returns the text (font) color for a specified node. A System.Drawing.Color structure is returned.
More information on System.Drawing.Color structure can be found on Microsoft's MSDN Web site.
- void SetNodeBorderColor(int nodeHandle, System.Drawing.Color color)
void SetNodeBorderColor(String nodeId, System.Drawing.Color color)
Sets the border color for a specified node (this property is read by GeNIe). System.Drawing.Color structure is used to pass the desired color. Using this structure you can use (1) predefined color constants, and (2) colors constructed with RGB components.
net.SetNodeBgColor("node_id", Color.Tomato);
net.SetNodeBgColor("node_id", Color.FromArgb(11, 22, 33));
The Color class supports alpha channel, but SMILE.NET does not, i.e., you always work without any transparency. That's why colors retrieved using GetXXX() methods will always have alpha channel set to 255 value. Value of alpha channel passed as an argument to SetXXX() methods is ignored.
More information on System.Drawing.Color structure can be found on Microsoft's MSDN Web site.
- System.Drawing.Color GetNodeBorderColor(int nodeHandle)
System.Drawing.Color GetNodeBorderColor(String nodeId)
Returns the border color for a specified node. A System.Drawing.Color structure is returned.
More information on System.Drawing.Color structure can be found on Microsoft's MSDN Web site.
- void SetNodeBorderWidth(int nodeHandle, int width)
void SetNodeBorderWidth(String nodeId, int width)
Sets the border width (thickness) of a specified node (this property is read by GeNIe). 1 is the smallest value (the border will no be any thinner than 1 pixel).
- int GetNodeBorderWidth(int nodeHandle)
int GetNodeBorderWidth(String nodeId)
Returns the width (thickness) of the border of a specified node.
[edit] Methods: Diagnosis
- void SetNodeDiagType(int nodeHandle, int diagType)
void SetNodeDiagType(String nodeId, int diagType)
Sets the diagnostic type of a specified node. For the list of the possible values of the diagnostic type please refer to type description available earlier in this section.
The available diagnostic node types are enumerated in the NodeDiagType type.
SmileException is thrown when specified node is invalid.
- int GetNodeDiagType(int nodeHandle)
int GetNodeDiagType(String nodeId)
Returns the diagnostic type of a specified node.
The available diagnostic node types are enumerated in the NodeDiagType type.
SmileException is thrown when specified node is invalid.
- bool IsRanked(int nodeHandle)
bool IsRanked(string nodeId) bool IsMandatory(int nodeHandle) bool IsMandatory(string nodeId)
Returns the ranked/mandatory flag of a specified node. SmileException is thrown when specified node is invalid.
- void SetRanked(int nodeHandle, bool ranked)
void SetRanked(string nodeId, bool ranked) void SetMandatory(int nodeHandle, bool mandatory) void SetMandatory(string nodeId, bool mandatory)
Sets the ranked/mandatory flag of a specified node. SmileException is thrown when specified node is invalid.
- int[] GetCostParents(int nodeHandle)
int[] GetCostParents(string nodeId)
Returns handles of all the cost parents of a specified node.
- string[] GetCostParentIds(int nodeHandle)
string[] GetCostParentIds(string nodeId)
Returns ids of all the cost parents of a specified node.
- int[] GetCostChildren(int nodeHandle)
int[] GetCostChildren(string nodeId)
Returns handles of all cost children of a specified node.
- string[] GetCostChildIds(int nodeHandle)
string[] GetCostChildIds(string nodeId)
Returns ids of all cost children of a specified node.
- void AddCostArc(int parentHandle, int childHandle)
void AddCostArc(string parentId, string childId)
Adds a cost arc from a parent to a child.
- void DeleteCostArc(int parentHandle, int childHandle)
void DeleteCostArc(string parentId, string childId)
Removes a cost arc from a parent to a child.
- double[] GetNodeCost(int nodeHandle)
double[] GetNodeCost(string nodeId)
Returns the cost of a specified observation node. This function will always return a one-dimentional array. If the node has one or more cost parents the multiple dimensions of the definitions will be encoded into a vector. You have to use the information on the number of cost parents and the number of their outcomes to decode the cost. See the GetNodeDefinition documentation for more information.
If node has no cost parents, the returned array has one element.
If node has cost parents, some of its cost array entries may be set to DiagNetwork.NotAvailable. If the parents' outcomes associated with such entry were observed, the node is excluded from calculations in DiagNetwork.Update (it's infoGain is returned as DiagNetwork.NotAvailable).
Node cost entry may also be negative, indicating very cheap test. Such observation is "boosted" and its infoGain is set to extremely high value.
- void SetNodeCost(int nodeHandle, double cost[])
void SetNodeCost(string nodeId, double cost[])
Sets the cost of a specified observation node. If node has no cost parents, pass the array containing just one element. See GetNodeCost documentation for more information.
- string GetNodeDescription(int nodeHandle)
string GetNodeDescription(string nodeId)
Return the description of the node. SmileException is thrown when specified node is invalid.
- void SetNodeDescription(int nodeHandle, string description)
void SetNodeDescription(string nodeId, string description)
Set the description of the node. SmileException is thrown when specified node is invalid.
- String GetNodeQuestion(int nodeHandle)
String GetNodeQuestion(String nodeId)
Return the (possibly empty) question associated with observation node. SmileException is thrown when specified node is invalid.
void SetNodeQuestion(int nodeHandle, String question) void SetNodeQuestion(String nodeId, String question)
Set the (possibly empty) question for observation node. SmileException is thrown when specified node is invalid.
- String GetOutcomeFix(int nodeHandle, int outcomeIndex)
String GetOutcomeFix(String nodeId, int outcomeIndex) String GetOutcomeFix(int nodeHandle, String outcomeId) String GetOutcomeFix(String nodeId, String outcomeId)
Returns the (possibly empty) repair/treatment information for fault outcome. SmileException is thrown when specified node or outcome is invalid.
- void SetOutcomeFix(int nodeHandle, int outcomeIndex, String treatment)
void SetOutcomeFix(String nodeId, int outcomeIndex, String treatment) void SetOutcomeFix(int nodeHandle, String outcomeId, String treatment) void SetOutcomeFix(String nodeId, String outcomeId, String treatment)
Sets the repair/treatment information for the fault outcome. Unlike outcome identifier, the outcome label can be empty; otherwise it must be unique in the network. SmileException is thrown when specified node or outcome are invalid.
- String GetOutcomeDescription(int nodeHandle, int outcomeIndex)
String GetOutcomeDescription(String nodeId, int outcomeIndex) String GetOutcomeDescription(int nodeHandle, String outcomeId) String GetOutcomeDescription(String nodeId, String outcomeId)
Returns the description of the outcome. SmileException is thrown when specified node or outcome is invalid.
- void SetOutcomeDescription(int nodeHandle, int outcomeIndex, String description)
void SetOutcomeDescription(String nodeId, int outcomeIndex, String description) void SetOutcomeDescription(int nodeHandle, String outcomeId, String description) void SetOutcomeDescription(String nodeId, String outcomeId, String description)
Sets the description of the outcome. SmileException is thrown when specified node or outcome is invalid.
- String GetOutcomeLabel(int nodeHandle, int outcomeIndex)
String GetOutcomeLabel(String nodeId, int outcomeIndex) String GetOutcomeLabel(int nodeHandle, String outcomeId) String GetOutcomeLabel(String nodeId, String outcomeId)
Returns the label of the outcome. Unlike outcome identifier, the outcome label can be empty; otherwise it must be unique in the network. SmileException is thrown when specified node or outcome is invalid.
- bool SetOutcomeLabel(int nodeHandle, int outcomeIndex, String label)
bool SetOutcomeLabel(String nodeId, int outcomeIndex, String label) bool SetOutcomeLabel(int nodeHandle, String outcomeId, String label) bool SetOutcomeLabel(String nodeId, String outcomeId, String label)
Sets the label of the outcome. Unlike outcome identifier, the outcome label can be empty; otherwise it must be unique in the network. SmileException is thrown when specified node, outcome or label are invalid.
- bool IsFaultOutcome(int nodeHandle, int outcomeIndex)
bool IsFaultOutcome(String nodeId, int outcomeIndex) bool IsFaultOutcome(int nodeHandle, String outcomeId) bool IsFaultOutcome(String nodeId, String outcomeId)
Returns true if given outcome is marked as fault. SmileException is thrown when specified node or outcome is invalid.
- void SetFaultOutcome(int nodeHandle, int outcomeIndex, bool fault)
void SetFaultOutcome(String nodeId, int outcomeIndex, bool fault) void SetFaultOutcome(int nodeHandle, String outcomeId, bool fault) void SetFaultOutcome(String nodeId, String outcomeId, bool fault)
Marks/clears the fault flag for outcome. SmileException is thrown when specified node or outcome is invalid.
- int GetDefaultOutcome(int nodeHandle)
int GetDefaultOutcome(String nodeId) String GetDefaultOutcomeId(int nodeHandle) String GetDefaultOutcomeId(String nodeId)
Returns the index/identifier of default outcome of given node, -1/null if theres no default outcome. SmileException is thrown when specified node is invalid.
Default outcomes are used to instantiate observations when DiagNetwork object is created.
- void SetDefaultOutcome(int nodeHandle, int defOutcome)
void SetDefaultOutcome(String nodeId, int defOutcome) void SetDefaultOutcome(int nodeHandle, String defOutcomeId) void SetDefaultOutcome(String nodeId, String defOutcomeId)
Sets the default outcome of given node. Pass -1/null as 2nd parameter to reset the default outcome. SmileException is thrown when specified node or outcome is invalid.
Default outcomes are used to instantiate observations when DiagNetwork object is created.
[edit] Methods: User Properties
Network and nodes can have associated user properties, which are name/value string pairs. Please note that property names starting with DSL_ are reserved for internal use by SMILE. Property name must start with a letter and must contain only letters, digits or underscores (the same rules are applied to node identifiers).
struct UserProperty {
string name
string value
}
- UserProperty[] GetUserProperties()
Get user properties for the network. If there are no properties, an empty array is returned.
- void SetUserProperties(UserProperty[] properties)
Set user properties for the network. Pass empty array to clear the properties. SmileException is thrown when there are duplicated property names or property name is invalid.
- UserProperty[] GetNodeUserProperties(int nodeHandle)
UserProperty[] GetNodeUserProperties(string nodeId)
Get user properties for the specified. If there are no properties, an empty array is returned. SmileException is thrown when specified node is invalid.
- void SetNodeUserProperties(int nodeHandle, UserProperty[] properties)
void SetNodeUserProperties(string nodeId, UserProperty[] properties)
Set user properties for given node. Pass empty array to clear the properties. SmileException is thrown when specified node is invalid, there are duplicated property names or property name is invalid.
[edit] Methods: Documentation
Nodes and outcomes can have documentation associated with them, which is a (possibly empty) set of title/path string pairs. Usually, the title is relatively short, human-readable, while path represents filename or URL. Value type DocItemInfo is used to represent these pairs.
struct DocItemInfo {
string title;
string path;
}
- DocItemInfo[] GetNodeDocumentation(int nodeHandle)
DocItemInfo[] GetNodeDocumentation(string nodeId)
Return documentation associated with given node. When node has no documentation, an empty array is returned. SmileException is thrown when specified node is invalid.
- void SetNodeDocumentation(int nodeHandle, DocItemInfo[] documentation)
void SetNodeDocumentation(string nodeId, DocItemInfo[] documentation)
Set documentation associated with given node. To remove documentation, pass an empty array (not null reference). SmileException is thrown when specified node is invalid.
- DocItemInfo[] GetOutcomeDocumentation(int nodeHandle, int outcomeIndex)
DocItemInfo[] GetOutcomeDocumentation(string nodeId, int outcomeIndex) DocItemInfo[] GetOutcomeDocumentation(int nodeHandle, string outcomeId) DocItemInfo[] GetOutcomeDocumentation(string nodeId, string outcomeId)
Returns documentation associated with given node. When node has no documentation, an empty array is returned. SmileException is thrown when specified node or outcome is invalid.
- DocItemInfo[] SetOutcomeDocumentation(int nodeHandle, int outcomeIndex, DocItemInfo[] documentation)
DocItemInfo[] SetOutcomeDocumentation(string nodeId, int outcomeIndex, DocItemInfo[] documentation) DocItemInfo[] SetOutcomeDocumentation(int nodeHandle, string outcomeId, DocItemInfo[] documentation) DocItemInfo[] SetOutcomeDocumentation(string nodeId, string outcomeId, DocItemInfo[] documentation)
Sets documentation associated with given outcome node. To remove documentation, pass an empty array (not null reference). SmileException is thrown when specified node or outcome is invalid.
