com.Bayesia.api
Class APIModeling

java.lang.Object
  extended by com.Bayesia.api.APIModeling

public final class APIModeling
extends java.lang.Object

The class APIModeling is used to create bayesian networks. The bayesian network is loaded from an xbl file. This format is generated by BayesiaLab from Bayesia.

It allows to create dicrete or continuous chance nodes and decision nodes as well as constraint nodes and utility nodes.

It allows also to use temporal relationships between chance nodes and a time counter that is very useful to describe a time-dependent node.

It provides methods to create and remove arcs and nodes, to set the conditional probability tables, the decision tables and the utility tables. You can also generate automatically these tables by creating formulas. The creation of formulas is described in a specification document.

The created network can be saved to a file with the xbl format used by BayesiaLab and can be exported through the BayesianNetworkTransferHandler interface in order to be used directly with the APIInference.

All the methods of this class can throw an instance of IllegalOperationException which is a subclass of RuntimeException so you can avoid to catch them.

Version:
1.5 27/06/06
Author:
Bayesia S.A.

Constructor Summary
APIModeling(BayesianNetworkTransferHandler networkHandler, java.lang.String licenceKey)
          Create a new APIModeling with the network stored in the specified BayesianNetworkTransferHandler.
APIModeling(BayesianNetworkTransferHandler networkHandler, java.lang.String licenceServerHost, int licenseServerPort, java.lang.String userGroup)
          Create a new APIModeling with the network stored in the specified BayesianNetworkTransferHandler.
APIModeling(java.lang.String licenceKey)
          Create a new APIModeling with an empty bayesian network named new.xbl.
APIModeling(java.lang.String licenceServerHost, int licenseServerPort, java.lang.String userGroup)
          Create a new APIModeling with an empty bayesian network named new.xbl.
APIModeling(java.lang.String fileName, java.lang.String licenceKey)
          Create a new APIModeling with the network stored in the specified file.
APIModeling(java.lang.String fileName, java.lang.String licenceServerHost, int licenseServerPort, java.lang.String userGroup)
          Create a new APIModeling with the network stored in the specified file.
 
