-
Notifications
You must be signed in to change notification settings - Fork 0
/
c_help.tcl
132 lines (93 loc) · 4.04 KB
/
c_help.tcl
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#Tcl/tk version 8.4.19.5 available here: www.activestate.com/activetcl/downloads
#ActiveState ActiveTcl
#This is part of a tcl/tk user interface customized to the knowledge-based system shell Klöver.
#Developed by Petter Fogelqvist December-January 2011-2012
package require BWidget
font create ObjectO -size -12 -slant italic
set sw [ScrolledWindow .t -background #EED5B7 ]
set sf [ScrollableFrame $sw.f -background #ffe4c4 -width 410 -height 500 ]
$sw setwidget $sf
set subf [$sf getframe]
frame $subf.b
frame $subf.b.title
label $subf.b.title.label -text "Completeness" -font Title
pack $subf.b.title.label -side top -ipady 10 -ipadx 10
pack $subf.b.title -pady 10 -padx 10
frame $subf.b.info
message $subf.b.info.i -text "The 'Completeness' option detects:
1. Unreachable rules.
2. Missing rules.
The tool checks:
(1)if there exist rules with identical rule numbers and objects in the rule base.
(1)if all rule numbers exists in rule_info/2.
(1)if each object in the rule-base are represented in a clause of rule_info/2.
(1)if each object in the rule-base are represented in the list of goal_conclusions/1.
(2)if rule numbers present in rule_info/2 have a correspondent rule in the rule base." \
-background #CDB79E -justify left -width 430
pack $subf.b.info.i -ipady 2 -ipadx 2
pack $subf.b.info -fill x -padx 2
frame $subf.b.bf -relief groove -borderwidth 0
button $subf.b.bf.1 -text "See examples" -background #EED5B7 -command {example $subf}
button $subf.b.bf.2 -text "Back" -width 10 -background #EED5B7 -command {back $subf}
pack $subf.b.bf.1 $subf.b.bf.2 -side left -pady 3 -padx 20
pack $subf.b.bf -expand 1 -fill x
pack $subf.b -ipadx 10 -ipady 10 -padx 20 -expand 1 -fill both
proc back {subf} {
destroy $subf.c
prolog_event "'Back'"
}
proc example {subf} {
labelframe $subf.c -relief groove -borderwidth 2 -text "Examples of incompleteness" -font ObjectO -background #CDB79E
message $subf.c.p -text "Format: rule(Rule_Number, Rule_Class, Rule_Attribute, Certainty_factor)
Example of two rules with duplicated rule numbers and conclusions in Klöver:
rule(1, Class1, Attribute1, 400) :-
premise(A),
premise(B).
has the same rule number and class as:
rule(2, Class1, Attribute2, 600) :-
premise(C).
The second rule will never be reached when the first rule succeeds.
------------------------------------------------------------------
Example of an unreachable rule in Klöver:
rule_info(Class1, (1,3,4,5,6,7,8,9)).
rule(2,Class1, Attribute1,600):-
premise(A).
The rule-number 2 is not represented in the clause of rule_info/2.
-------------------------------------------------------------------
Example of a missing clause of rule_info/2 in Klöver:
rule_info(Class2,(3)).
rule(1,Class1, Attribute1,600):-
premise(A).
rule(3,Class2, Attribute1,200):-
premise(B).
A clause of rule_info/2 for Class1 is missing.
-------------------------------------------------------------------
Example of a missing class in goal_conclusions/1 in Klöver:
goal_conclusions((Class1))
rule(1,Class1, Attribute1,600):-
premise(A).
rule(3,Class2, Attribute1,200):-
premise(B).
Class2 is missing in goal_conclusions/1.
--------------------------------------------------------------------
Example of a missing rule in Klöver:
(when a number in rule_info\2 does not have a correspondent rule in the rule base)
rule_info(Class2,(10,20,30,)).
rule(10,Class2, Attribute1,600):-
premise(A).
rule(30,Class2, Attribute2,-500):-
premise(B).
There is no rule in the rule base with rule-number 20." -background #CDB79E -justify left -width 420
pack $subf.c.p -fill x
$subf.b.bf.1 configure -state disabled
pack $subf.c -ipadx 10 -ipady 10 -expand 1 -fill both
}
pack $sw -ipadx 40 -ipady 10 -padx 40
bind $subf.b.bf.1 <Enter> { $subf.b.bf.1 config -background #CDB79E }
bind $subf.b.bf.1 <Leave> { $subf.b.bf.1 config -background #EED5B7 }
bind $subf.b.bf.2 <Enter> { $subf.b.bf.2 config -background #CDB79E }
bind $subf.b.bf.2 <Leave> { $subf.b.bf.2 config -background #EED5B7 }
#tk_setPalette tk_bisque #bebebe
tk_bisque
font delete ObjectO
#-background #ffff99