Upload
yves
View
19
Download
0
Embed Size (px)
DESCRIPTION
CO3301 - Games Development 2 Week 19 Production Systems. Gareth Bellaby. Next week. Acceptance check for Project CVs. Prepare a CV or bring along a previous one. Jobs. Knowledge Representation. There are a variety of knowledge representation methods. - PowerPoint PPT Presentation
Citation preview
1
CO3301 - Games Development 2Week 19
Production Systems
CO3301 - Games Development 2Week 19
Production Systems
Gareth BellabyGareth Bellaby
2
Next weekNext week
• Acceptance check for Project
• CVs. Prepare a CV or bring along a previous one.
• Jobs.
3
Knowledge RepresentationKnowledge Representation
There are a variety of knowledge representation methods.
Most AI is based on symbol manipulation, i.e. a set of symbols with a set of procedures for operating on them.
Knowledge is representation and the methods for manipulating it.
4
Knowledge RepresentationKnowledge Representation
• A set of facts can be represented in a database. However, a database has very low inferential capabilities. It might be possible to use an inference engine (cf. Data Mining).
• Database: static, flat, homogenous, passive.
• Knowledge Base: flexible, layered, heterogeneous, active. This is what is used in an expert system.
5
Procedural KnowledgeProcedural Knowledge
Procedural knowledge is operational, i.e. what to do when.
Could be directly coded, but such an approach has low inferential adequacy and low acquisitional adequacy.
Most common method is production rules.
6
Production RulesProduction Rules
IF a person has a risk of heart attack
AND a person has had a previous heart attack
THEN give digitalis
New knowledge is derived using various reasoning mechanisms.
7
Rule-based systemRule-based system
1. If ?x has hair
then ?x is a mammal
2. If ?x is a mammal
and ?x chews cud
then ?x is an goat
3. If ?x is a mammal
and ?x long neck
then ?x is an giraffe
8
Example & ExercisesExample & Exercises
Gordon has hair and a long neck.
Michael has hair.
Graham is a mammal and chews cud.
Thomas has a long neck.
9
InferenceInference
Deduction is the process of reasoning from premises to conclusions.
A deductive argument can only bring out what is already implicit in its premises.
However, it can also give rise to questions. Questions are requests about facts for which we currently have no data.
10
Forward and Backward Forward and Backward ChainingChaining
Reasoning carried out by a interpreter.
Two methods:
• forward chaining from assertions
• backward chaining from hypotheses
Rule-based system is a deduction system.
11
Forward ChainingForward Chaining
Gordon has hair => Gordon is a mammal
Gordon has a long neck
we already know that Gordon is a mammal
the animal is a mammal and the animal has a long neck => Gordon is giraffe
12
Backward ChainingBackward Chaining
Gertrude has long neck.
Look for the gaps in our knowledge.
Giraffes have a long neck and are mammals. Gertrude may be a giraffe.
Is Gertrude a mammal?
Mammals have hair. We need to find out if Gertrude has hair.
13
Rule Based SystemsRule Based Systems
AI Interface Standards Committee, 2005 AIISC Report
http://www.igda.org/ai/report-2005/rbs.html
14
Age of Empires IIIAge of Empires IIIrule startFishing
inactive
group tcComplete
mininterval 15
{
bool givenFishingBoats = false;
if ( (kbUnitCount(cMyID, cUnitTypeFishingBoat, cUnitStateAlive) > 0) && (gWaterExploreMaintain < 0) && (gFishingPlan < 0) )
givenFishingBoats = true; // I have fishing boats, but no fishing or water
// scout plans, so they must have been given to me.
if (givenFishingBoats == false) // Skip these early-outs if we were granted free // boats.
{
if ( (kbGetCiv() == cCivDutch) && (kbUnitCount(cMyID, cUnitTypeBank, cUnitStateABQ) < 1) )
return; // Don't burn wood before we have a bank
15
Rule Based Systems and Rule Based Systems and FSMsFSMs
• Obviously some similarity between the two.
• If you have a situation in which all of the states can lead to all of the other states then a rule-based system is more useful than an FSM.
16
Reasoning and inferenceReasoning and inference
It's possible to store knowledge in such a way that the structure allows reasoning to occur.
The structure used to store the knowledge allow the derivation of new facts from those facts which are explicitly stored.
The mechanism for deriving information depends on the structure.
17
Structure of Production Structure of Production RulesRules
The order of the production rules is the primary way of structuring production rules.
Sequential logic.
The rules are examined in order. Later rules may therefore be ignored.
18
Semantic NetsSemantic Nets
Semantic = "meaning"
A semantic net is a set of nodes (usually items you want to represent knowledge about) connected by a set of links. The links are labelled and represent relations between the nodes.
19
Human StudiesHuman Studies
Derived from human studies (Collins and Quillian, 1969).
People appear to store information at the most abstract level. They don't remember that canaries fly, robins fly, swallows fly, etc. Instead they remember that birds (in general) fly, and that canaries, robins and swallows are all types of birds.
20
Human Response TimesHuman Response Times
Evidence is the difference in response time to questions. Subjects took longer to answer "Can a canary fly?" than "Can a canary sing?". Singing is a specific property of (or closely associated with) canaries, whilst flying is a general property of being a bird.
21
A Semantic Net ExampleA Semantic Net Example
animal
bird
canary
fly
can
wings
sing
has
isa
isa
can
22
Frames (slot and filler Frames (slot and filler structure)structure)
Formally equivalent to semantic nets. A collection of semantic net nodes and slots that together describe an object, act or event.
23
FrameFramess
• frame is a list
• slot is an attribute A frame is a list of attributes (slots) and associated values that describe some entity in the world.Slots can be values, constraints or procedures. Some Advantages:
• fairly detailed
• inheritance links give a form of default reasoning
24
Frames exampleFrames example
FRAME: bird
a_kind_of: animal
moving_method: fly
active_at: daylight
FRAME: albatross
a_kind_of: bird
colour: black_and_white
size: 115
FRAME: bird
a_kind_of: animal
moving_method: fly
active_at: daylight
FRAME: albatross
a_kind_of: bird
colour: black_and_white
size: 115
25
Rule-based systemRule-based system
• One use of production rules is in expert systems. An expert system is a specialized problem solving program designed to work in a single area of human expertise.
• Typically use a production system.
• Geological analysis, for instance for mining and drilling, e.g. PROSPECTOR.
• Medical diagnosis, e.g. MYCIN.
26
A MYCIN RuleA MYCIN Rule
If
1. the infection is primary-bacteraemia, and
2. the site of the culture is a sterile site, and
3. the suspected portal of entry of the organism is the gastro-intestinal tract,
then there is suggestive evidence (0.7) that the identity of the organism is bactericides
If
1. the infection is primary-bacteraemia, and
2. the site of the culture is a sterile site, and
3. the suspected portal of entry of the organism is the gastro-intestinal tract,
then there is suggestive evidence (0.7) that the identity of the organism is bactericides
27
Expert SystemExpert Systemss
Expert systems include:
• Rule base or Knowledge base: using production rules (the knowledge base). A rule links conditions to outcomes or actions. Stores the rules, cases, relationships, etc.
• Working memory.
• Inference engine (the interpreter). Runs the production rules, checks to see if rule applies, e.g. decisions about which rule to fire, or places in the firing of rules into ranked order.
An expert system shell is an inference engine with an empty knowledge base, e.g. Leonardo.
28
Working memoryWorking memory
• Current state of the system.
• Contents of the working memory are compared to the rules.
• If a rule matches the working memory then the rule triggers.
• More than one rule could match the contents of working memory.
29
Knowledge AcquisitionKnowledge Acquisition
• Knowledge is acquired from experts, typically through interviews, observation of problem analysis.
• Research still underway into formal methods for knowledge acquisition.
• Research still underway in to machine learning, e.g. rule induction or learn by example.
• Less useful for games since direct querying of an expert less required.
• Difficulties of setting up the expertise for a computer game.
30
Developing An Expert Developing An Expert SystemSystem
The single most difficult task is interviewing the expert:
• differences in language between expert and researcher
• differences in intention between expert and researcher
• have to convert experience and expertise into facts and rules
31
StructuresStructures
Rules can be set out as a tree.
Expert systems typically use backwards chaining with opportunistic forwards chaining.
32
ReferencesReferences• Any AI book, e.g. Russell & Norvig.
• AI Interface Standards Committee, 2005 AIISC Report
http://www.igda.org/ai/report-2005/rbs.html
• Rabin , "Promising Game AI Techniques", AI Game Programming Wisdom 2, 2003.
• "Practical Logic-Based Planning" , Daniel Wilhelm, AI Game Programming Wisdom 4, 2008.
• A Simple Inference Engine for a Rule-Based Architecture, Mike Christian, AI Game Programming Wisdom, 2002.
• A Rule-Based Architecture using Dempster-Shafer Theory, François Dominic Laramée, AI Game Programming Wisdom, 2002.