ECS 170: Introduction to Artificial Intelligence
Lecture 2.
 

What is AI?

AI is about problem solving
The goal of AI is to build software agents that solve problems like humans do

Q1. How does the human brain solve problems?
A. No one knows for sure!

So we study a bunch of methods hoping that the brain probably uses one or a combination of these methods.

The collection of these methods, for the want of a better name is called AI

Here we will talk about a couple of children's puzzles: (a) The Farmer, fox, goose and bag of grain problem and the
cannibals and missionaries problem. The idea is to emphasize that the first step in problem solving is problem
formulation (in AI we call this the representation problem). Once the representation problem is solved, the solution
should fall into your lap like a ripe fruit. Evidently the representation problem is non-trivial and a great deal of human
ingenuity is required to find the proper representation.

Now I hope you can see the bifurcation in AI

The representation (knowledge representation) issue
The solution (problem solving) issue

There are numerous ways of representing a problem and numerous ways of solving a problem. We will spend about
40% on the representation and manipulation of that knowledge and about 60% on problem solving techniques.

In classical AI, the most popular way of representing a problem is via symbolic representation. Then these symbols are
manipulated using rules of mathematical logic. There are many logics: Propositional logic, Predicate logic,
non-monotonic logic, fuzzy logic and so on.

 

The Representation Problem.

Example. A farmer (Fa)  has a Fox (Fo), Goat (Go), and Cabbage (Ca).  He wants to cross a river on a boat. The boat can take at most two at a time. He cannot leave the (a) fox and the goose alone, (b) the goose and the grain alone.

Solution. Traditional Way. We solved this problem as children. It takes several iterations, several false starts, several trials and errors, but eventually this is a simple problem to solve.
 

Better way. First try to find a good representation. A good representation may lead to a solution, almost immediately.

One possible way to solve this is to list the farmer and his possessions on each of the two riverbanks at any given time. For example, the following arrangement

Initial State

farmer
goat
cabbage
fox

Empty

Final State

Empty

farmer
goat
cabbage
fox

shows THE INITIAL STATE when all four items are on one bank and none on the other bank.

As there are 4 items and 2 banks, the total distinct arrangements are 2*4 = 16. (List all of them!). Out of these 16 arrangements, only 10 are valid; the other six violate problem constraints. We can list the valid arrangements and call them nodes.

We can show the river crossings by directed arrows. Call these links. The 10 nodes can be connected to each other in 10 x 9 = 90 possible ways. Out of these only 20 are admissible and the other 70 are not.

 

See the diagram that I will put on the board.

 

Now the solution is obvious.
 

Example 2. The 3 cannibals and 3 missionaries problem. This is a bit more difficult but more interesting. This is assigned as a homework.

 

Generate and Test Approach.

 

Here we have a generator and a tester. The generator generates a possible solution. The tester checks to see if

(a)    It is a correct solution (valid solution)

(b)   It is an optimum solution (best solution)

 

Example. Breaking a Safe.

 

A safe has a combination lock. The combination has the structure

    

      xx-xx-xx

 

where each x is any digit from 0 thru 9.

 

The generator generates  00 – 00 – 00 and tests it. Say, Failure

The generator generates  00 – 00 – 01 and tests it. Say, Failure

…..

The generator generates  01 – 10 – 11 and tests it. Say, Success!

 

If we are not lucky, the success will come after ALL combinations have been checked. So what is the worst case effort?

 

We have to try 100 numbers (from 00 to 99) in each of the three positions. So there are (100)**3 = 1 million combinations.

 

Suppose we can do 3 generate and test cycles per minute. Then it will take approximately 16 weeks working 24 hrs/day.

 

Properties of a good generator:

 

(a)    Complete – The generator eventually produces a correct solution

(b)   Non-redundant – It does not produce the same solution twice

(c)    Informed – Restricts the generated solution to a plausible set.

 

Example – Tree Identification

 

You have a huge tree catalog. With the help of that catalog, you want to identify a tree you have seen. You can go systematically from page 1 and go down the pictures of trees one by one and compare each with the tree in front of you.

 

Suppose, the generator is “informed.” Now you see a bare tree with all its leaves fallen in the winter season. Then there is no point in comparing the tree with the pictures in the chapter “coniferous” trees. The entire chapter can be skipped.

 

Example – Revisit Breaking a Safe

 

Suppose the burglar knows that the safe manufacturer uses only prime numbers. We know there are only 25 prime numbers from 00 to 99. So now the search space is limited to 25**3 = 15625 trials and the search can be carried out in about 2 days – not 16 weeks.