home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
aijournl
/
1986_11
/
aiapp.nov
< prev
next >
Wrap
Text File
|
1986-09-25
|
39KB
|
1,132 lines
AI Apprentice
by Bill Thompson and Bev Thompson
November 1986 AI EXPERT
TREES.KB
Knowledge Base
1
if stocking good is yes
and avg < 5 is yes
and 2000 + per acre is yes
then weed or clean is yes
and branch 8 is yes .
prompt stocking good
Is the stocking of the jack pine stand currently at least minimum ?
If you are unsure of how to determine stocking see page 4 in the
Mangagers Handbook for Jack Pine.
.
trans stocking good
the jack pine stocking in the area is /not/ minimum or higher
.
prompt avg < 5
Is the average diameter of the trees less than 5 inches ?
.
trans avg < 5
the average is /not/ < 5 inches
.
prompt 2000 + per acre
Are there 2000 or more trees per acre ?
.
trans 2000 + per acre
there are /not/ at least 2000 trees per acre
.
trans weed or clean
the stand of jack pine must /not/ be weeded and cleaned
.
2
if stocking good is yes
and avg < 5 is yes
and 2000 + per acre is no
then branch 8 is yes .
3
if stocking good is yes
and avg < 5 is no
and age is mature
then branch 9 is no
and branch 11 is yes .
prompt age
Is the age of the stand mature or immature ?
.
trans age
the age of the stand
.
4
if stocking good is yes
and avg < 5 is no
and age is immature
and site index > 60 is yes
and product size is large
and 120 + basal area is yes
then thin the area is yes
and branch 9 is yes .
prompt site index > 60
Is the site index greater than 60 ?
.
prompt product size
Do you want to manage the timber for large or small products ?
.
prompt 120 + basal area
Is the basal area per acre at least 120 square feet ?
.
trans thin the area
It is /not/ important to thin the area
.
5
if stocking good is yes
and avg < 5 is no
and age is immature
and site index > 60 is yes
and product size is large
and 120 + basal area is no
then branch 9 is yes .
6
if stocking good is yes
and avg < 5 is no
and age is immature
and site index > 60 is yes
and product size is large
then branch 9 is yes .
7
if stocking good is yes
and avg < 5 is no
and age is immature
and site index > 60 is no
then branch 9 is yes .
8
if stocking good is no
and other resources is yes
then maintain is yes
and recommend is maintain .
prompt other resources
Do you want to maintain this condition to support other resources ?
.
trans other resources
it is /not/ necessary to maintain the present condition for other resources
.
trans maintain
you should /not/ maintain the stand in its present condition
.
9
if stocking good is no
and other resources is no
then branch 11 is yes .
10
if branch 8 is yes
and severe competition is yes
then release is yes
and branch 9 is yes .
prompt severe competition
Is there severe overstory competition ?
.
trans severe competition
there is /not/ severe overstory competition
.
trans release
Competing trees should /not/ be eliminated
.
11
if branch 8 is yes
and severe competition is no
then branch 9 is yes .
12
if branch 9 is yes
and high risk is yes
then control if feasible is yes
and recommend is control if feasible .
prompt high risk
Is there a high risk of injury or loss ?
.
trans high risk
there is /not/ a high risk of injury or loss
.
trans control if feasible
the current area should /not/ be controlled if that is at all feasible
.
13
if branch 9 is yes
and high risk is no
then wait is yes
and recommend is wait .
trans wait
You should /not/ wait before doing anything else to this stand
.
14
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is yes
and 10/acre adequate is yes
and burning planned is yes
then use seed tree is yes
and recommend is use seed tree .
prompt pine desired
Do you want to keep jack pine in this area ?
.
trans pine desired
Jack pine is /not/ wanted in the area
.
prompt pine suited
Is jack pine well suited to this site ?
.
trans pine suited
the area is /not/ well suited to jack pine
.
prompt desirable seed
Is there a desirable jack pine seed source on the area ?
.
trans desirable seed
there is /not/ a desirable seed source on the area
.
prompt serotinous cones
Do the trees on the site have serotinous cones ?
.
trans serotinous cones
there is /not/ a supply of serotinous cones
.
prompt 10/acre adequate
Are 10 trees per acre adequate to seed the area ?
.
trans 10/acre adequate
10 per acre is /not/ adequate
.
prompt burning planned
Has a prescribed burning been planned ?
.
trans burning planned
burning is /not/ planned
.
trans use seed tree
You should /not/ use seed trees to seed the area
.
15
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is yes
and 10/acre adequate is yes
and burning planned is no
then silviculture method is clearcut
and branch 17 is yes .
trans silvaculture method
the best silviculture method to use
.
16
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is yes
and 10/acre adequate is no
then silviculture method is clearcut
and branch 17 is yes .
17
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is no
and two harvests wanted is yes
and two harvests possible is yes
then silviculture method is shelterwood
and branch 17 is yes .
prompt two harvests wanted
Do you want to do two commercial harvests on this area ?
.
trans two harvests wanted
two commercial harvests are /not/ wanted
.
prompt two harvests possible
Is it possible to get two harvests from this area ?
.
trans two harvests possible
two harvests can /not/ be done on this area
.
18
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is no
and two harvests wanted is yes
and two harvests possible is no
then silviculture method is clearcut
and branch 17 is yes .
19
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is yes
and serotinous cones is no
and two harvests wanted is no
then silviculture method is clearcut
and branch 17 is yes .
20
if branch 11 is yes
and pine desired is yes
and pine suited is yes
and desirable seed is no
then silviculture method is clearcut
and branch 17 is yes .
21
if branch 11 is yes
and pine desired is yes
and pine suited is no
then convert is yes
and recommend is convert .
trans convert
you should /not/ convert the area to some more desirable kind of tree
.
22
if branch 11 is yes
and pine desired is no
then convert is yes
and recommend is convert .
26
if branch 17 is yes
and adequate seedbed is yes
then branch 18 is yes .
prompt adequate seedbed
Is there an adequate seedbed for planting ?
.
trans adequate seedbed
there is /not/ an adequate seedbed for planting
.
27
if branch 17 is yes
and adequate seedbed is no
then prepare site is yes
and branch 18 is yes .
trans prepare site
the site should /not/ be prepared before planting
.
28
if branch 18 is yes
and silviculture method is shelterwood
then use natural seeding is yes
and recommend is use natural seeding .
trans use natural seeding
natural seeding techniques should /not/ be used
.
29
if branch 18 is yes
and silviculture method is clearcut
and improved stock is yes
then plant is yes
and recommend is plant .
prompt improved stock
Is there improved planting stock available ?
.
trans improved stock
there is /not/ improved stock available
.
trans plant
since there is better stock available you can /not/ plant using that stock
.
30
if branch 18 is yes
and silviculture method is clearcut
and improved stock is no
and good cone supply is yes
then scatter cones is yes
and recommend is scatter cones .
prompt good cone supply
Is there a good supply of serotinous cones on the area ?
.
trans good cone supply
there is /not/ a good cone supply
.
trans scatter cones
you should /not/ scatter the supply of serotinous cones over the area
.
31
if branch 18 is yes
and silviculture method is clearcut
and improved stock is no
and good cone supply is no
then direct seed is yes
and recommend is direct seed .
trans direct seed
Since the cone supply is inadequate, you should /not/ directly seed the
area
.
-------------------------------------------------------------------------
The following comments are not a part of the knowledge base. If you
try to run the knowledge base this part of the file should be removed
Abbreviated KEY
1. stocking good is yes ............................. 2
1. stocking good is no ............................. 10
2. avg < 5 is yes ................................ 3
2. avg < 5 is no ................................. 4
3. 2000 + per acre is yes ..........WEED OR CLEAN.... 8
3. 2000 + per acre is no ............................ 8
4. age is mature ................................. 11
4. age is immature ............................... 5
5. site index > 60 is yes ........................... 6
5. site index > 60 is no ............................ 9
6. product size is large ......................... 7
6. product size is small ......................... 9
7. 120 + basal area is yes .........THIN............. 9
7. 120 + basal area is no ........................... 9
8. severe competition is yes ....RELEASE.......... 9
8. severe competition is no ...................... 9
9. high risk is yes ................................. CONTROL IF FEASIBLE
9. high risk is no .................................. WAIT
10. other resources is yes ....................... MAINTAIN
10. other resources is no ........................ 11
11. pine suitable is yes ............................. 12
11. pine suitable is no .............................. CONVERT
12. desirable seed is yes ........................ 13
12. desirable seed is no ........USE CLEARCUT..... 17
13. serotinous cones is yes .......................... 14
13. serotinous cones is no ........................... 16
14. 10/acre adequate is yes ...................... 15
14. 10/acre adequate is no ......USE CLEARCUT..... 17
15. burning planned is yes ........................... USE SEED TREE
15. burning planned is no ...........USE CLEARCUT..... 17
16. two harvests wanted is yes ..USE SHELTERWOOD.. 17
16. two harvests wanted is no ...USE CLEARCUT..... 17
17. adequate seedbeds is yes ......................... 18
17. adequate seedbeds is no .........PREPARE SITE..... 18
18. silviculture method is shelterwood ........... USE NATURAL SEEDING
18. silviculture method is clearcut .............. 19
19. improved stock is yes ............................ PLANT
19. improved stock is no ............................. 20
20. good cone supply is yes ...................... SCATTER CONES
20. good cone supply is no ....................... DIRECT SEED
The purpose of this exercise is to show how a knowledge base can be
designed to directly follow a key. There are several places where the
KB could have been made more efficient, but this would have meant
departing from the order of the key. You might find it an interesting
exercise to explore other ways this same information could have been
represented in the KB.
The key appears in the Managers Handbood for Jack Pine in the North Central
States. The Handbook was produced by the North Central Forest Experiment
Station of the Forest Service of the U.S. Dept. of Agriculture. Our
intention in writing this knowledge base is to show the structure of a
knowledge base written for a backward chaining inference engine directly
from an existing document. If this KB were to be actually used, it would
need to have clearer questions and more explanations to the user. These
explanations are provided in the handbook and could be easily incorporated
into the knowledge base.
The knowledge base will run on the expert system shell MicroExpert which is
an example of a backward chaining inference engine. MicroExpert is
available from McGraw-Hill for $49.95 and can be ordered by calling 1-800-
628-0004 or, in NY, 212-512-2999 . The knowledge base is described in the
column AI Apprentice which appears in the November issue of AI Expert
magazine. The design details of the inference engine which runs the KB is
described in the article "Inside an Expert System" in the April 1985
isuue of BYTE magazine.
MicroExpert, AI Apprentice and "Inside an Expert System" are all written
by Bev and Bill Thompson . We're always happy to hear about your thoughts
and comments, good or bad on any of our work. Contact us at the address
below, on Compuserve or BIX. Our Compuserve id is 76703,4324 and we can be
reached by Easyplex or in the AI Expert Forum. Our BIX id is bbt and we
may be contacted via BIXmail or by leaving comments in the MicroExpert
conference.
Bill and Bev Thompson
R.D. 2 Box 430
Nassau, N.Y. 12123
TREES.PRO
PROLOG program
/* This PDPROLOG program implements a knowledge base based upon the
following key:
To run the program type "go."
Caution - This program can be very S L O W.
Abbreviated KEY
1. stocking good is yes ............................. 2
1. stocking good is no ............................. 10
2. avg < 5 is yes ................................ 3
2. avg < 5 is no ................................. 4
3. 2000 + per acre is yes ..........WEED OR CLEAN.... 8
3. 2000 + per acre is no ............................ 8
4. age is mature ................................. 11
4. age is immature ............................... 5
5. site index > 60 is yes ........................... 6
5. site index > 60 is no ............................ 9
6. product size is large ......................... 7
6. product size is small ......................... 9
7. 120 + basal area is yes .........THIN............. 9
7. 120 + basal area is no ........................... 9
8. severe competition is yes ....RELEASE.......... 9
8. severe competition is no ...................... 9
9. high risk is yes ................................. CONTROL IF FEASIBLE
9. high risk is no .................................. WAIT
10. other resources is yes ....................... MAINTAIN
10. other resources is no ........................ 11
11. pine suitable is yes ............................. 12
11. pine suitable is no .............................. CONVERT
12. desirable seed is yes ........................ 13
12. desirable seed is no ........USE CLEARCUT..... 17
13. serotinous cones is yes .......................... 14
13. serotinous cones is no ........................... 16
14. 10/acre adequate is yes ...................... 15
14. 10/acre adequate is no ......USE CLEARCUT..... 17
15. burning planned is yes ........................... USE SEED TREE
15. burning planned is no ...........USE CLEARCUT..... 17
16. two harvests wanted is yes ..USE SHELTERWOOD.. 17
16. two harvests wanted is no ...USE CLEARCUT..... 17
17. adequate seedbeds is yes ......................... 18
17. adequate seedbeds is no .........PREPARE SITE..... 18
18. silviculture method is shelterwood ........... USE NATURAL SEEDING
18. silviculture method is clearcut .............. 19
19. improved stock is yes ............................ PLANT
19. improved stock is no ............................. 20
20. good cone supply is yes ...................... SCATTER CONES
20. good cone supply is no ....................... DIRECT SEED
The purpose of this exercise is to show how an expert system can be
designed to directly follow a key. There are several places where the
program could have been made more efficient, but this would have meant
departing from the order of the key. You might find it an interesting
exercise to explore other ways this same information could have been
represented in the program.
The key appears in the Managers Handbood for Jack Pine in the North Central
States. The Handbook was produced by the North Central Forest Experiment
Station of the Forest Service of the U.S. Dept. of Agriculture. Our
intention in writing this knowledge base is to show the structure of a
knowledge base written for a backward chaining inference engine directly
from an existing document. If this KB were to be actually used, it would
need to have clearer questions and more explanations to the user. These
explanations are provided in the handbook and could be easily incorporated
into the knowledge base.
This program is similar to the KB for the expert system shell
MicroExpert which is an example of a backward chaining inference engine.
MicroExpert is available from McGraw-Hill for $49.95 and can be ordered
by calling 1-800-628-0004 or, in NY, 212-512-2999 .
The knowledge base is described in the AI Apprentice column which appears
in the November issue of AI Expert magazine.
The design details of the inference engine which runs the KB is
described in the article "Inside an Expert System" in the April 1985
isuue of BYTE magazine.
MicroExpert, AI Apprentice and "Inside an Expert System" are all written
by Bev and Bill Thompson . We're always happy to hear about your thoughts
and comments, good or bad on any of our work. Contact us at the address
below, on Compuserve or BIX. Our Compuserve id is 76703,4324 and we can be
reached by Easyplex or in the AI Expert Forum. Our BIX id is bbt and we
may be contacted via BIXmail or by leaving comments in the MicroExpert
conference.
Bill and Bev Thompson
R.D. 2 Box 430
Nassau, N.Y. 12123 */
/* Control - In MicroExpert terms, the goal of the consultation is
recommendation */
go :- clear_kb,
give_advice.
give_advice :- recommendation(X),
fail.
give_advice :- print_advice.
/* The rules -
These are implemented this way to mimic the MicroExpert rule set.
Looking at them side by side should show the similarities. */
fact(branch8,yes) :- fact('stocking good',yes),
fact('avg < 5',yes),
fact('2000+ per acre',yes),
recommend('The stand of jack pine must be weeded and cleaned.').
fact(branch8,yes) :- fact('stocking good',yes),
fact('avg < 5',yes),
fact('2000+ per acre',no).
fact(branch9,no) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,mature),
assertz(fact(branch11,yes)).
fact(branch11,yes) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,mature),
assertz(fact(branch9,no)).
fact(branch9,yes) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,immature),
fact('site index > 60',yes),
fact('product size',large),
fact('120+ basal area',yes),
recommend('It is important to thin the area').
fact(branch9,yes) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,immature),
fact('site index > 60',yes),
fact('product size',large),
fact('120+ basal area',no).
fact(branch9,yes) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,immature),
fact('site index > 60',yes),
fact('product size',large).
fact(branch9,yes) :- fact('stocking good',yes),
fact('avg < 5',no),
fact(age,immature),
fact('site index > 60',yes).
recommendation(maintain) :-
fact('stocking good',no),
fact('other resources',yes),
recommend('You should maintain the stand in its present condition').
fact(branch11,yes) :- fact('stocking good',no),
fact('other resources',no).
fact(branch9,yes) :- fact(branch8,yes),
fact('severe competition',yes),
recommend('Competing trees should be eliminated.').
fact(branch9,yes) :- fact(branch8,yes),
fact('severe competition',no).
recommendation(control) :-
fact(branch9,yes),
fact('high risk',yes),
recommend('The current area should be controlled, if at all feasible.').
recommendation(wait) :-
fact(branch9,yes),
fact('high risk',no),
recommend('You should wait before doing anything else to this stand.').
recommendation('use seed tree') :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',yes),
fact('10/acres adequate',yes),
fact('burning planned',yes),
recommend('You should use seed trees to seed the area.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',yes),
fact('10/acres adequate',yes),
fact('burning planned',no),
add_fact(silvaculture,clearcut),
recommend('The best silvaculture method to use is clearcut.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',yes),
fact('10/acres adequate',no),
add_fact(silvaculture,clearcut),
recommend('The best silvaculture method to use is clearcut.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',no),
fact('two harvests wanted',yes),
fact('two harvests possible',yes),
add_fact(silvaculture,shelterwood),
recommend('The best silvaculture method to use is the shlterwood method.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',no),
fact('two harvests wanted',yes),
fact('two harvests possible',no),
add_fact(silvaculture,clearcut),
recommend('The best silvaculture method to use is clearcut.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',yes),
fact('serotinous cones',no),
fact('two harvests wanted',no),
add_fact(silvaculture,clearcut),
recommend('The best silvaculture method to use is clearcut.').
fact(branch17,yes) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',yes),
fact('desirable seed',no),
add_fact(silvaculture,clearcut),
recommend('The best silvaculture method to use is clearcut.').
recommendation(convert) :-
fact(branch11,yes),
fact('pine desired',yes),
fact('pine suited',no),
recommend('You should convert the area to some more desirable kind of tree.').
recommendation(convert) :-
fact(branch11,yes),
fact('pine desired',no),
recommend('You should convert the area to some more desirable kind of tree.').
fact(branch18,yes) :-
fact(branch17,yes),
fact('adequate seedbed',yes).
fact(branch18,yes) :-
fact(branch17,yes),
fact('adequate seedbed',no),
recommend('The site should be prepared before planting.').
recommendation('natural seeding') :-
fact(branch18,yes),
fact(silvaculture,shelterwood),
recommend('The natural seeding technique should be used.').
recommendation(plant) :-
fact(branch18,yes),
fact(silvaculture,clearcut),
fact('improved stock',yes),
recommend('Since there is better stock available, you can plant using that stock.').
recommendation('scatter cones') :-
fact(branch18,yes),
fact(silvaculture,clearcut),
fact('improved stock',no),
fact('good cone supply',yes),
recommend('You should scatter the serotinous cones over the area.').
recommendation('direct seed') :-
fact(branch18,yes),
fact(silvaculture,clearcut),
fact('improved stock',no),
fact('good cone supply',no),
recommend('You should directly seed the area.').
/* These routines add new facts to the internal knowledge base - kb */
fact(X,Y) :- kb(X,Y),! .
fact(X,Y) :- not(kb(X,Anything)),
question(X,Answer),
assertz(kb(X,Answer)),
Y = Answer.
add_fact(X,Y) :- kb(X,Y),!.
add_fact(X,Y) :- assertz(kb(X,Y)).
recommend(X) :- add_fact(advice,X).
/* Questions to ask the user */
question('stocking good',Ans) :-
print('Is the stocking of the jack pine stand currently'),nl,
print('at least minimum ? '),nl,nl,
print('If you are unsure of how to determine stocking,'),nl,
print('see page 4 in the Managers Handbook for Jack Pine'),
nl,
ask('',Ans,[ yes , no ]).
question('avg < 5',Ans) :-
ask('Is the average diameter of the trees less than 5 inches ?',
Ans,[yes,no]).
question('2000+ per acre',Ans) :-
ask('Are there 2000 or more trees per acre ?',Ans,[yes,no]).
question(age,Ans) :-
ask('Is the age of the stand mature or immature ?',
Ans,[mature,immature]).
question('site index > 60',Ans) :-
ask('Is the site index greater than 60 ?',Ans,[yes,no]).
question('product size',Ans) :-
ask('Do you want to manage the timber for large or small products ?',
Ans,[large,small]).
question('120+ basal area',Ans) :-
ask('Is the basal area per acre at least 120 square feet ?',
Ans,[yes,no]).
question('other resources',Ans) :-
ask('Do you want to maintain this condition to support other resources?',
Ans,[yes,no]).
question('severe competition',Ans) :-
ask('Is there severe overstory competition ?',Ans,[yes,no]).
question('high risk',Ans) :-
ask('Is there a high risk of loss or injury ?',Ans,[yes,no]).
question('pine desired',Ans) :-
ask('Do you want to keep jack pine in this area ?',Ans,[yes,no]).
question('pine suited',Ans) :-
ask('Is jack pine well suited to this site ?',Ans,[yes,no]).
question('desirable seed',Ans) :-
ask('Is there a desirable jack pine seed source on the area ?',
Ans,[yes,no]).
question('serotinous cones',Ans) :-
ask('Do the trees on the site have serotinous cones ?',Ans,[yes,no]).
question('10/acres adequate',Ans) :-
ask('Are 10 trees per acre adequate to seed the area ?',Ans,[yes,no]).
question('burning planned',Ans) :-
ask('Has a prescribed burning been planned ?',Ans,[yes,no]).
question('two harvests wanted',Ans) :-
ask('Do you want two commercial harvests on this area ?',Ans,[yes,no]).
question('two harvests possible',Ans) :-
ask('Is it possible to get two harvests from this area ?',Ans,[yes,no]).
question('adequate seedbed',Ans) :-
ask('Is there an adequate seedbed for planting ?',Ans,[yes,no]).
question('improved stock',Ans) :-
ask('Is there an improved planting stock available ?',Ans,[yes,no]).
question('good cone supply',Ans) :-
ask('Is there a good supply of serotinous cones in the area ?',
Ans,[yes,no]).
/* Utility Routines - to be useful, we should add some routines to allow
the user to ask "How" and "Why" */
display_kb :- kb(X,Y),
print(X,' is ',Y),
nl,
fail.
display_kb.
print_advice :-
nl,nl,
print('Based upon your responses, the following is recommended :'),nl,nl,
show_advice.
show_advice :-
kb(advice,X),
print(X),
nl,
fail.
show_advice :-
nl,print('To see the complete set of derived facts,'),
print('type "display_kb."').
clear_kb :- retract(kb(_,_)),
fail .
clear_kb.
member(X,[X|_]).
member(X,[_|Y]) :- member(X,Y).
ask(Ques,Ans,LegalResponses) :-
nl,print(Ques,' '),
read(Ans),
member(Ans,LegalResponses),!.
ask(Ques,Ans,LegalResponses) :-
nl,nl,nl,
print('Please respond with : ',LegalResponses),nl,nl,
ask(Ques,Ans,LegalResponses).
Listings and Figures
printed in AI EXPERT magazine
1. Jack pine stand with minimum or higher stocking .................. 2
1. Jack pine stand with less than minimum stocking .................. 10
2. Average tree diameter less than 5 inches ..................... 3
2. Average tree diameter 5 inches or more ....................... 4
3. 2,000 or more trees per acre ..................WEED OR CLEAN ..... 8
3. Less than 2,000 trees per acre ................................... 8
4. Stand is mature .............................................. 11
4. Stand is not mature .......................................... 5
Figure 1 - Key for forest management taken from USDA Forest Service
Handbook
|-- yes ===> weed or clean
| and do # 8
|-- yes --- 2000+ per acre-|
| |-- no ===> do # 8
|-- yes -- diameter-|
| < 5 in. | |-- mature ===> do # 11
minimum | |-- no -- age-|
stocking-| |-- young ===> do # 5
|
| |-- yes ===> recommendation is maintain
|-- no -- pine ----|
needed |-- no ===> do # 11
Figure 2 - Decision tree used to represent a key.
|-- yes ===> problem system is fuel
|-- yes -- gas --|
car turns-| smell |-- no ===> problem system is mechanical
over |
|-- no ===> problem system is electrical
_______________________ |-- no => recommend
| problem | |-- yes -- spark at --| is
| system --- electrical |-- voltage | distibutor | check points
|_______________________| at battery-| |- yes => recommendation
| is find mechanic
|-- no ===> recommendation is
replace battery
Figure 3 - Decision trees breaking a problem into sub-problems.
1 4
if car turns over is yes if problem system is electrical
and gas smell is yes and voltage at battery is yes
then problem system is fuel . and spark at distributor is no
then recommendation is check points .
2
if car turns over is yes 5
and gas smell is no if problem system is electrical
then problem system is mechanical . and voltage at battery is yes
and spark at distributor is yes
3 then recommendation is find mechanic .
if car turns over is no
then problem system is electrical . 6
if problem system is electrical
and voltage at battery is no
then recommendation is replace battery .
Figure 4 - Rules to represent decision trees for auto repair.
|-- yes ===> recommendation
| USE SEED TREE
|-- yes -- burning-|
| planned |-- no ===> do # 17
|-- yes -- 10/acre -|
| adequate |-- no ===> do # 17
_____________ |-- yes -- serotinous-|
| do # | pine | cones |
| 11 -- yes |- desired-| |-- no ===> do # 17
|___________| |
|-- no ===> recommendation is CONVERT
_____________
| do # | |-- shelterwood ===> recommendation is USE NATURAL SEEDING
| 17 -- yes |-- system-|
|___________| used | |-- yes ===> recommendation is PLANT
|-- clearcut -- improved -|
stock | |-- yes ===> recommendation is
|-- good cone-| SCATTER CONES
supply |
|-- no ===> recommendation is
DIRECT SEED
Figure 5 - Breaking the decision tree into manageable pieces.
1 7
if minimum stocking is no if do # 11 is yes
and pine needed is yes and pine desired is yes
then recommendation is maintain . and serotinous cones is yes
and 10/acre adequate is no
2 then do # 17 is yes .
if minimum stocking is yes
and pine needed is no 8
then do # 11 is yes . if do # 11 is yes
and pine desired is yes
3 and serotinous cones is no
if minimum stocking is no then do # 17 is yes .
and diameter < 5 in. is no
and age is mature 9
then do # 11 is yes . if do # 17 is yes
and system used is shelterwood
4 then recommendation is use natural seeding .
if do # 11 is yes
and pine desired is no 10
then recommendation is convert . if do # 17 is yes
and system used is clearcut
5 and improved stock is yes
if do # 11 is yes then recommend is plant .
and pine desired is yes
and serotinous cones is yes 11
and 10/acre adequate is yes if do # 17 is yes
and burning planned is yes and system used is clearcut
then recommend is use seed tree . and improved stock is no
and good cone supply is yes
6 then recommend is scatter cones .
if do # 11 is yes
and pine desired is yes 12
and serotinous cones is yes if do # 17 is yes
and 10/acre adequate is yes and system used is clearcut
and burning planned is no and improved stock is no
then do # 17 is yes . and good cone supply is no
then recommend is direct seed .
Figure 6 - Rules that show the forest management problem broken
into sub-problems.
|-- yes ===> form complete |-- new ==> call customer
all info --| | use info
on form ? | New or existing --| |-- yes ==> to fill in
|-- no -- customer ? | Is missing | form
|-- existing -- info in the --|
file ? |-- no ===> call
customer
|--- < 250,000 ===> need financial statement
Amount of ---|
insurance |--- >= 250,000 ===> no financial statement needed
|-- 35+ ===> schedule physical
age of |
|--- >= 250000 --- applicant? --|-- 30 to 34 ==> fill out health form
| |
amount of | |-- < 30 ==> no medical information needed
insurance ---|
|
| |-- 55+ ===> schedule physical
|--- < 250000 -- age of |
applicant? --|-- 30 to 54 ==> fill out health form
|
|-- < 30 ==> no medical information needed
Figure 7 - Decision trees showing a knowledge base to help complete insurance
application forms.
1
if info complete is no
and new customer is yes
then display "Call the customer for the needed information."
and form complete is yes .
2
if amount > 25000
then display "Send the customer a copy of financial form #432."
and financial checked is yes .
3
if amount >= 25000
and age > 30
and age < 35
then display "Send applicant a statement of physical health form #67."
and medical info is yes .
4
if form complete is yes
and financial checked is yes
and medical info is yes
then process application is done .
Figure 8 - Rules which show how separate decision trees can be chained
together using "control attributes" and a control rule.
les which show how separat