home *** CD-ROM | disk | FTP | other *** search
-
-
- AI Apprentice
- by Bill Thompson and Bev Thompson
- "Creating Expert Systems from Examples"
- January 1987 AI EXPERT
-
-
-
- Figure 1.
-
- batch# part# power symptom Problem
-
- b 312 ac no power powersupply
- a 312 ac weak gear bad
- c 412 dc sparking powersupply
- d 412 ac no power wiring
- c 212 dc sparking powersupply
- c 412 ac weak wiring
- a 212 ac no power gear bad
- b 412 dc weak wiring
- b 212 ac weak gear bad
-
-
-
- Figure 2 - A decision tree produced from the data in Table 1.
-
-
- batch# part# power symptom Result
-
- b 412 ac weak gear bad
- a 212 dc weak powersupply
- d 212 dc sparking wiring
- d 412 ac no power powersupply
-
-
-
- Table 1 - A training set of data for a repair problem.
-
- If batch# is a
- then result is gear bad.
-
- If batch# is b
- and part# is 212
- then result is gear bad.
-
- If batch# is b
- and part# is 312
- then result is powersupply.
-
- If batch# is b
- and part# is 412
- then result is wiring.
-
- If batch# is c
- and power is ac
- then result is wiring.
-
- If batch# is c
- and power is dc
- then result is powersupply.
-
- If batch# is d
- then result is wiring.
-
-
- batch# ?
- a: ---------------------------------------------gear bad
- b:part# ?
- 212: ---------------------------------------- gear bad
- 312: ---------------------------------------- powersupply
- 412: ---------------------------------------- wiring
- c:power??
- ac: ----------------------------------------- wiring
- dc: ----------------------------------------- powersupply
- d: --------------------------------------------- wiring
-
-
-
- Table 2 - A new set of data collected for the repair problem. This data
- is used for validation of the solution.
-
-
- clinical descript distribution group Result
-
- fever upper resp. epidemic respiratory parainfluenza
- chills lower resp. local enteric adenovirus
- rash mid resp. children exanthems mumps
- swelling hospital latent rhinovirus
- malaise youngadults echo
- headache universal coxasackie
- cough varicella
-
-
- rubella
-
- Table 3 - Definitions of results and attributes for identifying viruses.
-
- level type of subject programming cover type basic Author
- software matter covered language
- intro/adv gen/spec gen/spec no/yes soft/hard no/yes
- 1. 1. 4. 3. soft 5. Jones
- 2. 5. 5. 4. soft 1. Smith
- 1. 1. 1. 3. soft 1. Fisher
- 1. 1. 1. 3. hard 5. Mitchell
- 1. 1. 1. 1. soft 1. Argyle
- 5. 1. 5. 5. hard 1. Chang
-
-
-
- Table 4 - An example set for selecting a textbook. This set was produced
- using the Flexigrid program.
-
- subject matter ? (gen/spec)
- < 2.50: programming covered ? (no/yes)
- < 2.00: ---------------------------------- Concepts
- >=2.00: cover ?
- hard: -------------------------- Today's
- soft: -------------------------- Information
- >=2.50: level ? (intro/adv)
- < 1.50: -------------------------------- Society
- >=1.50: level ? (intro/adv)
- < 3.50: ------------------------ Applications
- >=3.50: ------------------------ Data_structures
-
-
- upply 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
- |
- |