Method Summary
 boolean addArc(java.lang.String nodeName1, java.lang.String nodeName2)
          Try to add an arc from nodeName1 to nodeName2.
 void addChanceIntervalNode(java.lang.String nodeName, java.lang.String[] modalities, float[][] intervals)
          Create a new continuous (interval) chance node with the specified modalities and the specified limits for each interval and add it to the network.
 void addChanceLabelNode(java.lang.String nodeName, java.lang.String[] modalities)
          Create a new discrete chance node with the specified modalities and add it to the network.
 void addConstraintNode(java.lang.String nodeName)
          And a constraint node with two boolean modalities.
 void addDecisionIntervalNode(java.lang.String nodeName, java.lang.String[] decisionNames, float[][] intervals)
          Add a new continuous (interval) decision node with the specified names for the decisions and the specified intervals.
 void addDecisionLabelNode(java.lang.String nodeName, java.lang.String[] decisionNames)
          Add a new discrete decision node with the specified names for the decisions.
 boolean addTemporalArc(java.lang.String nodeName1, java.lang.String nodeName2)
          Try to add a temporal arc from nodeName1 to nodeName2.
 void addUtilityNode(java.lang.String nodeName)
          Add a new utility node to the network.
 void close()
          Method used to close the current instance of APIModeling.
 BayesianNetworkTransferHandler exportNetwork(java.lang.String networkName)
          Export the created network with the specified name into a BayesianNetworkTransferHandler in order to used it with the APIInference for example.
 java.lang.String getArcComment(java.lang.String nodeName1, java.lang.String nodeName2)
          Return the comment associated to the arc between the nodes named nodeName1 and nodeName2.
 int getArcOrientationBetween(java.lang.String nodeName1, java.lang.String nodeName2)
          Return the orientation of the arc between nodeName1 and nodeName2.
 java.lang.String[] getChildren(java.lang.String nodeName)
          Return the name of the children of the specified node
 java.lang.String getComment()
          Return the comment associated to the network.
 double[] getConditionalProbabilityTable(java.lang.String nodeName)
          Get the conditional probability table for the specified node.
 double[] getDecisionTable(java.lang.String nodeName)
          Get the decision table for the specified node.
 java.lang.String getFormula(java.lang.String nodeName)
          Return the formula associated to the node as String.
 int getFormulaSampleNumber(java.lang.String nodeName)
          Return the number of samples the formula uses to evaluate the probabilities or the decisions for an interval node.
 int getFormulaSmoothingPower(java.lang.String nodeName)
          Return the smoothing power of the formula of the specified node.
 float[][] getIntervals(java.lang.String nodeName)
          Return an array containing the minimum and the maximum of each interval of the node as floats.
 int[] getIntValues(java.lang.String nodeName)
          Return an array containing the values of the node as integers if the node is an integer node.
 java.lang.String getName()
          Return the name of the loaded network.
 java.lang.String getNodeComment(java.lang.String nodeName)
          Return the comment associated to the specified node
 java.lang.String[] getNodeNames()
          Return an array containing the name of the nodes in the network
 int getNodeNumber()
          Return the number of nodes in the network
 java.lang.String[] getParents(java.lang.String nodeName)
          Return the name of the parents of the specified node
 java.lang.String[] getStringValues(java.lang.String nodeName)
          Return an array containing the values of the node as String.
 double[] getUtilityTable(java.lang.String nodeName)
          Get the utility table for the specified decision node.
 int getValueNumber(java.lang.String nodeName)
          Return the number of values of the specified node.
 boolean hasArcBetween(java.lang.String nodeName1, java.lang.String nodeName2)
          Test if there is an arc between the specified nodes
 boolean hasTemporalArcBetween(java.lang.String nodeName1, java.lang.String nodeName2)
          Test if there is a temporal arc between the specified nodes
 boolean isBoolean(java.lang.String nodeName)
          Test if the specified node is boolean, i.e. its values are equivalent to true and false.
 boolean isChildOf(java.lang.String nodeName1, java.lang.String nodeName2)
          Test if there is an arc from nodeName2 to nodeName1
 boolean isConstraint(java.lang.String nodeName)
          Test if the node is a constraint node.
 boolean isDecision(java.lang.String nodeName)
          Test if the node is a decision node.
 boolean isFormulaProbabilist(java.lang.String nodeName)
          Test if the formula of the specified node is probabilist or not.
 boolean isInteger(java.lang.String nodeName)
          Test if all the values of the specified node are integers.
 boolean isInterval(java.lang.String nodeName)
          Test if the node is described by a list of consecutives intervals.
 boolean isParentOf(java.lang.String nodeName1, java.lang.String nodeName2)
          Test if there is an arc from nodeName1 to nodeName2
 boolean isTemporal()
          Test if the network is temporal.
 boolean isTimeUsed()
          Return true if the time is used in the network.
 boolean isUtility(java.lang.String nodeName)
          Test if the node is a utility node.
 void removeArc(java.lang.String nodeName1, java.lang.String nodeName2)
          Remove the arc between the specified nodes.
 void removeNode(java.lang.String nodeName)
          Remove the specified node.
 void save(java.lang.String path)
          Save the created network to the file specified by the given path.
 void setArcComment(java.lang.String nodeName1, java.lang.String nodeName2, java.lang.String comment)
          Set the comment associated to the arc between the nodes named nodeName1 and nodeName2.
 void setComment(java.lang.String comment)
          Set the comment associated to the network.
 void setConditionalProbabilityTable(java.lang.String nodeName, double[] table)
          Set the conditional probability table for the specified node.
 void setDecisionTable(java.lang.String nodeName, double[] table)
          Set the decision table for the specified node.
 void setFormula(java.lang.String nodeName, java.lang.String formula, boolean probabilist, int sampleNumber, int smoothingPower)
           
 void setNodeComment(java.lang.String nodeName, java.lang.String comment)
          Set the comment associated to the specified node
 void setTimeUsed(boolean b)
          Specify that we want to use the time counter in the network.
 void setUtilityTable(java.lang.String nodeName, double[] table)
          Set the utility table for the specified decision node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

