public class APIModeling
extends java.lang.Object
implements java.io.Closeable
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 creating dicrete or continuous (label or interval) nodes, constraint, decision and utility nodes as well as function nodes.
It allows also using 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 APIModeling
.
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.
Constructor and Description |
---|
APIModeling(BayesianNetworkTransferHandler networkHandler,
java.lang.String licenseKey)
Create a new
APIModeling with the network stored in the specified BayesianNetworkTransferHandler . |
APIModeling(BayesianNetworkTransferHandler networkHandler,
java.lang.String licenseServerHost,
int licenseServerPort,
java.lang.String userName,
java.lang.String password,
java.lang.String account)
Create a new
APIModeling with the network stored in the specified BayesianNetworkTransferHandler . |
APIModeling(java.io.InputStream stream,
java.lang.String licenseKey)
Creates a new
APIModeling with the network read from the specified InputStream. |
APIModeling(java.io.InputStream stream,
java.lang.String licenseServerHost,
int licenseServerPort,
java.lang.String userName,
java.lang.String password,
java.lang.String account)
Creates a new
APIModeling with the network read from the specified InputStream. |
APIModeling(java.lang.String licenseKey)
Create a new
APIModeling with an empty bayesian network named new.xbl. |
APIModeling(java.lang.String licenseServerHost,
int licenseServerPort,
java.lang.String userName,
java.lang.String password,
java.lang.String account)
Create a new
APIModeling with an empty bayesian network named new.xbl. |
APIModeling(java.lang.String fileName,
java.lang.String licenseKey)
Create a new
APIModeling with the network stored in the specified file. |
APIModeling(java.lang.String fileName,
java.lang.String licenseServerHost,
int licenseServerPort,
java.lang.String userName,
java.lang.String password,
java.lang.String account)
Create a new
APIModeling with the network stored in the specified file. |
Modifier and Type | Method and Description |
---|---|
boolean |
addArc(java.lang.String nodeName1,
java.lang.String nodeName2)
Tries to add an arc from
nodeName1 to nodeName2 . |
void |
addBooleanConstant(java.lang.String constantName,
boolean value)
Adds a constant with the given name, with a BOOLEAN type and a
boolean value. |
void |
addChanceIntervalNode(java.lang.String nodeName,
java.lang.String[] states,
double[][] intervals)
Deprecated.
As of release 3.1, replaced by
addIntervalNode(String, String[], double[][])
Creates a new continuous (interval) chance node with the specified states and the specified limits for each interval and add it to the network. The number of intervals is equal to the number of states. 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. |
void |
addChanceLabelNode(java.lang.String nodeName,
java.lang.String[] states)
Deprecated.
As of release 3.1, replaced by
addLabelNode(String, String[])
Creates a new discrete chance node with the specified states 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. |
void |
addClassToNode(java.lang.String className,
java.lang.String nodeName)
Add a class named
className to the specified node. |
void |
addConstraintNode(java.lang.String nodeName)
Adds a constraint node with two boolean states.
|
void |
addDecisionIntervalNode(java.lang.String nodeName,
java.lang.String[] decisionNames,
double[][] intervals)
Adds 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.
|
void |
addFunctionNode(java.lang.String nodeName)
Adds a new function node to the network.
|
void |
addIntConstant(java.lang.String constantName,
int value)
Adds a constant with the given name, with a INTEGER type and a
int value. |
void |
addIntervalNode(java.lang.String nodeName,
java.lang.String[] states,
double[][] intervals)
Creates a new continuous (interval) node with the specified states and the specified limits for each interval and add it to the network.
|
void |
addLabelNode(java.lang.String nodeName,
java.lang.String[] states)
Creates a new discrete node with the specified states and add it to the network.
|
void |
addRealConstant(java.lang.String constantName,
double value)
Adds a constant with the given name, with a REAL type and a
double value. |
void |
addStringConstant(java.lang.String constantName,
java.lang.String value)
Adds a constant with the given name, with a STRING type and a
String value. |
boolean |
addTemporalArc(java.lang.String nodeName1,
java.lang.String nodeName2)
Tries to add a temporal arc from
nodeName1 to nodeName2 . |
void |
addUtilityNode(java.lang.String nodeName)
Adds a new utility node to the network.
|
void |
arrangeNodePositions()
Changes the positions of the nodes in order to place them on a rectangular grid separated by 100.
|
void |
close()
Method used to close the current instance of
APIModeling . |
BayesianNetworkTransferHandler |
exportNetwork(java.lang.String networkName)
Exports the created network with the specified name into a
BayesianNetworkTransferHandler in order to used it with the APIModeling for example. |
java.lang.String |
getArcComment(java.lang.String nodeName1,
java.lang.String nodeName2)
Return the html comment associated to the arc between the nodes named
nodeName1 and nodeName2 . |
int |
getArcOrientationBetween(java.lang.String nodeName1,
java.lang.String nodeName2)
Returns the orientation of the arc between
nodeName1 and nodeName2 . |
java.lang.String |
getArcStringComment(java.lang.String nodeName1,
java.lang.String nodeName2)
Return the comment string associated to the arc between the nodes named
nodeName1 and nodeName2 . |
ResizableIcon |
getBackgroundImage()
Gets the image associated to the network.
|
java.lang.String[] |
getChanceNodeNames()
Deprecated.
As of release 3.1, removed
Return an array containing the name of the chance nodes in the network
|
int |
getChanceNodeNumber()
Deprecated.
As of release 3.1, removed
Return the number of chance nodes in the network
|
java.lang.String[] |
getChildren(java.lang.String nodeName)
Returns the name of the children of the specified node
|
java.lang.String[] |
getClasses()
Returns an array containing the name of the classes declared in the network.
|
java.lang.String[] |
getClassNodes(java.lang.String className)
Returns an array containing the list of the node belonging to the given class.
|
java.lang.String |
getComment()
Return the html comment associated to the network.
|
double[] |
getConditionalProbabilityTable(java.lang.String nodeName)
Gets the conditional probability table for the specified node.
|
boolean |
getConstantBooleanValue(java.lang.String constantName)
Returns the
boolean value of the specified BOOLEAN constant. |
int |
getConstantIntValue(java.lang.String constantName)
Returns the
int value of the specified INTEGER constant. |
java.lang.String[] |
getConstantNames()
Retrieves the list of the constants by its names present in the network.
|
double |
getConstantRealValue(java.lang.String constantName)
Returns the
double value of the specified REAL constant. |
java.lang.String |
getConstantStringValue(java.lang.String constantName)
Returns the
String value of the specified STRING constant. |
java.lang.String[] |
getConstraintNodeNames()
Returns the list of the names of constraint nodes.
|
int |
getConstraintNodeNumber()
Return the number of constraint nodes in the network
|
java.lang.String[] |
getContinuousNodeNames()
Returns the list of the names of simple continuous nodes (neither discrete nor constraint nor decision nor utility nor function).
|
int |
getContinuousNodeNumber()
Return the number of standard continuous nodes in the network
|
java.lang.String[] |
getDecisionNodeNames()
Returns the list of the names of decision nodes.
|
int |
getDecisionNodeNumber()
Return the number of decision nodes in the network
|
double[] |
getDecisionTable(java.lang.String nodeName)
Gets the decision table for the specified node.
|
java.lang.String[] |
getDiscreteNodeNames()
Returns the list of the names of simple discrete nodes (neither interval nor constraint nor decision nor utility nor function).
|
int |
getDiscreteNodeNumber()
Return the number of standard discrete nodes in the network
|
int |
getExcludedNodeNumber()
Return the number of excluded nodes in the network.
|
java.lang.String |
getFormula(java.lang.String nodeName)
Returns the formula associated to the node as
String . |
long |
getFormulaFixedSeed(java.lang.String nodeName)
Returns the fixed seed used by the random number generator of the formula.
|
int |
getFormulaSampleNumber(java.lang.String nodeName)
Returns the number of samples the formula uses to evaluate the probabilities or the decisions for an interval node.
|
int |
getFormulaSmoothingPower(java.lang.String nodeName)
Returns the smoothing power of the formula of the specified node.
|
java.lang.String[] |
getFunctionNodeNames()
Returns the list of the names of function nodes.
|
int |
getFunctionNodeNumber()
Return the number of function nodes in the network
|
double[][] |
getIntervals(java.lang.String nodeName)
Returns an array containing the minimum and the maximum of each interval of the node as doubles.
|
int[] |
getIntValues(java.lang.String nodeName)
Returns an array containing the states 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[] |
getNodeClasses(java.lang.String nodeName)
Returns the classes of which the given node is associated.
|
java.awt.Color |
getNodeColor(java.lang.String nodeName)
Returns the
Color associated to the node or null if there is no associated color. |
java.lang.String |
getNodeComment(java.lang.String nodeName)
Return the html comment associated to the specified node
|
double |
getNodeCost(java.lang.String nodeName)
Returns the cost associated to the node or null if there is no cost.
|
short |
getNodeFilteredState(java.lang.String nodeName)
Returns the index of the node's filtered state.
|
ResizableIcon |
getNodeImage(java.lang.String nodeName)
Gets the image as an instance of
ResizableIcon associated to the node or null if there is no associated image. |
java.lang.String |
getNodeLongName(java.lang.String nodeName)
Return the long name associated to the specified node or null if there is no long name
|
java.lang.String[] |
getNodeNames()
Return an array containing the name of the nodes in the network
|
int |
getNodeNumber()
Return the number of not excuded nodes in the network.
|
java.awt.geom.Point2D |
getNodePosition(java.lang.String nodeName)
Returns the position of the center of the node as a point with double precision.
|
java.lang.Integer |
getNodeStateVirtualNumber(java.lang.String nodeName)
Returns the state virtual number of the specified node or null if there is no specified virtual state number.
|
java.lang.String |
getNodeStringComment(java.lang.String nodeName)
Return the comment string associated to the specified node
|
double |
getNodeStructuralCoefficient(java.lang.String nodeName)
Returns the value of the node's structural coefficient used for learning.
|
java.lang.Integer |
getNodeTemporalIndex(java.lang.String nodeName)
Resturn the temporal index associated to the chance node or null if there is no temporal index.
|
java.lang.String[] |
getParents(java.lang.String nodeName)
Returns the name of the parents of the specified node
|
double[] |
getRealValues(java.lang.String nodeName)
Returns an array containing the states of the node as doubles if the node is a node with real numberts as values.
|
java.lang.String[] |
getSortedChanceNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod,
boolean increase)
Deprecated.
As of release 3.1, replaced by
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the chance nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD |
java.lang.String[] |
getSortedFunctionNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod,
boolean increase)
Deprecated.
As of release 3.1, replaced by
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the function nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD |
java.lang.String[] |
getSortedNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod,
boolean increase)
Deprecated.
As of release 3.1, replaced by
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD |
java.lang.String[] |
getStandardNodeNames()
Returns the list of the names of standard chance nodes (neither constraint nor decision nor utility nor function).
|
int |
getStandardNodeNumber()
Return the number of standard nodes in the network
|
int |
getStateCount(java.lang.String nodeName)
Returns the number of states of the specified node.
|
java.lang.String |
getStateLongNameAt(java.lang.String nodeName,
int state)
Returns the long names of a given state for a given node.
|
java.lang.String[] |
getStateLongNames(java.lang.String nodeName)
Returns an array of
String containing the long name for each state of the specified node. |
java.lang.Double |
getStateValueAt(java.lang.String nodeName,
int state)
Returns the value associated to the given state of the given node.
|
java.lang.Double[] |
getStateValues(java.lang.String nodeName)
Returns an array of
Double containing the values associated to each state of the given node. |
java.lang.String |
getStringComment()
Return the comment as string associated to the network.
|
java.lang.String[] |
getStringValues(java.lang.String nodeName)
Returns an array containing the states of the node as
String . |
java.lang.Double |
getStructuralCoefficient()
Returns the global structural coefficient of the network used for learning.
|
java.lang.String[] |
getUtilityNodeNames()
Returns the list of the names of utility nodes.
|
int |
getUtilityNodeNumber()
Return the number of utility nodes in the network
|
double[] |
getUtilityTable(java.lang.String nodeName)
Gets the utility table for the specified decision node.
|
boolean |
hasArcBetween(java.lang.String nodeName1,
java.lang.String nodeName2)
Tests if there is an arc between the specified nodes
|
boolean |
hasTemporalArcBetween(java.lang.String nodeName1,
java.lang.String nodeName2)
Tests if there is a temporal arc between the specified nodes
|
boolean |
isBoolean(java.lang.String nodeName)
Tests if the specified node is boolean, i.e. its values are equivalent to true and false.
|
boolean |
isBooleanConstant(java.lang.String constantName)
Tests if the specified constant is a BOOLEAN constant.
|
boolean |
isChildOf(java.lang.String nodeName1,
java.lang.String nodeName2)
Tests if there is an arc from
nodeName2 to nodeName1 |
boolean |
isConstraint(java.lang.String nodeName)
Tests if the node is a constraint node.
|
boolean |
isDecision(java.lang.String nodeName)
Tests 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 |
isFormulaUseFixedSeed(java.lang.String nodeName)
Returns true if the formula use a fixed seed, false otherwise.
|
boolean |
isFunction(java.lang.String nodeName)
Tests if the node is a function node.
|
boolean |
isIntConstant(java.lang.String constantName)
Tests if the specified constant is an INTEGER constant.
|
boolean |
isInteger(java.lang.String nodeName)
Tests if all the values of the specified node are integers.
|
boolean |
isInterval(java.lang.String nodeName)
Tests if the node is described by a list of consecutives intervals.
|
boolean |
isNodeExcluded(java.lang.String nodeName)
Returns the exclusion property of the node.
|
boolean |
isParentOf(java.lang.String nodeName1,
java.lang.String nodeName2)
Tests if there is an arc from
nodeName1 to nodeName2 |
boolean |
isReal(java.lang.String nodeName)
Tests if all the values of the specified node are reals.
|
boolean |
isRealConstant(java.lang.String constantName)
Tests if the specified constant is a REAL constant.
|
boolean |
isStringConstant(java.lang.String constantName)
Tests if the specified constant is a STRING constant.
|
boolean |
isTemporal()
Tests if the network is temporal.
|
boolean |
isTimeUsed()
Returns true if the time is used in the network.
|
boolean |
isUtility(java.lang.String nodeName)
Tests if the node is a utility node.
|
void |
removeArc(java.lang.String nodeName1,
java.lang.String nodeName2)
Removes the arc between the specified nodes.
|
void |
removeClassFromNode(java.lang.String className,
java.lang.String nodeName)
Removes the specified class from the given node.
|
void |
removeConstant(java.lang.String constantName)
Removes the specified constant from the network.
|
void |
removeNode(java.lang.String nodeName)
Removes the specified node.
|
void |
save(java.io.OutputStream stream)
Saves the created network into the specified
OutputStream . |
void |
save(java.lang.String path)
Saves 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 |
setBackgroundImage(ResizableIcon image)
Sets the image associated to the network.
|
void |
setClassFunctionNodeBooleanFormatter(java.lang.String className,
BooleanFormatter formatter)
Sets the Boolean formatter to each not excluded function node of the given class.
|
void |
setClassFunctionNodeNumberFormatter(java.lang.String className,
NumberFormatter formatter)
Sets the Number formatter to each not excluded function node of the given class.
|
void |
setClassFunctionNodeStringFormatter(java.lang.String className,
StringFormatter formatter)
Sets the String formatter to each not excluded function node of the given class.
|
void |
setClassNodeColor(java.lang.String className,
java.awt.Color color)
Sets the color for each node of the given class.
|
void |
setClassNodeCost(java.lang.String className,
java.lang.Double cost)
Sets a cost to each not excluded node of the given class.
|
void |
setClassNodeExcluded(java.lang.String className,
boolean excluded)
Indicates if each node of the the given class will be excluded or not from the structural learning.
|
void |
setClassNodeImage(java.lang.String className,
ResizableIcon image)
Sets an image to each node of the given class.
|
void |
setClassNodeStateVirtualNumber(java.lang.String className,
java.lang.Double coefficient)
Sets the structural coefficient to each not excluded node of the given class.
|
void |
setClassNodeStateVirtualNumber(java.lang.String className,
java.lang.Integer stateVirtualNumber)
Sets the state virtual number to each not excluded node of the given class.
|
void |
setClassNodeTemporalIndex(java.lang.String className,
java.lang.Integer temporalIndex)
Sets a temporal index to each not excluded node of the given class.
|
void |
setComment(java.lang.String comment)
Sets the comment associated to the network.
|
void |
setConditionalProbabilityTable(java.lang.String nodeName,
double[] table)
Sets the conditional probability table for the specified node.
|
void |
setDecisionTable(java.lang.String nodeName,
double[] table)
Sets the decision table for the specified node.
|
void |
setFormula(java.lang.String nodeName,
java.lang.String formula,
boolean probabilist,
int sampleNumber,
int smoothingPower,
boolean fixedSeed,
long seed,
boolean intervalExtended)
Sets the formula describing the conditional probability table for the given node.
|
void |
setFunctionNodeBooleanFormatter(java.lang.String nodeName,
BooleanFormatter formatter)
Sets the Boolean formatter of the function node.
|
void |
setFunctionNodeNumberFormatter(java.lang.String nodeName,
NumberFormatter formatter)
Sets the Number formatter of the function node.
|
void |
setFunctionNodeStringFormatter(java.lang.String nodeName,
StringFormatter formatter)
Sets the String formatter of the function node.
|
void |
setNodeColor(java.lang.String nodeName,
java.awt.Color color)
Sets the color of the node.
|
void |
setNodeComment(java.lang.String nodeName,
java.lang.String comment)
Set the comment associated to the specified node.
|
void |
setNodeCost(java.lang.String nodeName,
java.lang.Double cost)
Sets the cost of the node to the given
double value. |
void |
setNodeExcluded(java.lang.String nodeName,
boolean excluded)
Indicates if the given node will be excluded or not from the structural learning.
|
void |
setNodeFilteredState(java.lang.String nodeName,
short index)
Sets the node's filtered state.
|
void |
setNodeImage(java.lang.String nodeName,
ResizableIcon image)
Sets an image to the node.
|
void |
setNodeLongName(java.lang.String nodeName,
java.lang.String longName)
Set the long name associated to the specified node.
|
void |
setNodePosition(java.lang.String nodeName,
double x,
double y)
Sets the position of the center of the node in double coordinates.
|
void |
setNodeStateVirtualNumber(java.lang.String nodeName,
java.lang.Integer stateVirtualNumber)
Sets the state virtual number of the node to the given
Integer value. |
void |
setNodeStructuralCoefficient(java.lang.String nodeName,
java.lang.Double coefficient)
Sets the structural coefficient used for learning to the given
Double value. |
void |
setNodeTemporalIndex(java.lang.String nodeName,
java.lang.Integer temporalIndex)
Sets the temporal index of the node to the given value.
|
void |
setStateLongNameAt(java.lang.String nodeName,
java.lang.String longName,
int state)
Sets the long name of the given state for the given node.
|
void |
setStateLongNames(java.lang.String nodeName,
java.lang.String[] longNames)
Sets the long names for the states of the specified node.
|
void |
setStateValueAt(java.lang.String nodeName,
java.lang.Double stateValue,
int state)
Sets a value to the given state of the given node.
|
void |
setStateValues(java.lang.String nodeName,
java.lang.Double[] stateValues)
Sets the values for each state of the given node.
|
void |
setStructuralCoefficient(java.lang.Double coefficient)
Sets the global structural coefficient of the network for learning.
|
void |
setTimeUsed(boolean b)
Specifies 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.
|
void |
sortNodeNames(java.lang.String[] nodeNames,
APIUtils.NODE_SORTING_METHOD sortingMethod,
boolean increase)
Sort the given array containing the name of the nodes in the network sorted according to the
APIUtils.NODE_SORTING_METHOD |
public APIModeling(java.lang.String licenseKey)
APIModeling
with an empty bayesian network named new.xbl. You must provide a valid license key for modeling.licenseKey
- the key of the license.public APIModeling(java.lang.String licenseServerHost, int licenseServerPort, java.lang.String userName, java.lang.String password, java.lang.String account)
APIModeling
with an empty bayesian network named new.xbl. You must provide the host and the port of the license server. You must provide also the user name and the password of an access added to the license. This access must be associated to this license on the LicenseServer by using the Management Console of BayesiaLicenseServer. Use this constructor if you use a license server.licenseServerHost
- the host of the license server.licenseServerPort
- the port of the license server.userName
- the user name corresponding to an existing access added to the license on the license server. Cannot be null.password
- the password corresponding to the access added to the license on the license server. Cannot be null.account
- the account corresponding to the license. Cannot be null, but can be set as empty String on dedicated BLS.public APIModeling(java.lang.String fileName, java.lang.String licenseKey)
APIModeling
with the network stored in the specified file. You must provide a valid license key for modeling.fileName
- the name of the xbl file containing the networklicenseKey
- the key of the license.public APIModeling(java.io.InputStream stream, java.lang.String licenseKey)
APIModeling
with the network read from the specified InputStream. You must provide a valid licence key for modeling.stream
- the stream of the xbl file containing the networklicenseKey
- the key of the licence.public APIModeling(java.lang.String fileName, java.lang.String licenseServerHost, int licenseServerPort, java.lang.String userName, java.lang.String password, java.lang.String account)
APIModeling
with the network stored in the specified file. You must provide the host and the port of the license server. You must provide also the user name and the password of an access added to the license. This access must be associated to this license on the LicenseServer by using the Management Console of BayesiaLicenseServer. Use this constructor if you use a license server.fileName
- the name of the xbl file containing the networklicenseServerHost
- the host of the license server.licenseServerPort
- the port of the license server.userName
- the user name corresponding to an existing access added to the license on the license server. Cannot be null.password
- the passord corresponding to the access added to the license on the license server. Cannot be null.account
- the account corresponding to the license. Cannot be null, but can be set as empty String on dedicated BLS.public APIModeling(java.io.InputStream stream, java.lang.String licenseServerHost, int licenseServerPort, java.lang.String userName, java.lang.String password, java.lang.String account)
APIModeling
with the network read from the specified InputStream. You must provide the host and the port of the license server. You must provide also the user name and the password of an access added to the license. This access must be associated to this license on the LicenseServer by using the Management Console of BayesiaLicenseServer. Use this constructor if you use a license server.stream
- the stream of the xbl file containing the networklicenseServerHost
- the host of the license server.licenseServerPort
- the port of the license server.userName
- the user name corresponding to an existing access added to the license on the license server. Cannot be null.password
- the passord corresponding to the access added to the license on the license server. Cannot be null.account
- the account corresponding to the license. Cannot be null, but can be set as empty String on dedicated BLS.public APIModeling(BayesianNetworkTransferHandler networkHandler, java.lang.String licenseKey)
APIModeling
with the network stored in the specified BayesianNetworkTransferHandler
. You must provide a valid license key for modeling.networkHandler
- the transfer handler containing the networklicenseKey
- the key of the license.public APIModeling(BayesianNetworkTransferHandler networkHandler, java.lang.String licenseServerHost, int licenseServerPort, java.lang.String userName, java.lang.String password, java.lang.String account)
APIModeling
with the network stored in the specified BayesianNetworkTransferHandler
. You must provide the host and the port of the license server. You must provide also the user name and the password of an access added to the license. This access must be associated to this license on the LicenseServer by using the Management Console of BayesiaLicenseServer. Use this constructor if you use a license server.networkHandler
- the transfer handler containing the networklicenseServerHost
- the host of the license server.licenseServerPort
- the port of the license server.userName
- the user name corresponding to an existing access added to the license on the license server. Cannot be null.password
- the passord corresponding to the access added to the license on the license server. Cannot be null.account
- the account corresponding to the license. Cannot be null, but can be set as empty String on dedicated BLS.public final java.lang.String getName()
public final java.lang.String[] getNodeNames()
@Deprecated public final java.lang.String[] getChanceNodeNames()
public final java.lang.String[] getStandardNodeNames()
public final java.lang.String[] getDiscreteNodeNames()
public final java.lang.String[] getContinuousNodeNames()
public final java.lang.String[] getConstraintNodeNames()
public final java.lang.String[] getDecisionNodeNames()
public final java.lang.String[] getUtilityNodeNames()
public final java.lang.String[] getFunctionNodeNames()
public final void sortNodeNames(java.lang.String[] nodeNames, APIUtils.NODE_SORTING_METHOD sortingMethod, boolean increase)
APIUtils.NODE_SORTING_METHOD
nodeNames
- the node names to sortsortingMethod
- the sorting methodincrease
- true if you want an increasing order, false if you want a decreasing order@Deprecated public final java.lang.String[] getSortedNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod, boolean increase)
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD
sortingMethod
- the sorting methodincrease
- true if you want an increasing order, false if you want a decreasing order@Deprecated public final java.lang.String[] getSortedChanceNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod, boolean increase)
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the chance nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD
sortingMethod
- the sorting methodincrease
- true if you want an increasing order, false if you want a decreasing order@Deprecated public final java.lang.String[] getSortedFunctionNodeNames(APIUtils.NODE_SORTING_METHOD sortingMethod, boolean increase)
sortNodeNames(String[], APIUtils.NODE_SORTING_METHOD, boolean)
Return an array containing the name of the function nodes in the network sorted according to the APIUtils.NODE_SORTING_METHOD
sortingMethod
- the sorting methodincrease
- true if you want an increasing order, false if you want a decreasing orderpublic final int getNodeNumber()
@Deprecated public final int getChanceNodeNumber()
public final int getStandardNodeNumber()
public final int getDiscreteNodeNumber()
public final int getContinuousNodeNumber()
public final int getConstraintNodeNumber()
public final int getDecisionNodeNumber()
public final int getUtilityNodeNumber()
public final int getFunctionNodeNumber()
public final int getExcludedNodeNumber()
public final java.lang.String getComment()
public final java.lang.String getStringComment()
public final void setComment(java.lang.String comment)
comment
- the comment associated to the network.public final ResizableIcon getBackgroundImage()
ResizableIcon
or null if there is no imageResizableIcon
public final void setBackgroundImage(ResizableIcon image)
image
- the image associated to the networkResizableIcon
,
APIUtils.getResizableIcon(BufferedImage)
,
APIUtils.getResizableIcon(java.net.URL)
public final void arrangeNodePositions()
public final java.lang.String getNodeLongName(java.lang.String nodeName)
nodeName
- the name of the node we want the long namepublic final void setNodeLongName(java.lang.String nodeName, java.lang.String longName)
nodeName
- the name of the node we want to set the long namelongName
- the new long namepublic final java.lang.String getNodeComment(java.lang.String nodeName)
nodeName
- the name of the node we want the html commentpublic final java.lang.String getNodeStringComment(java.lang.String nodeName)
nodeName
- the name of the node we want the commentpublic final void setNodeComment(java.lang.String nodeName, java.lang.String comment)
nodeName
- the name of the node we want to set the commentcomment
- the new commentpublic final java.lang.String getArcComment(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
and nodeName2
.nodeName1
- the name of the first extremity nodenodeName2
- the name of the second extremity nodepublic final java.lang.String getArcStringComment(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
and nodeName2
.nodeName1
- the name of the first extremity nodenodeName2
- the name of the second extremity nodepublic final void setArcComment(java.lang.String nodeName1, java.lang.String nodeName2, java.lang.String comment)
nodeName1
and nodeName2
. The comment can be in html format or a simple string. In this last case, the string is converted into an html format.nodeName1
- the name of the first extremity nodenodeName2
- the name of the second extremity nodecomment
- the new comment of the arcpublic final java.awt.geom.Point2D getNodePosition(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodePosition(java.lang.String nodeName, double x, double y)
nodeName
- the name of the nodex
- the x positiony
- the y positionpublic final java.awt.Color getNodeColor(java.lang.String nodeName)
Color
associated to the node or null if there is no associated color.nodeName
- the name of the nodeColor
or null if no color is associatedpublic final void setNodeColor(java.lang.String nodeName, java.awt.Color color)
nodeName
- the name of the nodecolor
- the new color of the nodepublic final void setClassNodeColor(java.lang.String className, java.awt.Color color)
className
- the name of the classcolor
- the new color for each node of the classpublic final ResizableIcon getNodeImage(java.lang.String nodeName)
ResizableIcon
associated to the node or null if there is no associated image.nodeName
- the name of the nodeResizableIcon
if there is an image or null otherwiseResizableIcon
public final void setNodeImage(java.lang.String nodeName, ResizableIcon image)
nodeName
- the name of the nodeimage
- the new image of the nodeResizableIcon
,
APIUtils.getResizableIcon(BufferedImage)
,
APIUtils.getResizableIcon(java.net.URL)
public final void setClassNodeImage(java.lang.String className, ResizableIcon image)
className
- the name of the classimage
- the new image for each node of the classResizableIcon
,
APIUtils.getResizableIcon(BufferedImage)
,
APIUtils.getResizableIcon(java.net.URL)
public final java.lang.Integer getNodeTemporalIndex(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodeTemporalIndex(java.lang.String nodeName, java.lang.Integer temporalIndex)
nodeName
- the name of the nodetemporalIndex
- an Integer
representing the temporal index of the node or null if there is no temporal indexpublic final void setClassNodeTemporalIndex(java.lang.String className, java.lang.Integer temporalIndex)
className
- the name of the classtemporalIndex
- an Integer
representing the temporal index of each node of the class or null if there is no temporal indexpublic final double getNodeCost(java.lang.String nodeName)
nodeName
- the node of the namepublic final void setNodeCost(java.lang.String nodeName, java.lang.Double cost)
double
value. It reprensents the cost for an evidence to be set to the node. If the parameter is negative or null, the cost is removed from the node.nodeName
- the name of the nodecost
- a double
representing the cost of the node or null if there is no costpublic final void setClassNodeCost(java.lang.String className, java.lang.Double cost)
className
- the name of the classcost
- a double
representing the cost of each node of the class or null if there is no costpublic final java.lang.Integer getNodeStateVirtualNumber(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodeStateVirtualNumber(java.lang.String nodeName, java.lang.Integer stateVirtualNumber)
Integer
value. It represents the number of states used during the learning instead of the real number of state. If the parameter is less than 2 or null, the state virtual number is removed from the node.nodeName
- the name of the nodestateVirtualNumber
- an Integer
representing the state virtual number of the node or null if there is no state virtual numberpublic final void setClassNodeStateVirtualNumber(java.lang.String className, java.lang.Integer stateVirtualNumber)
className
- the name of the classstateVirtualNumber
- an Integer
representing the state virtual number of each node of the class or null if there is no state virtual numberpublic final double getNodeStructuralCoefficient(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodeStructuralCoefficient(java.lang.String nodeName, java.lang.Double coefficient)
Double
value. It allows the learning algorithm to add parents with less correlation if the values is less than 1 and only parents strongly correlated if the value is greater than 1. If the parameter is negative or null, the structural coefficient is reset to 1.nodeName
- the name of the nodecoefficient
- a Double
representing the learning structural of the nodepublic final void setClassNodeStateVirtualNumber(java.lang.String className, java.lang.Double coefficient)
className
- the name of the classcoefficient
- a Double
representing the learning structural of each node of the classpublic final boolean isNodeExcluded(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodeExcluded(java.lang.String nodeName, boolean excluded)
nodeName
- the name of the nodeexcluded
- the exclusion state of the nodepublic final void setClassNodeExcluded(java.lang.String className, boolean excluded)
className
- the name of the classexcluded
- the exclusion state of the each node of the classpublic final short getNodeFilteredState(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void setNodeFilteredState(java.lang.String nodeName, short index)
nodeName
- the name of the nodeindex
- the index of the filtered state or -1 if there is no filtered statepublic final void setFunctionNodeStringFormatter(java.lang.String nodeName, StringFormatter formatter)
FunctionValue
will use this formatter to format the output String. If the parameter is null, the String formatter is removed.nodeName
- the name of the function nodeformatter
- a StringFormatter
allowing to format the output when the computed value is a String.public final void setClassFunctionNodeStringFormatter(java.lang.String className, StringFormatter formatter)
FunctionValue
will use this formatter to format the output String. If the parameter is null, the String formatters are removed.className
- the name of the classformatter
- a StringFormatter
allowing to format the output when the computed value is a String.public final void setFunctionNodeNumberFormatter(java.lang.String nodeName, NumberFormatter formatter)
FunctionValue
will use this formatter to format the output Number. If the parameter is null, the Number formatter is removed.nodeName
- the name of the function nodeformatter
- a NumberFormatter
allowing to format the output when the computed value is a Number.public final void setClassFunctionNodeNumberFormatter(java.lang.String className, NumberFormatter formatter)
FunctionValue
will use this formatter to format the output Number. If the parameter is null, the Number formatters are removed.className
- the name of the classformatter
- a NumberFormatter
allowing to format the output when the computed value is a Number.public final void setFunctionNodeBooleanFormatter(java.lang.String nodeName, BooleanFormatter formatter)
FunctionValue
will use this formatter to format the output Boolean. If the parameter is null, the Boolean formatter is removed.nodeName
- the name of the function nodeformatter
- a BooleanFormatter
allowing to format the output when the computed value is a Boolean.public final void setClassFunctionNodeBooleanFormatter(java.lang.String className, BooleanFormatter formatter)
FunctionValue
will use this formatter to format the output Boolean. If the parameter is null, the Boolean formatters are removed.className
- the name of the classformatter
- a BooleanFormatter
allowing to format the output when the computed value is a Boolean.public final boolean isTimeUsed()
setTimeUsed(boolean)
public final void setTimeUsed(boolean b)
?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.
b
- true if the time should be used, false otherwise.isTimeUsed()
public final java.lang.Double getStructuralCoefficient()
Double
representing the global structural coefficient of the networkpublic final void setStructuralCoefficient(java.lang.Double coefficient)
coefficient
- the global structural coefficient of the networkpublic final java.lang.String[] getParents(java.lang.String nodeName)
nodeName
- the name of the node we want the parentspublic final java.lang.String[] getChildren(java.lang.String nodeName)
nodeName
- the name of the node we want the childrenpublic final boolean hasArcBetween(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
- the name of one extremitynodeName2
- the name of the other extremitypublic final boolean hasTemporalArcBetween(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
- the name of one extremitynodeName2
- the name of the other extremitypublic final boolean isParentOf(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
to nodeName2
nodeName1
- the name of the supposed parentnodeName2
- the name of the supposed childnodeName1
is parent of nodeName2
public final boolean isChildOf(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName2
to nodeName1
nodeName1
- the name of the supposed childnodeName2
- the name of the supposed parentnodeName1
is child of nodeName2
public final int getArcOrientationBetween(java.lang.String nodeName1, java.lang.String nodeName2)
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
nodeName1
- the name of one extremitynodeName2
- the name of the other extremitynodeName1
and nodeName2
public final void addLabelNode(java.lang.String nodeName, java.lang.String[] states)
nodeName
- the name of the new node.states
- an array containing the name of the states@Deprecated public final void addChanceLabelNode(java.lang.String nodeName, java.lang.String[] states)
addLabelNode(String, String[])
Creates a new discrete chance node with the specified states 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.nodeName
- the name of the new node.states
- an array containing the name of the statespublic final void addIntervalNode(java.lang.String nodeName, java.lang.String[] states, double[][] intervals)
nodeName
- the name of the new node.states
- an array containing the name of the statesintervals
- an array containing arrays storing the minimum and the maximum of each interval@Deprecated public final void addChanceIntervalNode(java.lang.String nodeName, java.lang.String[] states, double[][] intervals)
addIntervalNode(String, String[], double[][])
Creates a new continuous (interval) chance node with the specified states and the specified limits for each interval and add it to the network. The number of intervals is equal to the number of states. 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.nodeName
- the name of the new node.states
- an array containing the name of the statesintervals
- an array containing arrays storing the minimum and the maximum of each intervalpublic final void addConstraintNode(java.lang.String nodeName)
nodeName
- the name of the nodepublic final void addUtilityNode(java.lang.String nodeName)
nodeName
- the name of the node.public final void addDecisionLabelNode(java.lang.String nodeName, java.lang.String[] decisionNames)
nodeName
- the name of the nodedecisionNames
- an array containing the names of the decisions.public final void addDecisionIntervalNode(java.lang.String nodeName, java.lang.String[] decisionNames, double[][] intervals)
nodeName
- the name of the nodedecisionNames
- an array containing the names of the decisions.intervals
- an array containing arrays storing the minimum and the maximum of each intervalpublic final void addFunctionNode(java.lang.String nodeName)
nodeName
- the name of the node.public final boolean addArc(java.lang.String nodeName1, java.lang.String nodeName2)
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.nodeName1
- the parent nodenodeName2
- the child nodepublic final boolean addTemporalArc(java.lang.String nodeName1, java.lang.String nodeName2)
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 states. A temporal arc can be added from node1 to node2, if and only if there is no temporal arc from any parent of node1 towards node1, there is no temporal arc from node1 towards any
child of node1 and there is no temoral arc from node2 towards any child of node2. All these cases throw a IllegalOperationException
.nodeName1
- the parent chance nodenodeName2
- the child chance nodepublic final void removeArc(java.lang.String nodeName1, java.lang.String nodeName2)
nodeName1
- the name of one extremitynodeName2
- the name of the other extremitypublic final void removeNode(java.lang.String nodeName)
nodeName
- the name of the node we want to removepublic final double[] getConditionalProbabilityTable(java.lang.String nodeName)
The probabilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 states (Values ni), Parents X with 2 states(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
nodeName
- the name of the nodepublic final void setConditionalProbabilityTable(java.lang.String nodeName, double[] table)
The probabilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 states (Values ni), Parents X with 2 states(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
nodeName
- the name of the nodetable
- the new conditional probability tablepublic final double[] getDecisionTable(java.lang.String nodeName)
The decisions are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 states (Values ni), Parents X with 2 states(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
nodeName
- the name of the nodepublic final void setDecisionTable(java.lang.String nodeName, double[] table)
The decisions are enumerated with a specific order; it follows the enumeration of the parents, for examples : Node N with 3 states (Values ni), Parents X with 2 states(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
nodeName
- the name of the nodetable
- the new decision tablepublic final double[] getUtilityTable(java.lang.String nodeName)
The utilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Parents X with 2 states(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.
nodeName
- the name of the nodepublic final void setUtilityTable(java.lang.String nodeName, double[] table)
The utilities are enumerated with a specific order; it follows the enumeration of the parents, for examples : Parents X with 2 states(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.
nodeName
- the name of the nodetable
- the new utility tablepublic final void setFormula(java.lang.String nodeName, java.lang.String formula, boolean probabilist, int sampleNumber, int smoothingPower, boolean fixedSeed, long seed, boolean intervalExtended)
nodeName
- the name of the nodeformula
- the formulaprobabilist
- true if the formula is probabilist, false if is deterministsampleNumber
- > 0 if the node is an interval node.smoothingPower
- > 0 if you want to smooth the probabilities or 0 if you don't want.fixedSeed
- true if you want to use the specified long as seed of the random number generator, false otherwise (random seed used).seed
- ≥ 0 the seed used by the random number generator if the parameter fixedSeed is true. If fixedSeed is false, this parameter is not used.intervalExtended
- true if you yo extends the intervals' limits to the computed values outside the range of the intervals. Otherwise, it produces an exception if a computed value is outside. This parameter is only used by chance interval nodes.public final boolean isInteger(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isReal(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isBoolean(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isInterval(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isDecision(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isUtility(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isConstraint(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final boolean isFunction(java.lang.String nodeName)
nodeName
- the name of the tested nodepublic final java.lang.String[] getClasses()
String
representing the list of the classes or null if there is no class in the networkpublic final java.lang.String[] getNodeClasses(java.lang.String nodeName)
nodeName
- the name of the nodeString
representing the list of the classes or null if there is no class in which the node is involvedpublic final java.lang.String[] getClassNodes(java.lang.String className)
className
- the name of the classString
containing the name of the nodes belonging to the classpublic final void addClassToNode(java.lang.String className, java.lang.String nodeName)
className
to the specified node. If the class already exists in the network, it simply added to the node, otherwise a new class is created and added to the node.className
- the name of the classnodeName
- the name of the nodepublic final void removeClassFromNode(java.lang.String className, java.lang.String nodeName)
className
- the name of the classnodeName
- the name of the nodepublic final int getStateCount(java.lang.String nodeName)
nodeName
- the name of the nodepublic final java.lang.String[] getStringValues(java.lang.String nodeName)
String
. It can't be used on constraint and utility nodes.nodeName
- the name of the nodepublic final int[] getIntValues(java.lang.String nodeName)
nodeName
- the name of the nodepublic final double[] getRealValues(java.lang.String nodeName)
nodeName
- the name of the nodepublic final double[][] getIntervals(java.lang.String nodeName)
nodeName
- the name of the nodepublic final java.lang.String[] getStateLongNames(java.lang.String nodeName)
String
containing the long name for each state of the specified node. A state can have a long name or not. In this last case, the value will be null.nodeName
- the name of the nodeString
containing the state long namespublic final java.lang.String getStateLongNameAt(java.lang.String nodeName, int state)
nodeName
- the name of the nodestate
- the index of the stateString
representing the long namepublic final void setStateLongNames(java.lang.String nodeName, java.lang.String[] longNames)
nodeName
- the naem of the nodeslongNames
- an array of String
containing the long names of the statespublic final void setStateLongNameAt(java.lang.String nodeName, java.lang.String longName, int state)
longName
is null, the long name corresponding to the state will be removed.nodeName
- the name of the nodelongName
- the new long name associated to the statestate
- the index of the statepublic final java.lang.Double[] getStateValues(java.lang.String nodeName)
Double
containing the values associated to each state of the given node. If a state has no value associated, the corresponding Double
will be null in the array. If no state has an associated value, null is returned.nodeName
- the name of the nodeDouble
or null if there is no values associated to any statepublic final java.lang.Double getStateValueAt(java.lang.String nodeName, int state)
nodeName
- the name of the nodestate
- the index of the state we want the valueDouble
representing the associated valuepublic final void setStateValues(java.lang.String nodeName, java.lang.Double[] stateValues)
nodeName
- the name of the nodestateValues
- an array of Double
containing the values associated to the nodepublic final void setStateValueAt(java.lang.String nodeName, java.lang.Double stateValue, int state)
nodeName
- the name of the nodestateValue
- a Double
representing the associated valuestate
- the index of the concerned statepublic java.lang.String[] getConstantNames()
public void addStringConstant(java.lang.String constantName, java.lang.String value)
String
value.
Used in formulas by its name, this constant will be interpreted as a STRING.
constantName
- the name of the new STRING constantvalue
- the value of the constant as String
public boolean isStringConstant(java.lang.String constantName)
constantName
- the name of the constantpublic java.lang.String getConstantStringValue(java.lang.String constantName)
String
value of the specified STRING constant.constantName
- the name of the STRING constantString
public void addIntConstant(java.lang.String constantName, int value)
int
value.
Used in formulas by its name, this constant will be interpreted as an INTEGER.
constantName
- the name of the new INTEGER constantvalue
- the value of the constant as int
public boolean isIntConstant(java.lang.String constantName)
constantName
- the name of the constantpublic int getConstantIntValue(java.lang.String constantName)
int
value of the specified INTEGER constant.constantName
- the name of the INTEGER constantint
public void addRealConstant(java.lang.String constantName, double value)
double
value.
Used in formulas by its name, this constant will be interpreted as a REAL.
constantName
- the name of the new REAL constantvalue
- the value of the constant as double
public boolean isRealConstant(java.lang.String constantName)
constantName
- the name of the constantpublic double getConstantRealValue(java.lang.String constantName)
double
value of the specified REAL constant.constantName
- the name of the REAL constantdouble
public void addBooleanConstant(java.lang.String constantName, boolean value)
boolean
value.
Used in formulas by its name, this constant will be interpreted as a BOOLEAN.
constantName
- the name of the new BOOLEAN constantvalue
- the value of the constant as boolean
public boolean isBooleanConstant(java.lang.String constantName)
constantName
- the name of the constantpublic boolean getConstantBooleanValue(java.lang.String constantName)
boolean
value of the specified BOOLEAN constant.constantName
- the name of the BOOLEAN constantboolean
public void removeConstant(java.lang.String constantName)
constantName
- the name of the removed constantpublic final java.lang.String getFormula(java.lang.String nodeName)
String
. If the node doesn't have a formula it returns null.nodeName
- the name of the nodeString
representing the formula of the nodepublic final boolean isFormulaProbabilist(java.lang.String nodeName)
nodeName
- the name of the node we want to test the formulapublic final int getFormulaSampleNumber(java.lang.String nodeName)
nodeName
- the name of the interval nodepublic final int getFormulaSmoothingPower(java.lang.String nodeName)
nodeName
- the name of the nodepublic final boolean isFormulaUseFixedSeed(java.lang.String nodeName)
nodeName
- the name of the nodepublic final long getFormulaFixedSeed(java.lang.String nodeName)
nodeName
- the name of the nodepublic final boolean isTemporal()
public final void save(java.lang.String path)
xbl
. The name of the network is now the name of the file.path
- the path to an xbl filepublic final void save(java.io.OutputStream stream)
OutputStream
.stream
- the output stream where the network is savedpublic final BayesianNetworkTransferHandler exportNetwork(java.lang.String networkName)
BayesianNetworkTransferHandler
in order to used it with the APIModeling
for example. The name of the network must be terminated by .xbl
networkName
- the new name of the network with the xbl extensionpublic final void close()
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.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable