forked from sbarex/SourceCodeSyntaxHighlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.vb
More file actions
54 lines (37 loc) · 1.1 KB
/
Copy pathexample.vb
File metadata and controls
54 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Sub Main()
On Error GoTo Failed
Dim app As Netica.Application
app = New Netica.Application
Dim casefile As Streamer
Dim net As Bnet
Set netfile = app.NewStream("C:\Netica Data\BNs\Car_Diagnosis_0_Learned.dne")
Set casefile = app.NewStream("C:\Netica Data\Cases\Good Cases\Car Cases 10.cas")
Set net = app.ReadBNet(netfile)
net.AutoUpdate = 1
net.Compile
Dim lights_node As Bnode
Set lights_node = net.Node("Lights")
Dim lights_dim As Long
lights_dim = lights_node.GetStateIndex("dim")
Dim id As Long
Dim fr As Double
Dim caseposn As Long
Dim done As Boolean
done = False
caseposn = FirstCase
Do
net.RetractFindings
net.ReadFindings case_posn:=caseposn, stream:=casefile, IDNum:=id, freq:=fr
net.ReadFindings case_posn:=caseposn, stream:=casefile, nodes:=net.Nodes, IDNum:=id, freq:=fr
If caseposn = NoMoreCases Then
done = True
Else
MsgBox "Belief in Lights dim = " & lights_node.GetBelief(lights_dim)
End If
caseposn = NextCase
Loop Until done
net.Delete
Exit Sub
Failed:
MsgBox "Error " & ((err.Number And &H7FFF) - 10000) & ": " & err.Description
End Sub