Copy Link
Add to Bookmark
Report
AIList Digest Volume 5 Issue 019
AIList Digest Wednesday, 28 Jan 1987 Volume 5 : Issue 19
Today's Topics:
AI Expert Magazine Sources (Part 2 of 22)
----------------------------------------------------------------------
Date: 19 Jan 87 03:36:40 GMT
From: imagen!turner@ucbvax.Berkeley.EDU (D'arc Angel)
Subject: AI Expert Magazine Sources (Part 2 of 22)
X
X/* The rules -
X These are implemented this way to mimic the MicroExpert rule set.
X Looking at them side by side should show the similarities. */
X
Xfact(branch8,yes) :- fact('stocking good',yes),
X fact('avg < 5',yes),
X fact('2000+ per acre',yes),
X recommend('The stand of jack pine must be weeded and cleaned.').
Xfact(branch8,yes) :- fact('stocking good',yes),
X fact('avg < 5',yes),
X fact('2000+ per acre',no).
Xfact(branch9,no) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,mature),
X assertz(fact(branch11,yes)).
Xfact(branch11,yes) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,mature),
X assertz(fact(branch9,no)).
Xfact(branch9,yes) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,immature),
X fact('site index > 60',yes),
X fact('product size',large),
fact('120+ basal area',yes),
X recommend('It is important to thin the area').
Xfact(branch9,yes) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,immature),
X fact('site index > 60',yes),
X fact('product size',large),
X fact('120+ basal area',no).
Xfact(branch9,yes) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,immature),
X fact('site index > 60',yes),
X fact('product size',large).
Xfact(branch9,yes) :- fact('stocking good',yes),
X fact('avg < 5',no),
X fact(age,immature),
X fact('site index > 60',yes).
Xrecommendation(maintain) :-
X fact('stocking good',no),
X fact('other resources',yes),
X recommend('You should maintain the stand in its present condition').
Xfact(branch11,yes) :- fact('stocking good',no),
X fact('other resources',no).
Xfact(branch9,yes) :- fact(branch8,yes),
X fact('severe competition',yes),
X recommend('Competing trees should be eliminated.').
Xfact(branch9,yes) :- fact(branch8,yes),
X fact('severe competition',no).
Xrecommendation(control) :-
X fact(branch9,yes),
X fact('high risk',yes),
X recommend('The current area should be controlled, if at all feasible.').
Xrecommendation(wait) :-
X fact(branch9,yes),
X fact('high risk',no),
X recommend('You should wait before doing anything else to this stand.').
Xrecommendation('use seed tree') :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',yes),
X fact('10/acres adequate',yes),
X fact('burning planned',yes),
X recommend('You should use seed trees to seed the area.').
Xfact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',yes),
X fact('10/acres adequate',yes),
X fact('burning planned',no),
X add_fact(silvaculture,clearcut),
X recommend('The best silvaculture method to use is clearcut.').
fact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',yes),
X fact('10/acres adequate',no),
X add_fact(silvaculture,clearcut),
X recommend('The best silvaculture method to use is clearcut.').
Xfact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',no),
X fact('two harvests wanted',yes),
X fact('two harvests possible',yes),
X add_fact(silvaculture,shelterwood),
X recommend('The best silvaculture method to use is the shlterwood method.').
Xfact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',no),
X fact('two harvests wanted',yes),
X fact('two harvests possible',no),
X add_fact(silvaculture,clearcut),
X recommend('The best silvaculture method to use is clearcut.').
Xfact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',yes),
X fact('serotinous cones',no),
X fact('two harvests wanted',no),
X add_fact(silvaculture,clearcut),
X recommend('The best silvaculture method to use is clearcut.').
Xfact(branch17,yes) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',yes),
X fact('desirable seed',no),
X add_fact(silvaculture,clearcut),
X recommend('The best silvaculture method to use is clearcut.').
Xrecommendation(convert) :-
X fact(branch11,yes),
X fact('pine desired',yes),
X fact('pine suited',no),
X recommend(
X 'You should convert the area to some more desirable kind of tree.').
Xrecommendation(convert) :-
X fact(branch11,yes),
X fact('pine desired',no),
X recommend(
X 'You should convert the area to some more desirable kind of tree.').
Xfact(branch18,yes) :-
fact(branch17,yes),
X fact('adequate seedbed',yes).
Xfact(branch18,yes) :-
X fact(branch17,yes),
X fact('adequate seedbed',no),
X recommend('The site should be prepared before planting.').
Xrecommendation('natural seeding') :-
X fact(branch18,yes),
X fact(silvaculture,shelterwood),
X recommend('The natural seeding technique should be used.').
Xrecommendation(plant) :-
X fact(branch18,yes),
X fact(silvaculture,clearcut),
X fact('improved stock',yes),
X recommend(
X 'Since there is better stock available, you can plant using that stock.').
Xrecommendation('scatter cones') :-
X fact(branch18,yes),
X fact(silvaculture,clearcut),
X fact('improved stock',no),
X fact('good cone supply',yes),
X recommend('You should scatter the serotinous cones over the area.').
Xrecommendation('direct seed') :-
X fact(branch18,yes),
X fact(silvaculture,clearcut),
X fact('improved stock',no),
X fact('good cone supply',no),
X recommend('You should directly seed the area.').
X
X/* These routines add new facts to the internal knowledge base - kb */
X
Xfact(X,Y) :- kb(X,Y),! .
Xfact(X,Y) :- not(kb(X,Anything)),
X question(X,Answer),
X assertz(kb(X,Answer)),
X Y = Answer.
X
Xadd_fact(X,Y) :- kb(X,Y),!.
Xadd_fact(X,Y) :- assertz(kb(X,Y)).
X
Xrecommend(X) :- add_fact(advice,X).
X/* Questions to ask the user */
X
Xquestion('stocking good',Ans) :-
X print('Is the stocking of the jack pine stand currently'),nl,
X print('at least minimum ? '),nl,nl,
X print('If you are unsure of how to determine stocking,'),nl,
X print('see page 4 in the Managers Handbook for Jack Pine'),
X nl,
X ask('',Ans,[ yes , no ]).
Xquestion('avg < 5',Ans) :-
X ask('Is the average diameter of the trees less than 5 inches ?',
X Ans,[yes,no]).
Xquestion('2000+ per acre',Ans) :-
X ask('Are there 2000 or more trees per acre ?',Ans,[yes,no]).
question(age,Ans) :-
X ask('Is the age of the stand mature or immature ?',
X Ans,[mature,immature]).
Xquestion('site index > 60',Ans) :-
X ask('Is the site index greater than 60 ?',Ans,[yes,no]).
Xquestion('product size',Ans) :-
X ask('Do you want to manage the timber for large or small products ?',
X Ans,[large,small]).
Xquestion('120+ basal area',Ans) :-
X ask('Is the basal area per acre at least 120 square feet ?',
X Ans,[yes,no]).
Xquestion('other resources',Ans) :-
X ask('Do you want to maintain this condition to support other resources?',
X Ans,[yes,no]).
Xquestion('severe competition',Ans) :-
X ask('Is there severe overstory competition ?',Ans,[yes,no]).
Xquestion('high risk',Ans) :-
X ask('Is there a high risk of loss or injury ?',Ans,[yes,no]).
Xquestion('pine desired',Ans) :-
X ask('Do you want to keep jack pine in this area ?',Ans,[yes,no]).
Xquestion('pine suited',Ans) :-
X ask('Is jack pine well suited to this site ?',Ans,[yes,no]).
Xquestion('desirable seed',Ans) :-
X ask('Is there a desirable jack pine seed source on the area ?',
X Ans,[yes,no]).
Xquestion('serotinous cones',Ans) :-
X ask('Do the trees on the site have serotinous cones ?',Ans,[yes,no]).
Xquestion('10/acres adequate',Ans) :-
X ask('Are 10 trees per acre adequate to seed the area ?',Ans,[yes,no]).
Xquestion('burning planned',Ans) :-
X ask('Has a prescribed burning been planned ?',Ans,[yes,no]).
Xquestion('two harvests wanted',Ans) :-
X ask('Do you want two commercial harvests on this area ?',Ans,[yes,no]).
Xquestion('two harvests possible',Ans) :-
X ask('Is it possible to get two harvests from this area ?',Ans,[yes,no]).
Xquestion('adequate seedbed',Ans) :-
X ask('Is there an adequate seedbed for planting ?',Ans,[yes,no]).
Xquestion('improved stock',Ans) :-
X ask('Is there an improved planting stock available ?',Ans,[yes,no]).
Xquestion('good cone supply',Ans) :-
X ask('Is there a good supply of serotinous cones in the area ?',
X Ans,[yes,no]).
X
X/* Utility Routines - to be useful, we should add some routines to allow
X the user to ask "How" and "Why" */
X
Xdisplay_kb :- kb(X,Y),
X print(X,' is ',Y),
X nl,
X fail.
Xdisplay_kb.
X
X
Xprint_advice :-
X nl,nl,
print('Based upon your responses, the following is recommended :'),nl,nl,
X show_advice.
Xshow_advice :-
X kb(advice,X),
X print(X),
X nl,
X fail.
Xshow_advice :-
X nl,print('To see the complete set of derived facts,'),
X print('type "display_kb."').
X
X
Xclear_kb :- retract(kb(_,_)),
X fail .
Xclear_kb.
X
Xmember(X,[X|_]).
Xmember(X,[_|Y]) :- member(X,Y).
X
Xask(Ques,Ans,LegalResponses) :-
X nl,print(Ques,' '),
X read(Ans),
X member(Ans,LegalResponses),!.
Xask(Ques,Ans,LegalResponses) :-
X nl,nl,nl,
X print('Please respond with : ',LegalResponses),nl,nl,
X ask(Ques,Ans,LegalResponses).
X
X
X
X
X
X
X
X Listings and Figures
X printed in AI EXPERT magazine
X
X
X1. Jack pine stand with minimum or higher stocking .................. 2
X1. Jack pine stand with less than minimum stocking .................. 10
X
X 2. Average tree diameter less than 5 inches ..................... 3
X 2. Average tree diameter 5 inches or more ....................... 4
X
X3. 2,000 or more trees per acre ..................WEED OR CLEAN ..... 8
X3. Less than 2,000 trees per acre ................................... 8
X
X 4. Stand is mature .............................................. 11
X 4. Stand is not mature .......................................... 5
X
XFigure 1 - Key for forest management taken from USDA Forest Service
X Handbook
X
X
X
X |-- yes ===> weed or clean
X | and do # 8
X |-- yes --- 2000+ per acre-|
X | |-- no ===> do # 8
X |-- yes -- diameter-|
X | < 5 in. | |-- mature ===> do # 11
Xminimum | |-- no -- age-|
Xstocking-| |-- young ===> do # 5
X |
X |
echo shar: "a missing newline was added to 'AIAPP.JAN'"
echo shar: "18 control characters may be missing from 'AIAPP.JAN'"
SHAR_EOF
if test 29884 -ne "`wc -c < 'AIAPP.JAN'`"
then
echo shar: "error transmitting 'AIAPP.JAN'"
'(should have been 29884 characters)'
fi
fi
echo shar: "extracting 'CONTNT.JAN'" '(2351 characters)'
if test -f 'CONTNT.JAN'
then
echo shar: "will not over-write existing file 'CONTNT.JAN'"
else
sed 's/^X//' << \SHAR_EOF > 'CONTNT.JAN'
X
X Contents -- AI EXPERT
X January 1987
X
X
XARTICLES
X--------
X
XPlanning with TWEAK
Xby Jonathan Amsterdam
X
XLike all exploratory work in the sciences, AI research proceeds
Xin cycles of 'scruffy' exploration and 'neat' consolidation.
XAfter years of exploration into different planning algorithm
Xdesign strategies, M.I.T.'s David Chapman may have created a new
Xera in planning research with his neat summary of more than a
Xdecade of scruffy work on an algorithm called TWEAK.
X
X
XRete Match Algorithm
Xby Charles L. Forgy and Susan Shepard
X
XThe Rete Match algorithm is a fast method for comparing a set of
Xpatterns to a set of objects to determine all possible matches.
XIt may be the most efficient algorithm for performing the match
Xoperation on single processor. Developed by Charles L. Forgy in
X1974, it has been implemented in several languages in both
Xresearch and commercial grade systems.
X
X
XImperative Pattern Matching in OPS5
Xby Dan Neiman
X
XSurely the Rete Match algorithm is an efficient data structure
Xfor implementing production systems. But what else can it be
Xused for? Let's look at the OPS5 language as a case study of
Xthe Rete net as an experimental tool kit. Then we'll present a
Xtechnique that will show the programmer how to use Rete Match as
Xa general purpose pattern matching tool.
X
X
XPerceptrons and Neural Nets
Xby Peter Reece
X
XThere are at least ten billion neurons handling over one million
Xinput messages per second in the human brain. With many of the
Xearlier hardware and software obstacles now overcome, let's look
Xback to one of the most successful pattern classification
Xcomputers---the Perceptron---and show how you can implement a
Xsimple Perceptron on your home computer.
X
X
XDEPARTMENTS
X-----------
X
XBrain Waves
X"AI for Competitive Advantage"
Xby Eugene Wang, Gold Hill Computers
X
XAI INSIDER
X
XEXPERT'S TOOLBOX
X"Using Smalltalk to Implement Frames"
Xby Marc Rettig
X
XAI APPRENTICE
X"Creating Expert Systems from Examples"
Xby Beverly and Bill Thompson
X
XIN PRACTICE
X"Air Traffic Control: A Challenge for AI"
Xby Nicholas Findler
X
XHARDWARE REVIEW
X"A LISP Machine Profile: Symbolics 3650"
Xby Douglas Schuler, et. al.
X
XSOFTWARE REVIEW
X"Expertelligence's PROLOG for the Mac:
XExperPROLOG II"
X
X
echo shar: "a missing newline was added to 'CONTNT.JAN'"
echo shar: "159 control characters may be missing from 'CONTNT.JAN'"
SHAR_EOF
if test 2351 -ne "`wc -c < 'CONTNT.JAN'`"
then
echo shar: "error transmitting 'CONTNT.JAN'"
'(should have been 2351 characters)'
fi
fi
echo shar: "extracting 'EXPERT.JAN'" '(7019 characters)'
if test -f 'EXPERT.JAN'
then
echo shar: "will not over-write existing file 'EXPERT.JAN'"
else
sed 's/^X//' << \SHAR_EOF > 'EXPERT.JAN'
X
X Expert's Toolbox
X January 1987
X "Using Smalltalk to Implement Frames"
X by Marc Rettig
X
X
X
XListing 1
X
XDEFINITION OF CLASS SLOT
X
XDictionary variableSubclass: #Slot
X instanceVariableNames: ''
X classVariableNames: ''
X poolDictionaries: ''
X
XMETHODS FOR CLASS SLOT
X
XsetFacet:facetName with:aValue
X self at:facetName put:aValue
X ^aValue
X
XgetFacet: facetName
X ^self at:facetName ifAbsent:[nil]
X
XsetValue:aValue
X self setFacet:'value' with:aValue
X
XgetValue
X ^self getFacet:'value'
X
X_________________________________________
XDEFINITION OF CLASS FRAME
X
XDictionary variableSubclass: #Frame
X instanceVariableNames: ''
X classVariableNames: ''
X poolDictionaries: ''
X
XMETHODS FOR CLASS FRAME
X
XsetSlot:slotName facet:facetName contents:aValue
X | tempSlot |
X tempSlot := self at:slotName
X ifAbsent:[self at:slotName put: Slot new].
X tempSlot setFacet:facetName with:aValue.
X ^aValue
X
XgetSlot:slotName facet:facetName
X ^(self includesKey:slotName)
X ifTrue: [(self at:slotName) getFacet:facetName]
X ifFalse:[nil]
X
XsetSlot:slotName value:aValue
X ^self setSlot:slotName facet:'value' contents:aValue
XgetSlotValue:slotName
X "Get the value facet of a slot. If no such slot, look up the AKO
X inheritance chain. It that's no good, run a demon to get the value."
X | temp |
X ((temp := self getSlot:slotName) isNil)
X ifTrue: [((temp := self lookUpAkoChain:slotName) isNil)
X ifTrue: [^self runDemonForValue:slotName]
X ifFalse:[^temp getValue]]
X ifFalse:[(temp includesKey:'value')
X ifTrue: [^temp getValue]]
X ifFalse:[^self runDemonForValue:slotName]]
X
XgetSlot:slotName
X ^self at:slotName ifAbsent:[nil]
X
XsetSlot:slotName with:aSlot
X ^self at:slotName put:aSlot
X
XlookUpAkoChain:slotName
X "Look up the inheritance chain for a slot with the name in slotName.
X If you find it, return the Slot."
X ^(self includesKey:'AKO')
X ifTrue: [((self isAKO) includesKey:slotName)
X ifTrue: [^(self isAKO) getSlot:slotName]
X ifFalse:[^(self isAKO) lookUpAkoChain:slotName]]
X ifFalse:[nil]
X
XisAKO
X ^self getSlot:'AKO' facet:'value'
X
XisAKO:aFrame
X self setSlot:'AKO' value:aFrame
X
X____________________________________
XSOME SAMPLE METHODS FOR DEMONS
X
XaddDemon:aBlock slot:slotName type:demonType
X (#('ifNeeded' 'ifAdded' 'ifRemoved') includes:demonType)
X ifTrue: [self setSlot:slotName facet:demonType with:aBlock]
X ifFalse:[self error:'Invalid Demon Type']
X
XrunDemonForValue:slotName
X | aBlock |
X aBlock := self getSlot:slotName facet:'ifNeeded'.
X (aBlock isNil)
X ifTrue: [^nil]
X ifFalse:[^self setSlot:slotName value:(aBlock value)]
X
X
X
XListing 2
X
XA SAMPLE HIERARCHY OF FRAMES, SHOWING USE OF DEMONS
X
| mammal dog firstDog askDemon |
Xmammal := Frame new.
Xmammal setSlot:'hide' value:'hairy'.
Xmammal setSlot:'blood' value:'warm'.
X
Xdog := Frame new.
Xdog isAKO:mammal.
Xdog setSlot 'numberOfLegs' value:4.
X
X" Here is a simple if-needed demon, which will ask the
X user for a value,while suggesting a default value."
XaskDemon := [Prompter prompt:'What is this doggie''s name?
X default:'Phydeaux'].
X
XfirstDog := Frame new.
XfirstDog addDemon:askDemon slot:'name' type:'ifNeeded'.
XfirstDog isAKO:dog.
XfirstDog setSlot:'color' value:'brown'.
X
X"This message would cause the demon to be fired off..."
Xfido getSlotValue:'name'
X
X
XFRAME.CLS
X
XDictionary variableSubclass: #Frame
X instanceVariableNames: ''
X classVariableNames: ''
X poolDictionaries: '' !
X
X!Frame class methods ! !
X
X
X!Frame methods !
X
XaddDemon:aBlock slot:slotName type:demonType
X (#('ifNeeded' 'ifAdded' 'ifRemoved') includes:demonType)
X ifTrue: [self setSlot:slotName facet:demonType with:aBlock]
X ifFalse:[self error:'Invalid Demon Type']!
X
XgetSlot:slotName
X "return the slot object corresponding to slotName."
X
X ^self at: slotName ifAbsent: [nil]!
X
XgetSlot: slotName facet: facetName
X
X ^(self includesKey: slotName)
X ifTrue: [(self at:slotName) getFacet:facetName]
X ifFalse: [nil]!
X
XgetSlotValue:slotName
X "get the value facet of a slot. If no such slot, look up AKO chain.
X If that's no good, run a demon to get the value."
X
X | temp |
X ((temp := self getSlot: slotName) isNil)
X ifTrue: [((temp := self lookUpAkoChain: slotName) isNil)
X ifTrue: [^self runDemonForValue:slotName]
X ifFalse:[^temp getValue]]
X ifFalse:[(temp includesKey: 'value')
X ifTrue: [^temp getValue]
X ifFalse:[^self runDemonForValue:slotName]]!
------------------------------
End of AIList Digest
********************