3 - Programming as Search (Part 1) [ID:21754]
50 von 418 angezeigt

Okay. So, let's do some more.

Let's do some more.

So, we've heard about the first rule of Prologue.

The second rule is when you fail,

it's not the end of the world.

You do something we call backtracking.

And I'm sure you've heard about it,

but I'll go through it anyway.

So what we do, the Prolog search procedure,

the thing that I've been kind of hand-waving about,

works the following way.

Okay. It is actually top-down.

We've seen that. We start at the beginning

of the knowledge base and work our way down.

Okay. And whenever we fail,

we'll just try the next one.

We do it left, right, and depth first.

If that doesn't mean anything to you,

it will next week.

No, we have all hellos,

so maybe not next week.

Soon. So we match the first query of

the head-letteral in a top-down order.

If there are no matches, we fail.

But it could be that in some cases,

and we're going to see an example right now,

that we have more ways of matching,

that more than one head matches.

So if we've reached the bottom and failed,

we have to remember, oh, at some point,

there was another possibility

that we call backtrack points.

So we go back to those.

We systematically explore all possible matches.

In a top-down, left-right depth-first

backtracking search.

Boom.

Okay?

Not very difficult.

These are the official words for it.

Good, so let's see.

We have a little bit more knowledge about the world.

Right, we have tricycles with three wheels,

rollerblades with three wheels,

and we have our well-known BMW,

which has four wheels, and we augment

our definition of a car to have either four or three wheels.

Which, by the way, is exactly your ore here, right?

In the wild.

Now, we know more about the world.

Teil eines Kapitels:
Logic Programming

Zugänglich über

Offener Zugang

Dauer

00:27:53 Min

Aufnahmedatum

2020-10-24

Hochgeladen am

2020-10-24 14:06:58

Sprache

en-US

Explanation of backtracking and a board example for addition.

Einbetten
Wordpress FAU Plugin
iFrame
Teilen