APIModeling

public APIModeling(java.lang.String licenceKey)
Create a new APIModeling with an empty bayesian network named new.xbl. You must provide a valid licence key for modeling.

Parameters:
licenceKey - the key of the licence.

APIModeling

public APIModeling(java.lang.String licenceServerHost,
                   int licenseServerPort,
                   java.lang.String userGroup)
Create a new APIModeling with an empty bayesian network named new.xbl. You must provide the host and the port of the license server. The user group is optional, depending on the configuration of the license ont the license server. Use this constructor if you use a license server.

Parameters:
licenceServerHost - the host of the license server.
licenseServerPort - the port of the license server.
userGroup - the user group corresponding to the license, maybe null if no user group is specified on the license server.

APIModeling

public APIModeling(java.lang.String fileName,
                   java.lang.String licenceKey)
Create a new APIModeling with the network stored in the specified file. You must provide a valid licence key for modeling.

Parameters:
fileName - the name of the xbl file containing the network
licenceKey - the key of the licence.

APIModeling

public APIModeling(java.lang.String fileName,
                   java.lang.String licenceServerHost,
                   int licenseServerPort,
                   java.lang.String userGroup)
Create a new APIModeling with the network stored in the specified file. You must provide the host and the port of the license server. The user group is optional, depending on the configuration of the license ont the license server. Use this constructor if you use a license server.

Parameters:
fileName - the name of the xbl file containing the network
licenceServerHost - the host of the license server.
licenseServerPort - the port of the license server.
userGroup - the user group corresponding to the license, maybe null if no user group is specified on the license server.

APIModeling

public APIModeling(BayesianNetworkTransferHandler networkHandler,
                   java.lang.String licenceKey)
Create a new APIModeling with the network stored in the specified BayesianNetworkTransferHandler. You must provide a valid licence key for modeling.

Parameters:
networkHandler - the transfer handler containing the network
licenceKey - the key of the licence.

APIModeling

public APIModeling(BayesianNetworkTransferHandler networkHandler,
                   java.lang.String licenceServerHost,
                   int licenseServerPort,
                   java.lang.String userGroup)
Create a new APIModeling with the network stored in the specified BayesianNetworkTransferHandler. You must provide the host and the port of the license server. The user group is optional, depending on the configuration of the license ont the license server. Use this constructor if you use a license server.

Parameters:
networkHandler - the transfer handler containing the network
licenceServerHost - the host of the license server.
licenseServerPort - the port of the license server.
userGroup - the user group corresponding to the license, maybe null if no user group is specified on the license server.
Method Detail

getName

public final java.lang.String getName()
Return the name of the loaded network.

Returns:
the name of the network

getNodeNames

public final java.lang.String[] getNodeNames()
Return an array containing the name of the nodes in the network

Returns:
the node names

getNodeNumber

public final int getNodeNumber()
Return the number of nodes in the network

Returns:
the number of nodes

getComment

public final java.lang.String getComment()
Return the comment associated to the network.

Returns:
the comment associated to the network.

setComment

public final void setComment(java.lang.String comment)
Set the comment associated to the network.

Parameters:
comment - the comment associated to the network.

getNodeComment

public final java.lang.String getNodeComment(java.lang.String nodeName)
Return the comment associated to the specified node

Parameters:
nodeName - the name of the node we want the comment
Returns:
the comment of the node

setNodeComment

public final void setNodeComment(java.lang.String nodeName,
                                 java.lang.String comment)
Set the comment associated to the specified node

Parameters:
nodeName - the name of the node we want to set the comment
comment - the new comment

getArcComment

public final java.lang.String getArcComment(java.lang.String nodeName1,
                                            java.lang.String nodeName2)
Return the comment associated to the arc between the nodes named nodeName1 and nodeName2.

Parameters:
nodeName1 - the name of the first extremity node
nodeName2 - the name of the second extremity node
Returns:
the comment of the arc

setArcComment

public final void setArcComment(java.lang.String nodeName1,
                                java.lang.String nodeName2,
                                java.lang.String comment)
Set the comment associated to the arc between the nodes named nodeName1 and nodeName2.

Parameters:
nodeName1 - the name of the first extremity node
nodeName2 - the name of the second extremity node
comment - the new comment of the arc

isTimeUsed

public final boolean isTimeUsed()
Return true if the time is used in the network.

Returns:
true if the time is used in the network.
See Also:
setTimeUsed(boolean)

setTimeUsed

public final void setTimeUsed(boolean b)
Specify that we want to use the time counter in the network. It is useful when you need to use it in the formula of a node. When it is set to true, the variable ?t? can be used in formulas as an positive integer variable.

Warning: Do not forget to set the time to false if it was previously set to true and it is not used in any formula.

Parameters:
b - true if the time should be used, false otherwise.
See Also:
isTimeUsed()

getParents

public final java.lang.String[] getParents(java.lang.String nodeName)
Return the name of the parents of the specified node

Parameters:
nodeName - the name of the node we want the parents
Returns:
and array containing the name of the parents

getChildren

public final java.lang.String[] getChildren(java.lang.String nodeName)
Return the name of the children of the specified node

Parameters:
nodeName - the name of the node we want the children
Returns:
and array containing the name of the children

hasArcBetween

public final boolean hasArcBetween(java.lang.String nodeName1,
                                   java.lang.String nodeName2)
Test if there is an arc between the specified nodes

Parameters:
nodeName1 -
nodeName2 -
Returns:
true if there is an arc between the specified nodes, false otherwise

hasTemporalArcBetween

public final boolean hasTemporalArcBetween(java.lang.String nodeName1,
                                           java.lang.String nodeName2)
Test if there is a temporal arc between the specified nodes

Parameters:
nodeName1 -
nodeName2 -
Returns:
true if there is an arc between the specified nodes and this arc is temporal, false otherwise

isParentOf

public final boolean isParentOf(java.lang.String nodeName1,
                                java.lang.String nodeName2)
Test if there is an arc from nodeName1 to nodeName2

Parameters:
nodeName1 - the name of the supposed parent
nodeName2 - the name of the supposed child
Returns:
true if nodeName1 is parent of nodeName2

isChildOf

public final boolean isChildOf(java.lang.String nodeName1,
                               java.lang.String nodeName2)
Test if there is an arc from nodeName2 to nodeName1

Parameters:
nodeName1 - the name of the supposed child
nodeName2 - the name of the supposed parent
Returns:
true if nodeName1 is child of nodeName2

getArcOrientationBetween

public final int getArcOrientationBetween(java.lang.String nodeName1,
                                          java.lang.String nodeName2)
Return the orientation of the arc between nodeName1 and nodeName2. The possible values are : -1 if there is no arc, 0 if there is an arc from nodeName1 to nodeName2 and 1 if there is an arc from nodeName2 to nodeName1

Parameters:
nodeName1 -
nodeName2 -
Returns:
the orientation of the arc between nodeName1 and nodeName2

addChanceLabelNode

public final void addChanceLabelNode(java.lang.String nodeName,
                                     java.lang.String[] modalities)
Create a new discrete chance node with the specified modalities and add it to the network. Its conditional probability table is automatically generated and initialized with default probabilities. Its name must not exist in the network and must not be "t". "t" is a reserved name for the time counter.

Parameters:
nodeName - the name of the new node.
modalities - an array containing the name of the modalitites

addChanceIntervalNode

public final void addChanceIntervalNode(java.lang.String nodeName,
                                        java.lang.String[] modalities,
                                        float[][] intervals)
Create a new continuous (interval) chance node with the specified modalities and the specified limits for each interval and add it to the network. The number of intervals is equal to the number of modalities. The intervals are given in an array containing, for each one, an array storing the minimum and the maximum of this interval. The intervals are contiguous, i.e. the maximum of an interval is equal to the minimum of the following interval. Its conditional probability table is automatically generated and initialized with default probabilities. Its name must not exist in the network and must not be "t". "t" is a reserved name for the time counter.

