|
<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Diagnosis > Observation cost |
Observing the value of a variable is often associated with a cost. For example, measuring a patient’s platelet count requires drawing a blood sample and analyzing it, while measuring the temperature of an air conditioner exhaust unit requires a technician’s time. Optimal diagnosis must consider both the value of information and the cost of obtaining it.
For any diagnostic observation node, the cost of observing its value can be specified using Network.set_node_cost and retrieved with Network.get_node_cost. Costs can be expressed on any scale, such as currency or time in minutes. Negative values are also allowed; these indicate tests that are sufficiently inexpensive that they should always be performed—for example, checking the car model when diagnosing a vehicle.
When the cost of observing a node is independent of other observations, it is specified as a single number. In some cases, however, the cost depends on whether other nodes have been observed. For instance, once a blood sample is drawn, additional tests on the same sample are cheaper than if no sample exists. Similarly, measuring a parameter of a locomotive engine may cost less when the engine is in the shop compared to in the field. Removing a locomotive cover may take hours, but once removed, many tests become inexpensive.
To model such dependencies, use Network.add_cost_arc. This adds an observation cost arc to the network. Observation cost arcs are independent of standard network arcs. When a diagnostic observation node has incoming cost arcs, its observation cost is represented as a multidimensional array, analogous to a conditional probability table, with the last dimension size equal to one.
Cost arcs can be removed using Network.remove_cost_arc. The methods Network.get_cost_parents, Network.get_cost_parent_ids and Network.get_cost_children / Network.get_cost_children_ids can be used to retrieve information about cost parents and children.
The following methods provide programmatic access to the observation cost of diagnostic nodes.
Python
add_cost_arc(parent: int | str, child: int | str) -> None
delete_cost_arc(parent: int | str, child: int | str) -> None
get_cost_parents(node: int | str) -> List[int]
get_cost_parent_ids(node: int | str) -> List[str]
get_cost_children(node: int | str) -> List[int]
get_cost_child_ids(node: int | str) -> List[str]
get_node_cost(node: int | str) -> List[float]
set_node_cost(node: int | str, cost: List[float]) -> None
Java
void addCostArc(int parentHandle, int childHandle);
void addCostArc(String parentId, String childId);
void deleteCostArc(int parentHandle, int childHandle);
void deleteCostArc(String parentId, String childId);
int[] getCostParents(int nodeHandle);
int[] getCostParents(String nodeId);
String[] getCostParentIds(int nodeHandle);
String[] getCostParentIds(String nodeId);
int[] getCostChildren(int nodeHandle);
int[] getCostChildren(String nodeId);
String[] getCostChildIds(int nodeHandle);
String[] getCostChildIds(String nodeId);
double[] getNodeCost(int nodeHandle);
double[] getNodeCost(String nodeId);
void setNodeCost(int nodeHandle, double[] cost);
void setNodeCost(String nodeId, double[] cost);
C#
void AddCostArc(int parentHandle, int childHandle);
void AddCostArc(string parentId, string childId);
void DeleteCostArc(int parentHandle, int childHandle);
void DeleteCostArc(string parentId, string childId);
int[] GetCostParents(int nodeHandle);
int[] GetCostParents(string nodeId);
string[] GetCostParentIds(int nodeHandle);
string[] GetCostParentIds(string nodeId);
int[] GetCostChildren(int nodeHandle);
int[] GetCostChildren(string nodeId);
string[] GetCostChildIds(int nodeHandle);
string[] GetCostChildIds(string nodeId);
double[] GetNodeCost(int nodeHandle);
double[] GetNodeCost(string nodeId);
void SetNodeCost(int nodeHandle, double[] cost);
void SetNodeCost(string nodeId, double[] cost);
R
add_cost_arc(parentIdOrHandle, childIdOrHandle)
delete_cost_arc(parentIdOrHandle, childIdOrHandle)
costParentHandles <- get_cost_parents(nodeIdOrHandle)
costParentIds <- get_cost_parent_ids(nodeIdOrHandle)
costChildHandles <- get_cost_children(nodeIdOrHandle)
costChildIds <- get_cost_child_ids(nodeIdOrHandle)
nodeCcost <- get_node_cost(nodeIdOrHandle)
set_node_cost(nodeIdOrHandle, cost)