Title: Artificial Intelligence Programming Atsushi Inoue
1Artificial Intelligence ProgrammingAtsushi Inoue
2Objectives
- Start with what you learned in Data Structures.
- Objective 1 Identify the structures of programs
developed in Artificial Intelligence. - Objective 2 Identify advantages of using
programming languages primarily developed for
Artificial Intelligence (comparing to OOPL, Imp.
Lang.) - Functional Programming Language (Scheme)
- Logic Programming Language (FRIL)
3Problem-Solving for AI
- General problem-solving framework for computer
science data structure algorithm program - AI configuration solver
Framework Configuration Solver State Space
Search Graph/Network Search Algorithms GA Gen
e GA/GP/EC NN Network Signal
Propagations KBS Cases/Rules Reasoning/Learni
ng
4List, Tree and Graph
- Problems are configured within networks, gene,
cases, and rules for appropriate solvers. - How are they represented within programs?
- Networks, strings (gene), tuples (cases),
predicates/propositions (rules) are generated
within lisp processing frameworks (array,
linked-list). - How solvers solve problems?
- Traverse such lists. (various searching
algorithms) - Find and/or generate solutions.
5It is like a maze, isn't it?
Maze can be represented as a graph (network) and
can be solved as network search.
6Backtracking
While treasures are NOT found OR give them up,
keep searching!!
Bounded (dead end) Backtrack!!
7Example sum of subset
- S a set of integers
- Problem find a subset of S whose sum is X.
- Approach Backtracking
- Keep taking numbers until the sum gt X.
- Throw the last number if the sum gt X.
- Keep going until a subset whose sum X(or all
subsets have been searched). - Bounded condition the sum gt X
8Implementation of Backtracking
- Representation
- Note an integer
- Path a sum
- Graph Search Bounded Condition
- Consider DFS Bounded Condition
- Q what if BFS instead?Any difference?
9Other Examples
- Classroom assignments
- Course teaching schedules
- GANT/PART/CPM
- Solving puzzles
- Making travel itinerary
- Navigating a good route to a destination(Navigati
on systems) - ...... many others
10Functional Programming
11What is Functional Programming?
- List Functions Program
- Originated with LISP by J. McCarthy in 1958
- Storage management garbage collection (GC)
- Intended to be First-class functions
- Functions can be retrieved and stored as values
- Functions can be passed as arguments
- Functions can be returned as the result
- Languages LISP, Scheme, ML
12Scheme
- MIT Scheme
- http//www.swiss.ai.mit.edu/projects/scheme/
- Simple about 50 US-letter pages of specification
(R5RS Revised 5 Report on the Algorithmic
Language Scheme) - Complete smallest ambiguities among
implementations for different platforms - Rich Lib. Window management, RDB, OOP.,
Networks, etc. - EWU CS
- http//penguin.ewu.edu/class/ai/modules/tool2/
13Comparison
14Scope of Variables
Global x 1
Global x 1
Func2 use x
Func1 para x call Func2
Func2 use x
Func1 para x call Func2 use x
15First-Class Function
passed as an argument
returned and stored as a value
(define func (gen-func )) gt func (func 6 2)
gt 12?
16Cons Cell List Processing
Pointing to a symbol or another cons cell
17Higher Order Function Mapping
f
Domain
Range
18Stream-Oriented Computing
Consider a sequence with a recurrent
relation e.g. fibonacci fibi fibi-1 fibi-2
where i gt 2 0 1 1 2 3 5 8 13 21 34 55 (stream
of Fibonacci)
0
1
55
19(No Transcript)
20Object-Oriented Programming
21(No Transcript)
22(No Transcript)
23(No Transcript)
24Logic Programming
25Logic
- Mathematics, Philosophy, ...We are interested in
how computers can handle logic. - Reviewing discrete math., we know
- Propositional logic
- Predicate logic
- Proof as a chain of inference rules deduction
() - How about others such as induction, proof by
contradiction, .... Do you remember?
26Proposition Predicate
- Proposition a, b, .... (no arguments, i.e.
independent variables) - Predicate human(X) parent(X, Y) for all X,
there exists Y - Quantification of variables existential (there
exists), universal (for all) - Inference process for predicate logic
- Propositionalization substitute all variables
in predicates --gt propositions - Universal instantiation substitute universally
quantified variables - Exsistential instantiation (Skolemization)
substitute existentially quantified variables - Unification process of finding satisfiable
substitutions - Resolution obtain shorter, more specific clause
from known multiple clauses - First-Order Logic (FOL) quantified variables
appear ONLY in arguments of predicates. (whereas
higher-order logic quantifies predicates
themselves)
27Inference Rules
- Modus Ponens a, a -gt b b
- Modus Tollence not b, a -gt b not a
- And Introduction a, b a b
- And Elimination ab a, b
- Generalized Modus Ponens (Modus Ponens
Unification) in FOL - Lifting opposite from propositionalization Pro
positional logic to predicate logic, in many
cases, FOL - Many more (mostly composite) inference rules
28Aspects of Process
- Syllogism a path to consequence drawn by
inference rules from what are known (chain of
resolutions). - A B C ..... (A, B, C are sets of logical
exp.) - Proof Search (i.e. infer/reason) a path (i.e.
syllogism) from what are known to (desired)
consequence by constructing syllogisms consisting
of inference rules (resolution, unification,
etc.) - How can we automate such process?
29Backtracking Approach
- Consider syllogisms as paths within a network.
- We perform network search for a proof, i.e a
search for a syllogism (path). - We use 'inference rules' (a resolution) for each
transformation (i.e. a link) - Such ideas are called automated theorem proof and
automated reasoning
30Computational Logic
- Study on Logic represented and processed
(reasoning/inference) on computer systems. - Proof as network search problems
- Computational complexity? may be intractable!!
- So, we know that automated theorem proof is hard,
BUT we can still utilize such study for many
purposes (e.g. expert systems, intelligent
controls, logic programming)
31Logic Programming
- Programs are written in logic
- Logic (Program) Control (Query Process)
Algorithm - Language PROLOG, FRIL, and many others....
- Subset of computational logic featuring
- Unit resolution resolve one literal (predicate)
in a query (a collection of literals/predicates)
at a time. - Limit of clauses in the form of C if AB...I...
(Horn Clause HC) makes the unit resolution
'complete' (i.e. Finite steps in proof can be
found if it can be proven.) - Such specification makes processes tractable, but
STILL as expressive as FOL
32Why Logic Programming?
- Why is it advantageous?
- Partial answers
- Powerful representation high abstraction
- Simple and natural syntax (i.e. logic!!)
- Small programs (high readability, easy
maintenance, easy optimization) the same sense
as SQL - And more .....
- Are they widely used? Not as programming
language, but as a foundation of KBS, DB Query,
PS, etc.
33FRIL
- Fuzzy Relational Inference Language
- Logic Programming Language with
- Features of PROLOG
- Support Logic Programming (probability intervals)
- Fuzzy Sets within SLP (mass assignment theory)
- Evidential Logic Programming (weight aggregation)
- S-expression efficient notation (like
LISP/Scheme) - EWU CS
- http//penguin.ewu.edu/class/ai/modules/tool1/
- http//penguin.ewu.edu/class/ai/modules/aim16/fril
src/suppquery.frl
34How Logic Programming Works
- Program a collection of HC's (declarative)
- Facts in HC with empty hypotheses
- Implications in HC with hypotheses
- Execution
- Query a list of predicates
- Query Processing Backtracking (DFSBounded
Cond.) - While predicates in the query are NOT satisfied
OR no more alternatives to satisfy them keep
searching the fact or the satisfaction
of subquery (recursion) - Bounded Cond. if subquery failed (backtracking
alternatives)
35Very Simple (Meaningless) Example
- Knowledge Base (what we know)
- A lt- B C D
- B (lt- (empty))
- C lt- E F, C lt- H
- D lt- G
- E, F, G, H
- Query (what is asked)
- ?A (is A true?)
36Query Processing
A lt- B C D
DFS top to bottom left to right
D lt- G
C lt- E F
FRIL Code (one clause per line index) a1
((a)(b)(c)(d)) A lt- B C D b1 ((b)) c1
((c)(e)(f)) C lt- E F c2 ((c)(h)) C lt-
H d1 ((d)(g)) D lt- G e1 ((e)) f1
((f)) g1 ((g)) h1 ((h))
FRIL Query ?((a)) yes tq((a)) trace
37Starting Fril Trace - header gives (Clause-name
Index Nth-goal-in-body Depth) (top-level 1
0) (a) trace ?y (a 1 1 1) (b) trace
?y (a 1 1 1) SOLVED (b) (a 1 2 1) (c)
trace ?y (c 1 1 2) (e) trace ?y (c 1 1 2)
SOLVED (e) (c 1 2 2) (f) trace ?y (c 1 2
2) SOLVED (f) (a 1 2 1) SOLVED (c) (a 1 3 1)
(d) trace ?y (d 1 1 2) (g) trace
?y (d 1 1 2) SOLVED (g) (a 1 3 1) SOLVED
(d) (top-level 1 0) SOLVED (a)
A1 A lt- B C D
C1 C lt- E F
D1 D lt- G
(top,,1, 0)
Depth 0
(a,1,3,1)
(a,1,1,1)
(a,1,2,1)
Depth 1
(c,1,2,2)
(d,1,1,2)
(c,1,1,2)
Depth 2
38Append Hypotheses and Query
- ?a alt-bcd
- ?bcd b
- ?cd clt-ef
- ?efd e
- ?fd f
- ?d dlt-g
- ?g g
- ?ltemptygt yes
39What if C1 fails but C2 succeeds?
A lt- B C D
DFS top to bottom left to right
D lt- G
C lt- E F
FRIL Code (one clause per line) a1
((a)(b)(c)(d)) A lt- B C D b1 ((b)) c1
((c)(e)(f)) C lt- E F c2 ((c)(h)) C lt-
H d1 ((d)(g)) D lt- G e1 ((e)) f1
((f)) g1 ((g)) h1 ((h))
FRIL Query ?((a)) tq((a)) trace
40Starting Fril Trace - header gives (Clause-name
Index Nth-goal-in-body Depth) (top-level 1 0)
(a) trace ?y (a 1 1 1) (b) trace
?y (a 1 1 1) SOLVED (b) (a 1 2 1) (c)
trace ?y (c 1 1 2) (e) (c 1 1 2) FAILED
(e) - no definition for e (c 2 1 2) (h)
trace ?y (c 2 1 2) SOLVED (h) (a 1 2 1) SOLVED
(c) (a 1 3 1) (d) trace ?y (d 1 1 2)
(g) trace ?y (d 1 1 2) SOLVED (g) (a 1 3
1) SOLVED (d) (top-level 1 0) SOLVED (a)
(top,,1, 0)
Depth 0
(a,1,3,1)
(a,1,1,1)
(a,1,2,1)
Depth 1
Backtrack
(c,2,1,2)
(c,1,1,2)
(d,1,1,2)
Depth 2
FAILED
41Append Hypotheses and Query
- ?a alt-bcd
- ?bcd b
- ?cd clt-ef
- ?efd ltfailedgt because no e ? backtrack!!
- ?cd clt-h
- ?hd h
- ?d dlt-g
- ?g g
- ?ltemptygt yes
42What if both are satisfied?
- Suppose there are two options C1 and C2.
- Both satisfy the (sub)query ?((c))
- Why C1 is picked instead of C2?
- Answer order of clauses (i.e. C1 is defined
prior to C2) - Is there an option to perform a query for all
possible solutions? The answer is YES!!
43Universal Query
- ?((a)(fail)) is 'a' true the query fails?
- Response no of course not, because this query
succeeds as we know. How is it processed? - tq((a)(fail)) we trace this query.
- In summary, the predicate (fail) 'negation as
failure'. The goal is never satisfied and thus
causes for FRIL to backtrack. - How useful is this? Quite useful but not now.
44Starting Fril Trace - header gives (Clause-name
Index Nth-goal-in-body Depth) (top-level 1 0)
(a) trace ?y ..... (c 1 1 2) (e)
trace ?y (c 1 1 2) SOLVED (e) ..... (top-level
1 0) SOLVED (a) (top-level 2 0)
(fail) (top-level 2 0) FAILED (fail) (d 1 1 2)
FAILED (g) (a 1 3 1) FAILED (d) (c 1 2 2) FAILED
(f) (c 1 1 2) FAILED (e) (c 2 1 2) (h)
trace ?y (c 2 1 2) SOLVED (h) ..... (top-level
1 0) SOLVED (a) (top-level 2 0)
(fail) (top-level 2 0) FAILED (fail) (d 1 1 2)
FAILED (g) (a 1 3 1) FAILED (d) (c 2 1 2) FAILED
(h) (a 1 2 1) FAILED (c) (a 1 1 1) FAILED
(b) (top-level 1 0) FAILED (a)
Proof with C1
Backtrack by (fail)
Proof with C2
Backtrack by (fail)
No more alternatives
45I thought FRIL looks more complex...
- Mainly because of arguments in predicates.
- Arguments constants variables.
- How are they handled in logic programming?
- Unification substitutions of variables with
corresponding values/variables. - List processing same principle as functional
programming languages(notation (HT) for FRIL,
HT for PROLOG)
46List Processing
(1 2 3 4)
Text
(HT)
Diagram
T
1
H
2
3
4
PROLOG
47FRIL Sum of Subset
((subsum () 0 ())) ((subsum (NL) SUM
(NSUBSUM)) (subsum L SUML
SUBSUM)(sum N SUML SUM)) ((subsum (NL) SUM
SUBSUM) (subsum L SUM
SUBSUM)) Fril gt?((subsum (1 2 2 4 5) 9 L)(pp
L)) (1 2 2 4) yes Fril gt?((subsum (1 2 2 4 5) 9
L)(pp L)(fail)) (1 2 2 4) (2 2 5) (4 5) no
48Starting Fril Trace .... (top-level 1 0)
(subsum (1 1 3) 4 _7) trace ?y (subsum 2 1
1) (subsum (1 3) _121 _120) trace
?y (subsum 2 1 2) (subsum (3) _204 _203)
trace ?y (subsum 2 1 3) (subsum () _2e7
_2e6) trace ?y (subsum 2 1 3) SOLVED (subsum () 0
()) (subsum 2 2 3) (sum 3 0 _204) (subsum
2 2 3) SOLVED (sum 3 0 3) (subsum 2 1 2) SOLVED
(subsum (3) 3 (3)) (subsum 2 2 2) (sum 1 3
_121) (subsum 2 2 2) SOLVED (sum 1 3 4) (subsum 2
1 1) SOLVED (subsum (1 3) 4 (1 3)) ...........
.............. (subsum 2 1 1) SOLVED (subsum (1
3) 3 (3)) (subsum 2 2 1) (sum 1 3
4) (subsum 2 2 1) SOLVED (sum 1 3 4) (top-level
1 0) SOLVED (subsum (1 1 3) 4 (1
3)) .........................
Unification
Unification
49Extension of Logic Programming
50Logic Programming with Probability
- Form of HC probability as a foundation of
uncertainty management - Example
- ((a))0.3 P(a)0.3
- ((b)(a))0.5 P(ba)0.5
- qs((b))((b)) (0.15 0.85) where does 0.85
come from?No more solutionsyes
51Uncertainty Management Framework
- (Point) Probability
- e.g. P(x)0.3
- AIM12 Bayesian Belief Network
- Interval of Probability
- e.g. P(x)0.1, 0.5
- Support Logic (Base of FRIL)
- AIM13 Dempster-Shafer Theory of Evidence
- Fuzzy Probability
- e.g. P(x)high where ?high(P(x)) 0,1 -gt 0,1
- AIM14 Fuzzy Logic
- AIM15 Evidential Logic (Fuzzy-Neuro)
AIM16 Mass Assignment Theory
52Extension from point to interval
- Consider intervals of probabilities more
uncertainty - Support Logic Programming extension of logic
prog. - Example
- ((a)) (0.3 0.5) P(a)0.3, 0.5
- ((b)(a)) ((0.5 0.7) (0 1)) P(ba)0.5,
0.7, P(bnot a)0, 1 (i.e. unknown) - qs((b))((b)) (0.15 0.91)No more solutionsyes
53Special Case of Support Logic Prog.(Solution to
where 0.85 came from)
- Fully specified support logic programming in
FRIL - ((a))(0.3 0.3) P(a)0.3, 0.30.3
- ((b)(a))((0.5 0.5)(0 1)) P(ba)0.5, 0.50.5
and P(bnot a)0, 1 - What if we do ... (to make SLP in FRIL Bayesian)
- ((a))0.3
- ((b)(a))((0.5 0.5)(0 0))
- qs((b)) yields ((b)) (0.15 0.15)
54General Case fuzzy predicates
- Consider predicates (propositions) with fuzzy
sets. - Example
- set(ud 0 10)
- (small 01 50 ud)
- (middle 00 51 100 ud)
- (large 50 101 ud)
- ((x is small)) (0.3 0.5)
- ((y is large)(x is middle))((0.3 0.5)(0 0))
- qs((y is X))((y3 is 50 101 )) (0 0.595)...
55Semantic Unification
- Unification of fuzzy propositions (i.e.
instantiated predicates) - Example
- X is small
- X is middle
- Application of mass assignment theory
A support (interval of probability) as the
degree of unification (i.e. Semantics are
provided in terms of fuzzy sets.
56Mass Assignment Theory
(Normal) fuzzy (sub)set
Consistency Management
Let e be an element of UD. m.s.v.(e)SUM_x, e in
x M(x) P(e)SUM_x, e in x M(x) SR(e, x) SR a
selection rule proportion of e within x (1/x
by default)
Mass Assignment is a generalization of measures
(e.g. probability and possibility membership
function of fuzzy set)
57Historical Background Uncertainty
- A long, long, ..., endless debate over souce and
status of probability numbers for centuries (Game
300BC? ... Bayes 17XX AD ... Probability and
Logic 19xx AD ...) - In 20th century, such debates became sharper so
that we have frequentists, objectivists and
subjectivists ... - Many related theories belief, unitity, entropy,
possibility, fuzzy logic, ..... - But, they are consistent with axioms of
probability you learned in MATH380/385.
58Axioms of Probability
- a.k.a. Kolmogorov's axioms provides semantics
of probabilities associated with propositions - 0 lt P(a) lt 1 for any proposition a
- P(true)1, P(false)0
- P(a OR b)P(a)P(b)-P(a AND b) for any
propositions a and b - Probability theory is built upon this simple
foundation.
59Jefferys Rule Foundation of SLP
- Consider two variables
- Hh, h
- Ee1, , en s.t. e1, , en are muturally
exclusive and exhaustive - P X -gt 0,1 (apriori probability)
- B X -gt 0,1 (belief based on experiences)
- Assume that conditional probabilities P(HE) are
known - B(h) ? e in E, P(he)B(e), B(h) ? e in E,
P(he)B(e) - B(x) and P(x) are not necessarily related.
- This can be B(x)P(x) (the case of probability)
- Base of Inference in Support Logic Programming
(SLP)
60Uncertainty Management (UM) in FRIL
- Origins
- L. A. Zadeh, D. Dubis, H. Prade (1965-80s)
Fuzzy sets, possibility theory. - G. Shafer, P. P. Shenoy (1970s-80s)
Depmster-Shafer theory of evidence. - G. Klir (1970s-80s) Generalized information
theory. - P. Smets, J. Pearl, R.C. Jeffery (1980s-90s)
Probabilities as degrees of belief, applications
of probabilities in reasoning for KBS. - B. Kosko, et. al. - Neuro-Fuzzy Computations for
KBS. - An unified framework (FRIL)
- J. F. Baldwin (1980s-present) Unified
computational framework of handling propositions
with probabilities, fuzzy logic and neural
networks within logic programming. - An extension (Perceptual Information Processing
PIP) - A. L. Ralescu A. Inoue (1997-present)
Computational framework of handling perceptions.
(my PhD dissertation application of text
categorization)
61Mechanism of UM in FRIL
Extended Unification
Propositions
Predicates
Fuzzy Propositions
Classic Logic ?((query)) / tq((query)) (Symboli
c) Unification only PROLOG
Support Logic intervals (supports) of
probabilities qs((query)) Clauses with
supports Clauses containing fuzzy propositions
with supports A predicate with sigmoid and
linear combination (i.e. computation of neural
networks evidential logic) Extended rules of
combining reasoning Dempster-Shafer
62Computation of Support Logic Programming
- Canonical form of support logic
rule((h)(f1)(fn)) ((pl pu)(nl nu))((f1))
(sl1 su1) ((fn)) (sln sun) - Semantics
- P(hf1fn)pl, pu P(h(f1fn))nl, nu
- B(fi)sli, sui where i1,,n
- Computation of complements
- P(hf1fn)1-pu,1-pl ( 1-P(hf1fn))
- P(h(f1fn))1-nu,1-nl ( 1-P(h(f1fn)))
63Computation of Support Logic Programming(cont.)
- Given the following in Knowledge Base
- ((h)(f1)(fn)) ((pl pu)(nl nu)) pl lt P(hf1
fn) lt pu nl lt P(h(f1 fn)) lt nu - ((f1)) (bl1 bu1) bl1 lt B(f1) lt bu1
-
- ((fn)) (bln bun) bln lt B(fn) lt bun
- How the following query is processed?
- qs((h)) B(h)?
- Computation
- Compute ((f1) (fn)) (bl bu) s.t. bl ? i
bli, bu ? i bui(This determines the support
pair of the hypotheses) - Compute ((h)) (hl hu) Computation of the
consequence - hl plbu nl(1-bu) if pl lt nl, hl plbl
nl(1-bl) if pl gt nl - hu publ nu(1-bl) if pu lt nu, hu pubu
nu(1-bu) if pu gt nu - Note The hypotheses ((f1)(fn)) correspond to e
from Jefferys rule
64Computation of SLP Special Cases in FRIL
- Case 1 same as qs((f1) (fn))
- ((h)(f1) (fn)) ((1 1)(0 0))
- ((fi)) (bli bui)
- qs((h)) yields ((h)) (bl bu) s.t. bl ? bli,
bu ? bui - Case 2 consistent with Kolmogorovs axioms
- ((h)(f1) (fn)) ((l u)(0 0))
- qs((h)) yields ((h)) (lbl ubu)
- Case 3 when P(hf1 fn) is NOT given (assumed
to be (0 1)) - ((h)(f1) (fn)) (l u) ((l u)(0 1))
- qs((h)) yields ((h)) (lbl ubl (1-bl))
- Case 4 upper boundary of intervals (support
pairs) is ignored. - ((h)(f1) (fn)) ((1 1)(0 1)) is assumed.
- qs((h)) yields ((h)) (bl 1)
65Computation of SLP Rule of Combination
- How to combine multiple results?
- From rule 1 ((h)(f1) (fn)) yields ((h)) (hl1
hu1) - From rule 2 ((h)(g1) (gn)) yields ((h)) (hl2
hu2) - Obtain the intersection of support
pairs(intervals of probabilities) - (hl hu) (max(hl1, hl2) min(hu1, hu2))
- Error if no intersection(i.e. inconsistencies or
contradictions on knowledge) - Alternative Dempster-Shafer Frameworks (appeared
later)
66Example 1 Bayesian Belief Network
67((Burglary))0.001 ((Earthquake))0.002 ((Alarm)
(general (((Burglary)(Earthquake)) ((Burglary)
(not Earthquake)) ((not Burglary)(Earthquake))
((not Burglary)(not Earthquake))) ((0.95)(0.9
4)(0.29)(0.001))))((1 1)(0 0)) ((JohnCalls)
(general (((Alarm)) ((not Alarm))) ((0.9)(0.0
5))))((1 1)(0 0)) ((MaryCalls)
(general (((Alarm)) ((not Alarm))) ((0.7)(0.0
1))))((1 1)(0 0)) qs((or (JohnCalls)(MaryCalls)
))
68General Support Logic
- General support logic rule
- ((h)(general (e1 en) ((el1 eu1) (eln eun))))
((1 1)(0 0))e1 (sl1 su1)..en (sln sun) - Computation optimization
- Support pair of hypotheses (el eu) i.e. ((h))
(el eu) in this case. - el MIN ? eli si and
- eu MAX ? eui si subject to
- sli lt si lt sui and
- ? si 1
- Ordinary support logic rules are special cases
consistent with above optimization.
69Example 2 Dempster-Shafer Rule of Combination
dempster fly ((fly X) (bird X)) (0.9 0.95) ((fly
X) (penguin X)) 0 ((bird X) (penguin X))
((penguin penny)) 0.4 ((bird penny)) (0.9 1)
qs((fly penny))
DSRC Switch
without
with
70Example 3 Fuzzy Pendulum Control
Fuzzy Associative Matrix (FAM) a\s P
Z N ----------------- P PB P Z Z
P Z N N Z N NB fuzzy
rules based on FAM ((move bigpos-move) (angle
pos-angle)(speed pos-speed)) ((move pos-move)
(angle pos-angle)(speed zero-speed)) ((move
zero-move) (angle pos-angle)(speed
neg-speed)) ((move pos-move) (angle
zero-angle)(speed pos-speed)) ((move zero-move)
(angle zero-angle)(speed zero-speed)) ((move
neg-move) (angle zero-angle)(speed
neg-speed)) ((move zero-move) (angle
neg-angle)(speed pos-speed))((move neg-move)
(angle neg-angle)(speed zero-speed)) ((move
bigneg-move) (angle neg-angle)(speed neg-speed))
71How to Specifically Determine move?
- FRIL generates a collection of support pairs
- ((move f1)) (sl1 su1) ((move fn)) (sln sun)
- In Example 3, n 5, i.e.bigpos_move, pos_move,
zero_move, neg_move, bigneg_move - We need to combine them Defuzzification
- Obtain expected fuzzy set for each support
pair(transformation (fi, sli, sui) ?
(expFS(fi), 1, 1)) - Combine all expected fuzzy sets(intersection
by following the rule of combination) - Take the expected value (COG) of the combined
fuzzy set
72Evidential Logic in FRIL
73Example 4 Neuro-Fuzzy Pendulum Control
74(sigmoid-rule 0.50 11) ((rule1)(evlog
sigmoid-rule ((angle pos-angle) 0.5 (speed
pos-speed) 0.5))) ((rule2)(evlog sigmoid-rule
((angle zero-angle) 0.5 (speed pos-speed)
0.5))) ((rule3)(evlog sigmoid-rule ((angle
neg-angle) 0.5 (speed pos-speed)
0.5))) ((rule4)(evlog sigmoid-rule ((angle
pos-angle) 0.5 (speed zero-speed)
0.5))) ((rule5)(evlog sigmoid-rule ((angle
zero-angle) 0.5 (speed zero-speed)
0.5))) ((rule6)(evlog sigmoid-rule ((angle
neg-angle) 0.5 (speed zero-speed)
0.5))) ((rule7)(evlog sigmoid-rule ((angle
pos-angle) 0.5 (speed neg-speed)
0.5))) ((rule8)(evlog sigmoid-rule ((angle
zero-angle) 0.5 (speed neg-speed)
0.5))) ((rule9)(evlog sigmoid-rule ((angle
neg-angle) 0.5 (speed neg-speed) 0.5)))
75(sigmoid-out-bp 00 11) ((move
bigpos-move)(evlog sigmoid-out-bp ((rule1)
1.0))) (sigmoid-out-p 00 0.51) ((move
pos-move) (evlog sigmoid-out-p ((rule2) 0.5
(rule4) 0.5))) (sigmoid-out-z 00
0.331) ((move zero-move) (evlog sigmoid-out-z
((rule3) 0.33 (rule5) 0.33
(rule7) 0.34))) (sigmoid-out-n 00
0.51) ((move neg-move) (evlog sigmoid-out-n
((rule6) 0.5 (rule8)
0.5))) (sigmoid-out-bn 00 11) ((move
bigneg-move)(evlog sigmoid-out-bn ((rule9) 1.0)))
76Further Extension (call for participation)
- ((a)) high P(a)high
- ((b)(a)) (high low) P(ba)high
and P(bnot a)low - Fuzzy Probability probability whose number is a
fuzzy number within 0,1. - Approach mass assignment theoretic consider a
fuzzy probability as a collection of supports
with a linear combination representing a
distribution of mass ...?? - Applications network intrusion detection,
(video) image classification/recognition, text
classification/categorization
77Summary
- Object-Orientation (OO) vs. Functional
Programming Language (FPL) - Origin of OO from AI
- OOPL may not necessarily incorporate all features
of OO - Many features of FPL are observed in OOPL, e.g.,
C, JAVA - FYI Object-Orientation vs. Logic Programming
Language (LPL) - Specifications of classes are given in logic
(i.e. HC) - Works on FRIL (I have some references)
- Uncertainty Management in LPL, i.e. FRIL
- Introduction to debate over probabilities with
various semantics - Use of probabilities, their intervals (supports),
fuzzy sets, non-monotonic reasoning and
computations of neural networks - Unified framework underlying mass assignment
theory
78System Integration
79Embedded FRIL
- FRIL can be embedded within applications written
in imperative programming languages. - C/C See the course materialshttp//penguin.ew
u.edu/class/ai/modules.03/gameai/frilemb/frilemb.h
tml - JAVA See the web page at University of Bristol,
UKhttp//www.enm.bris.ac.uk/ai/martin/downloads/J
avaFril.html(call for students developing the
course materials for FRIL-JAVA I/F)
80Multi Agent System with Embedded FRIL
Agent 1
Agent 2
Agent 3
Sample Application SPIDER Intrusion Detection
by multi agent approach EmoBot in Quake II
Artificial emotion engine / game AI RoboCup
Robot Soccer Game Competition (RoboLog
SWI-PROLOG, PIPOT (?) FRIL/PIP)
81(No Transcript)
82PEAS
- Performance Measure
- Environment
- Actuator
- Sensor
- Example Tic-Tac-Toe
- P (getting closer to) winning the game.
- E 3x3 grid
- A place either O or X
- S game board
- How about Web-bots (IR on the Internet)?
- How about Wumpus agent?
83Wumpus World
- Performance Measure
- (Higher) score
- Environment
- 4x4 with 1 wumpus, 3 pits, 1 gold.
- Action
- move, shoot, pick
- Sensor
- stench, breeze, glitter, bump, scream
84(No Transcript)
85Wumpus Solution Example
- Consider frilsrv wumpus as the game server
- Design your agent as a client to this
server(e.g. agent ltfrilsrv hostnamegt) - done false
- While NOT done
- Receive sensory info. (a list of words)
- If NOT killed
- Make decision of action (inference)
- Send action (a word indicating an action)
- Else done true
86In case of FRIL
- Assert sensory information addcl
- Stop if the agent is killed
- Infer the next action and send it to stdoute.g.
?((next-action A)(w stdout A)) - Remove asserted sensory information delclAll
you need to define is (next-action
A) ((next-action ..) .) They are viewed as
production rules perceive ? act
87In case of other languages ..
- Think what State Space Representation is.
- Think which search algorithm is the most
appropriate. - Example
- State a collection of predicates representing
slots that have been visited. - Transition an action
- Given such information, you should be able to
determine the most appropriate search algorithm.