Parameters:
nodeName - the name of the new node.
modalities - an array containing the name of the modalitites
intervals - an array containing arrays storing the minimum and the maximum of each interval

addConstraintNode

public final void addConstraintNode(java.lang.String nodeName)
And a constraint node with two boolean modalities.

Parameters:
nodeName - the name of the node

addUtilityNode

public final void addUtilityNode(java.lang.String nodeName)
Add a new utility node to the network. A utility node cannot have children.

Parameters:
nodeName - the name of the node.

addDecisionLabelNode

public final void addDecisionLabelNode(java.lang.String nodeName,
                                       java.lang.String[] decisionNames)
Add a new discrete decision node with the specified names for the decisions. The node must have at least two decisions.

Parameters:
nodeName -
decisionNames - an array containing the names of the decisions.

addDecisionIntervalNode

public final void addDecisionIntervalNode(java.lang.String nodeName,
                                          java.lang.String[] decisionNames,
                                          float[][] intervals)
Add a new continuous (interval) decision node with the specified names for the decisions and the specified intervals. The node must have at least two decisions. The rules for the intervals are the same as in the interval chance node.

Parameters:
nodeName - the name of the node
decisionNames - an array containing the names of the decisions.
intervals - an array containing arrays storing the minimum and the maximum of each interval

addArc

public final boolean addArc(java.lang.String nodeName1,
                            java.lang.String nodeName2)
Try to add an arc from nodeName1 to nodeName2. If there is an arc between the two nodes or if the new arc introduces a cycle in the network, the new arc is not added and false is returned.

Parameters:
nodeName1 - the parent node
nodeName2 - the child node
Returns:
true if the arc is added, false otherwise.

addTemporalArc

public final boolean addTemporalArc(java.lang.String nodeName1,
                                    java.lang.String nodeName2)
Try to add a temporal arc from nodeName1 to nodeName2. If there is an arc between the two nodes, if the new arc introduces a cycle in the network or if the nodes are not compatible, the new arc is not added and false is returned. The nodes must be compatible, i.e. they must have the same modalities. A temporal arc can be added from node1 to node2, if and only if there is no temporal arc from any parent of node1 to node1, there is no temporal arc from node1 to any child of node1 and there is no temoral arc from node2 to any child of node2. All these cases throw a IllegalOperationException.

Parameters:
nodeName1 - the parent node
nodeName2 - the child node
Returns:
true if the arc is added, false otherwise.

removeArc

public final void removeArc(java.lang.String nodeName1,
                            java.lang.String nodeName2)
Remove the arc between the specified nodes. If the child node have a formula, it is removed. The conditional probability table of the child node is recreated to be consistent with the network.

Parameters:
nodeName1 -
nodeName2 -

removeNode

public final void removeNode(java.lang.String nodeName)
Remove the specified node. It removes also all the arcs between this node and its parents and the arcs between this node and its children. For each child, the formula is removed and the conditional probability table is recreated to be consistent with the network.

Parameters:
nodeName - the name of the node we want to remove

getConditionalProbabilityTable

public final double[] getConditionalProbabilityTable(java.lang.String nodeName)
Get the conditional probability table for the specified node. The node must not be a utility or a decision node. The table contains the probability between 0 and 1 for each combination of the values of the node and the values of its parents.

The probabilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 modalities (Values ni), Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 3*2*3 = 18 and the order of the probabilities will be :

n0x0y0, n0x0y1, n0x0y2, n0x1y0, n0x1y1, n0x1y2, n1x0y0, n1x0y1, n1x0y2, n1x1y0, n1x1y1, n1x1y2, n2x0y0, n2x0y1, n2x0y2, n2x1y0, n2x1y1, n2x1y2

Parameters:
nodeName - the name of the node
Returns:
the conditional probability table of the specified node.

setConditionalProbabilityTable

