solutions midterm 2004. search heuristics (1) f(n) = g(n) +h(n) explanation: –g(n) measures the...

23
Solutions Midterm 2004

Post on 18-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Solutions

Midterm 2004

Search Heuristics (1)

• f(n) = g(n) +h(n)• Explanation:

– g(n) measures the cost of the optimal path from the start node to n that is actually known when the algorithm is performed

– h(n) is an estimate of the costs to a terminal node from n.

Search Heuristics (2)

• The function h(n) is optimistic if it never overestimates the real optimal costs, i.e. 0 h(n) h*(n) , where h*(n) are the optimal costs from n to a terminal node.

• One can obtain optimistic estimates by allowing illegal actions. This can be done in different ways, e.g. by – Dropping a precondition of the action– Inserting a new edge in the graph.

h(e)7

4

2

3

4

5

start

goal

2

2

2

3

32

2

5

2

f

es

a

t

g

bc

d

4

ExampleSearch

a

s

ef(a) = 7 f(e) = 9

b

c

d

f

g

t

f(b) = 8

f(f) = 11

f(g) = 11

f(c) = 10

f(d) = 12

2 2

5

2

2

2

2

3

3

The right path is optimal

Order of nodes:a, b, e, c, f, g

Typical Errors

• There where no real errors.• It was only important that the descriptions were precise.

Predicate Logic: Problem

1) Represent the following sentences in predicate logic:

a) The father of Bill is rich b) If someone is rich then each son is rich c) If someone has a father who is rich then he is rich d) Bill is rich

Define the constants, variables, functions and predicates you use 2)

i) Is d) a logical consequence of a) and b) ? ii) Is d) a logical consequence of a) and c) ?

Representation in Predicate Logic

• Language elements:– Constant: Bill– Variable: x (can be any variable)– Function: Father_of(.)– Predicates: Rich(.), Son_of(. , .)

• Formalization:– Rich(Father_of(Bill))

x(Rich(x) y(Son_of(y, x) Rich(y)))

x(Rich(Father_of(x)) Rich(x))– Rich(Bill)

Logical Consequences

• Rich(Bill) is NOT a logical consequence of Rich(Father_of(Bill))

and x(Rich(x) y(Son_of(y, x) Rich(y)))

because there is no relation between father and son explicitly mentioned.

• However, Rich(Bill) is a logical consequence of Rich(Father_of(Bill)) and x(Rich(Father_of(x)) Rich(x))

• [Reason: Instantiate the x to Bill and get Rich(Father_of(Bill)) Rich(Bill) and then use Rich(Father_of(Bill))]

Typical Errors

• There were some pitfalls:• Son_of is a relation and father_of is a function• Someone refers to an arbitrary person, therefore it is a

universal and not an existential quantifier• Logical consequences must employ knoweldge that is

not formulated

The Planning Problem

PickUpBlock(x,y,z)*prec..:Clear(x)Handempty(z)

effects:+Holding(x,z)+Clear(y)-On(x,y)-Handempty(z)

PutDownBlock(x,y,z)prec..:Clear(y)Holding(x,z)effects:+On(x,y)+Handempty(z)

-Holding(x,z)-Clear(y)

On(a,b)

On(c,d)

PickUpBlock(x,y,z)*prec..:Clear(x)Handempty(z)

effects:+Holding(x,z)+Clear(y)-On(x,y)-Handempty(z)

PutdownBlock(x,y,z)prec..:Clear(y)Holding(x,z)effects:+On(x,y)+Handempty(z)

-Holding(x,z)-Clear(y)

All preconditions satisfied, can be used

The upper two lines are incomplete,preconditions need to be satisfiedfor Pickup and Putdown

Final plan:

Typical Errors

• In general this was well understood • Some students used a plan that was not very efficient

Values of Information

• Most important is the information about the bus. In order to save the hotel you have to be at C at 6pm on a day where the bus is going. If you know at which days the bus is going you can save in the worst case 6 overnight stays, i.e. 180$.

• Train from B to C: If the train goes at 1pm then you will always catch a bus at 6pm but if the train goes at 7.30 you will miss such a bus. Therefore with this information you may save one overnight stay if you take the earlier flight, ie. you save 10 $. The direct flight is most expensive.

• Optimal plan: Phone about the bus schedule and phone about the train. Take, if possible, the morning flight from A to B and then train and bus or fly in the afternoon one day earlier.

Typical Errors

• Some students did not mention the actions thar get information.

• It also occurred that the single flight was con sidered as optimal.

Fuzzy Sets and Control

• A fuzzy membership function maps the elements of a universe U to the unit interval:

µ : U [0,1]• Linguistic variables and rules a expressions in natural

language. A linguistic variable refers to a property and a liguistic rule refers to a rule. Both are interpreted in terms of membership functions and manipulations of membership functions.

Fuzzy Control

• Imagine we have a fuzzy system to control the setting of a valve according to specific temperatures. The two fuzzy control rules are:

– Rule 2: IF temperature = medium THEN cooling valve = almost open.

– Rule 1: IF temperature = low THEN cooling valve = half open.

• Suggest and explain membership functions to implement these rules and draw them into the following diagrams.

(T)

T [oC]15 30

0.5

1

(v)

v [%]50 100

0.5

1

Rule 1:

(T)

T [oC]15 30

0.5

1

(v)

v [%]50 100

0.5

1

Rule 2:

IF temperature = low THEN cooling valve = half open.

IF temperature = medium THEN cooling valve = almost open.

(T)

T [oC]15 30

0.5

1

(v)

v [%]50 100

0.5

1

Rule 1:

(T)

T [oC]15 30

0.5

1

(v)

v [%]50 100

0.5

1

Rule 2:

IF temperature = low THEN cooling valve = half open.

IF temperature = medium THEN cooling valve = almost open.

0.5

1

50%100%

Typical Errors

• One error type was that some students did not care about the membership functions.E.g. “Low temperature” membership goes down if the temperature increases.

Summary

• In principle, there was no serious misunderstanding.

• There errors were about equally distributed over the questions.

• They were most of time due to a lack of preciseness.