Download Exercises

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
SLOVAK UNIVERSITY OF TECHNOLOGY
Faculty of Material Science and Technology in Trnava
INTELLIGENT CONTROL METHODS
Peter Schreiber
TRNAVA 2007
Intelligent Control Methods
Exercise 1: Mathematical logic. Prepositional calculus.
1. Negate the assertion: Peter speaks English or German.
2. Evaluate in the table:
B  A  (A  B)
A  (A  B)  B
A  (A  C)  B
3. Prove the commutative, associative and distributive principles for conjunctions
and disjunctions.
4. Are the forms tautologies?
(A  B)  C  A  (B  C)
(A  B)  A  B
((P  Q)  (R  S))  ((P  R)  (P  S)  (Q  R)  (Q  S))
((P  Q)  (R  S))  ((P  R)  (P  S)  (Q  R)  (Q  S))
5. Write some tautologies.
6. Transform the forms to conjunctive normal form:
(P  Q)  (P  A)
(P  Q)  R
(A  B)  A  B
2
Intelligent Control Methods
Exercise 2: Predicate calculus
1. Transform the form xPx  xQx to PNF
2. Transform the form xy z Px, z   P y, z   u Qx, y, u  to PNF
3. Transform to Skolem normal form (SNF):
a. (x)(y)(z) ((P(x,y)  Q(x,z))  R(x,y,z))
b.
xyz Px, z   P y, z   u Qx, y, u
4. Represent in predicate calculus assertions: Customs officers control every
visitor, who is not VIP. Some visitors are drug dealers and they are controlled by
drug dealers. No drug dealer is a VIP. Therefore some customs officers are drug
dealers
3
Intelligent Control Methods
Exercise 3: Resolution method.
1. Prove by resolution method, that the conclusion G derives from prepositions Fi.:
F1: x N  x   ~ V x    y S  x , y   C  y  
F2: x P x   N  x    y S  x , y   P y  
F3: x P x  ~ V x  
G: x P x   C  x  
2. Represent the task in clauses and prove by resolution method:
a. Every student likes ICM.
b. If some student likes some subject, he is interested in it.
c. Peter is student.
d. Conclusion: Peter is interested in ICM.
Represent the task in clauses and prove by resolution method:
3. Customs officers control every visitor, who is not VIP. Some visitors are drug
dealers and they are controlled by drug dealers. No drug dealer is a VIP.
Therefore some customs officers are drug dealers.
Solution: N  x  - x is a visitor, V x  - x is a VIP, C  x  - x is a customs officer, S  x , y  - x is
controlled by y, P x  - x is drug dealer.
F1: x N  x   ~ V x    y S  x , y   C  y  
F2: x P x   N  x    y S  x , y   P y  
F3: x P x  ~ V x  
G: x P x   C  x  
4
Intelligent Control Methods
The clauses (after transfer to Skolem normal form):
~ N   V   S  
~ N   V   C  
x
x
x, f  x 
x
x
f x 
x=a
Pa 
Va   C f a  
C f  a  
f a  = a
x = a ~ V a 
N a 
f a  =
a
~ L   P  
P   ~ V  
~ P   ~ V  
a, y
x
y
x = a ~ C a 
x
x
x
4. Represent the task in clauses and pove by resolution method:
Some patients like all doctors. No patient likes charlatans. Therefore no doctor is a
charlatan.
P x  - x is a patient, D x  - x is a doktor, Q x  - x is a charlatan, L x , y  - x likes y.
F1: x P x   y D y   L x , y  
F2: x P x   y Q y  ~ L x , y  
G: x D x  ~ Q x  
After transformation to SNF we have clauses for resolution. The clauses set:
x = a ~ Q y   ~ La , y 
Pa 
~ D   L  
~ P   ~ Q   ~ L  
y
x
a, y
y
x, y
x = b La ,b 
~ L a , b 
Db 
Qb 
5
Intelligent Control Methods
Exercise 4: State space
1. Three missionaries and three cannibals have to get to another side of the river.
There are only two places in a boat. How to do it, if less missionaries than
cannibals must not be in both watersides in each moment?
Solve the task by searching in a state space. Use the method
Breadth first searching
Depth first searching
Heuristic searching
2. A man with a wolf, goat and cabbage will get to another riverside. What has he
do, if only one thing can be with him in the boat and when the wolf and the goat
or the goat and the cabbage can not stay without survey?
Solve the task by searching in a state space. Use the method
Breadth first searching
Depth first searching
Heuristic searching
3. Solve tasks with matches, coins etc. by searching in a state space. Use the
methods
Breadth first searching
Depth first searching
Heuristic searching
6
Intelligent Control Methods
Exercise 5: Rule-based production systems
1. There are facts A, B, C, D. D is a consequence of the remaining facts. Design a
production rule.
2. Represent any real knowledge as a rule.
3. Explain the forward and the backward chaining of the rules with their
advantages and disadvantages.
4. Write production rules, which are before and after this one:
If the plant is a tree and it has needles, then it is a conifer.
5. Write 3 rules in a chain.
6. Define the sequence of the facts in your chain from example 3.
7
Intelligent Control Methods
Exercise 6 - 8: Expert systems. Knowledge base design.
Write your own knowledge-base. Use rule-based knowledge representation. The domain
can you choose arbitrary. Prefer technical areas. More than 30 rules must be there in the
knowledge-base.
Use the format of rules according to assistant’s instructions. Do not forget the questions
for non derivedable facts.
Verify your design in the offered software (backward chaining inference engine)
according to assistant’s instructions.
Example of a simple knowledge base:
pravidlo(1,rod,tujovite,
[[trieda,nahosemenne],
[tvar_listov,nepravidelny]]).
pravidlo(2,rod,borovicovite,
[[trieda,nahosemenne],
[tvar_listov,ihlovity],
[konfiguracia,chaoticka]]).
pravidlo(3,rod,borovicovite,
[[trieda,nahosemenne],
[tvar_listov,ihlovity],
[konfiguracia,rady],
[strieborne_pasy,ano]]).
pravidlo(4,rod,tuja_mociarna,
[[trieda,nahosemenne],
[tvar_listov,ihlovity],
8
Intelligent Control Methods
[konfiguracia,rady],
[strieborne_pasy,nie]]).
pravidlo(5,trieda,krytosemenne,
[[typ,strom],
[siroke,ano]]).
pravidlo(6,trieda,nahosemenne,
[[typ,strom],
[siroke,nie]]).
pravidlo(7,typ,bylina,
[[stonka,zelena]]).
pravidlo(8,typ,liana,
[[stonka,drevena],
[poloha,visiaca]]).
pravidlo(9,typ,strom,
[[stonka,drevena],
[poloha,vzpriamena],
[kmen,ano]]).
pravidlo(10,typ,ker,
[[stonka,drevena],
[poloha,vzpriamena],
[kmen,nie]]).
otazka(tvar_listov,"Aky je tvar listov ?",[nepravidelny,ihlovity]).
otazka(konfiguracia,"Aka je konfiguracia listov ?",[chaoticka,rady]).
otazka(strieborne_pasy,"Ma rastlina strieborne pasy pod listami ?",[ano,nie]).
otazka(siroke,"Ma rastlina siroke a ploche listy ?",[ano,nie]).
otazka(stonka,"Aka je stonka rastliny ?",[zelena,drevena]).
otazka(poloha,"Je rastlina vzpriamena alebo visiaca ?",[vzpriamena,visiaca]).
otazka(kmen,"Ma rastlina hlavny kmen ?",[ano,nie]).
9
Intelligent Control Methods
Exercise 9: Fuzzy logic
1. Develop a membership function for the following fuzzy sets based on people
height measured in cm: Tall, Short, Not short.
2. Using your own intuition plot fuzzy membership functions for following
variables:
Weight of people: Very light, light, average, heavy, very heavy.
Age of people: Very young, young, middle-aged, old, very old.
Education of people: Fairly educated, educated, highly educated, not highly
educated, more or less educated.
3. Large = {0/0 + 0.1/10 + 0.3/20 + 0.5/30 + 0.6/40 + 0.7/50}
Small = {1/0 + 0.8/10 + 0.5/20 + 0.3/30 + 0.1/40 + 0/50}
For these atomic terms find membership functions for the following phrases:
a) Not small and not large
b) Large or not small.
4.
10
Intelligent Control Methods
Exercise 10: Fuzzy control systems.
1. Describe a fuzzy control system and its main subsystems.
2. Plot the fuzzy functions in the universe (-6, 6):
a. NB = L(e, -6, -4)
b. NM = Λ(e, -6, -4, -2)
c. NS = Λ(e, -6, -4, -2)
d. Z = Λ(e, -2, 0, 2)
e. PS = Λ(e, 0, 2, 4)
f. PM = Λ(e, 2, 4, 6)
g. PB = Γ (e, 4, 6)
3. The equation of P-controller is:
u(k) = K e(k).
The rule describing the P-fuzzy controller is:
If (e(k) is (linguistic value)) then (u(k) is (linguistic value)).
Write the rules of fuzzy PD, PI and PID controllers.
4. Use the textbook Pavel Jura, Základy fuzzy logiky pro modelování a řízení, p.
88: Write the active rules for e = -0,6 and Δe = 0,4. (Use the table 6.4.2)
5. Write the results from example 4 using implication of Mandami.
6. Find crisp values by defuzzification of example 5 results. Use methods:
a. Center of Area
b. Center of Sum
c. Center Average Method
d. First of Maximum
e. Middle of maxima
11
Intelligent Control Methods
Exercise 11: Genetic algorithms
1. Describe the genetic algorithm as optimizing method. What is chromosome,
2. What are main genetic operations? Explain cross-over and mutation.
3. What is selection?
4. What is elitism?
5. Define roulette-wheel selection.
6. Describe objective function and fitness.
7. Design a genetic algorithm for optimizing task:
F(a,b,c,d) = (a+b)c-d + (c-a-b)a+d + cd., should be maximized, a,b,c,d are
natural numbers from (0, 10). What is chromosome? How do you ensure
elitism? How big is a population? What is ending condition?
8. Design an optimizing problem. Try it to solve analytical and after that by GA.
Compare the results.
12
Intelligent Control Methods
Exercise 12: Genetic algorithms
1. Use the software (butterflies evolution) given by assistant lecturer. Trace the
evolution and the numbers (genes) development by various inputs.
2. Use the software (GA convergence optimizing) given by assistant lecturer. Trace
the behavior of optimizing process with various input parameters (mutation and
cross-over probability, number of individuals, elitism, selection methods, …)
13
Intelligent Control Methods
Exercise 13: Neuronal networks
1. Describe the main used transfer function of neurons.
2. Design a neuronal network for characters recognition (26 characters) with binary
inputs and autputs. The characters are written in a raster 8 x 12 points.
a. How many input neurons do you need?
b. How many outputs neurons do you need?
3. Change starting weights in XOR-network from the lectures 12 and 13. Do 2
cycles of learning process.
4. Use the software for pattern recognition given by exercise tutor.
a. Click various inputs and trace the system behavior.
b. Input the character “A” in various forms and trace the system behavior.
c. Input the character “O”. Change it step by step into character “C” and
trace the system behavior.
14