public final void setConditionalProbabilityTable(java.lang.String nodeName,
                                                 double[] table)
Set the conditional probability table for the specified node. The node must not be a utility or a decision node. The table should contains the probability between 0 and 1 for each combination of the values of the node and the values of its parents. If the table is not normalized, it will be automatically normalized.

The probabilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 modalities (Values ni), Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 3*2*3 = 18 and the order of the probabilities will be :

n0x0y0, n0x0y1, n0x0y2, n0x1y0, n0x1y1, n0x1y2, n1x0y0, n1x0y1, n1x0y2, n1x1y0, n1x1y1, n1x1y2, n2x0y0, n2x0y1, n2x0y2, n2x1y0, n2x1y1, n2x1y2

Note: If a formula was previously set for this node, it is removed.

Parameters:
nodeName - the name of the node
table - the new conditional probability table

getDecisionTable

public final double[] getDecisionTable(java.lang.String nodeName)
Get the decision table for the specified node. The node must be a decision node. The table contains the decision as double for each combination of the values of the node and the values of its parents.

The decisions are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 modalities (Values ni), Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 3*2*3 = 18 and the order of the decisions will be :

n0x0y0, n0x0y1, n0x0y2, n0x1y0, n0x1y1, n0x1y2, n1x0y0, n1x0y1, n1x0y2, n1x1y0, n1x1y1, n1x1y2, n2x0y0, n2x0y1, n2x0y2, n2x1y0, n2x1y1, n2x1y2

Parameters:
nodeName - the name of the node
Returns:
the decision table of the specified decision node

setDecisionTable

public final void setDecisionTable(java.lang.String nodeName,
                                   double[] table)
Set the decision table for the specified node. The node must be a decision node. The table should contains the decision as double for each combination of the values of the node and the values of its parents.

The decisions are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 modalities (Values ni), Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 3*2*3 = 18 and the order of the decisions will be :

n0x0y0, n0x0y1, n0x0y2, n0x1y0, n0x1y1, n0x1y2, n1x0y0, n1x0y1, n1x0y2, n1x1y0, n1x1y1, n1x1y2, n2x0y0, n2x0y1, n2x0y2, n2x1y0, n2x1y1, n2x1y2

Note: If a formula was previously set for this node, it is removed.

Parameters:
nodeName - the name of the node
table - the new decision table

getUtilityTable

public final double[] getUtilityTable(java.lang.String nodeName)
Get the utility table for the specified decision node. The node must be a utility node. The table contains the utilities as double for each combination of the values of its parents.

The utilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 2*3 = 6 and the order of the decisions will be :

x0y0, x0y1, x0y2, x1y0, x1y1, x1y2

If there is no parent, the size of the table is 1.

Parameters:
nodeName - the name of the node
Returns:
the utility table of the specified utility node

setUtilityTable

public final void setUtilityTable(java.lang.String nodeName,
                                  double[] table)
Set the utility table for the specified decision node. The node must be a utility node. The table should contains the utilities as double for each combination of the values of its parents.

The utilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Parents X with 2 modalities(xj), Y with 3 modalitites(yk) : the size of the table if 2*3 = 6 and the order of the decisions will be :

x0y0, x0y1, x0y2, x1y0, x1y1, x1y2

If there is no parent, the size of the table is 1. Note: If a formula was previously set for this node, it is removed.

Parameters:
nodeName - the name of the node
table - the new utility table

setFormula

public final void setFormula(java.lang.String nodeName,
                             java.lang.String formula,
                             boolean probabilist,
                             int sampleNumber,
                             int smoothingPower)
Parameters:
nodeName - the name of the node
formula - the formula
probabilist - true if the formula is probabilist, false if is determinist
sampleNumber - >0 if the node is an interval node.
smoothingPower - >0 if you want to smooth the probabilities or 0 if you don't want.

isInteger

public final boolean isInteger(java.lang.String nodeName)
Test if all the values of the specified node are integers.

Parameters:
nodeName - the name of the tested node
Returns:
true if the node values are integers, false otherwise

isBoolean

public final boolean isBoolean(java.lang.String nodeName)
Test if the specified node is boolean, i.e. its values are equivalent to true and false.

Parameters:
nodeName - the name of the tested node
Returns:
true if the is boolean, false otherwise

isInterval

public final boolean isInterval(java.lang.String nodeName)
Test if the node is described by a list of consecutives intervals.

Parameters:
nodeName - the name of the tested node
Returns:
true if the node is an interval node, false otherwise

isDecision

public final boolean isDecision(java.lang.String nodeName)
Test if the node is a decision node.

Parameters:
nodeName - the name of the tested node
Returns:
true if the node is a decision node, false otherwise

isUtility

public final boolean isUtility(java.lang.String nodeName)
Test if the node is a utility node.

Parameters:
nodeName - the name of the tested node
Returns:
true if the node is a utility node, false otherwise

isConstraint

public final boolean isConstraint(java.lang.String nodeName)
Test if the node is a constraint node.

Parameters:
nodeName - the name of the tested node
Returns:
true if the node is a constraint node, false otherwise

getValueNumber

public final int getValueNumber(java.lang.String nodeName)
Return the number of values of the specified node. It can't be used on constraint and utility nodes.

Returns:
the number of values of the node

getStringValues

public final java.lang.String[] getStringValues(java.lang.String nodeName)
Return an array containing the values of the node as String. It can't be used on constraint and utility nodes.

Parameters:
nodeName - the name of the node
Returns:
an array containing the values of the node.

getIntValues

public final int[] getIntValues(java.lang.String nodeName)
Return an array containing the values of the node as integers if the node is an integer node. It can't be used on constraint and utility nodes.

Parameters:
nodeName - the name of the node
Returns:
an array containing the values of the node.

getIntervals

public final float[][] getIntervals(java.lang.String nodeName)
Return an array containing the minimum and the maximum of each interval of the node as floats. For each interval, the minimum is at index 0 and the maximum at index 1. It can be used only interval nodes.

Parameters:
nodeName - the name of the node
Returns:
an array containing the minimum and the maximum values of the intervals of the node.

getFormula

public final java.lang.String getFormula(java.lang.String nodeName)
Return the formula associated to the node as String. If the node doesn't have a formula it returns null.

Parameters:
nodeName - the name of the node
Returns:
a String representing the formula of the node

isFormulaProbabilist

public final boolean isFormulaProbabilist(java.lang.String nodeName)
Test if the formula of the specified node is probabilist or not.

Parameters:
nodeName - the name of the node we want to test the formula
Returns:
true if the formula is probabilist, false if it is determinist

getFormulaSampleNumber

public final int getFormulaSampleNumber(java.lang.String nodeName)
Return the number of samples the formula uses to evaluate the probabilities or the decisions for an interval node. For the discrete node, this parameter is not used.

Parameters:
nodeName - the name of the interval node
Returns:
the number of samples used by the formula

getFormulaSmoothingPower

public final int getFormulaSmoothingPower(java.lang.String nodeName)
Return the smoothing power of the formula of the specified node. Return 0 if there is no smoothing used in the formula.

Parameters:
nodeName - the name of the node
Returns:
the smoothing power used by the formula

isTemporal

public final boolean isTemporal()
Test if the network is temporal.

Returns:
true if the network is temporal, false otherwise.

save

public final void save(java.lang.String path)
Save the created network to the file specified by the given path. The extension of the file must be xbl. The name of the network is now the name of the file.

Parameters:
path - the path to an xbl file

exportNetwork

public final BayesianNetworkTransferHandler exportNetwork(java.lang.String networkName)
Export the created network with the specified name into a BayesianNetworkTransferHandler in order to used it with the APIInference for example. The name of the network must be terminated by .xbl

Parameters:
networkName - the new name of the network with the xbl extension
Returns:
a handler containing the network

close

public final void close()
Method used to close the current instance of APIModeling.

WARNING: If you use a license server, this method must be called once you don't need the instance anymore. It allows to release the license on the license server.