Title: PROBLEM SOLVING
1PROBLEM SOLVING
2Characteristics of Problem Solving
- Much of the work in AI problem solving is based
on work cognitive psychology, or human problem
solving.
3Three consistent features of problem solving
episodes
- Goal directedness
- behavior is organized toward achieving a goal.
- Subgoal decomposition
- decomposing the original goal into subtasks, or
subgoals. These subtasks or subgoals are often
easier to accomplish, yet by achieving them we
move towards our goal. - Operator selection
- An operator is an action that will achieve a goal
(or subgoal). By sequencing together several
operators, we can achieve the goal.
4Early Work in Problem Solving
- The most prominent early work on problem solving
was conducted by a group of mainly German
psychologists, "Gestalt" psychologists, in the
early 1900's.
5Wolfgang Kohler
- One of the founders of the Gestalt school of
Psychology. - While trapped on the island of Tenerife in the
Atlantic Ocean during World War I, he studied the
subjects available to him - a colony of captive
chimpanzees. - Sultan was his most prized subject.
6Example Experiment
- One problem was for Sultan to get bananas from
outside his cage. - Not difficult when given a stick long enough to
reach the food. - When given two short sticks, neither long enough
to reach the food, he was not successful. - First Sultan tried to reach bananas with the two
sticks, - When he realized that approach wouldn't work, he
gave up and sulked in his cage for awhile. - Then, he got up and went over to the sticks, put
one inside the other to create one long pole, and
got the bananas - problem solved.
7Kohlers Conclusion
- Believed insight
- putting the two poles together
- is necessary to solve problems.
- Solutions were often preceded by a period of
intense thinking incubation (sulking) by the ape.
8Functional Fixedness
- A primary premise of Gestalt psychology is that
human problem solvers get stuck when trying to
solve problems because they cannot change their
problem solving set. - Human problem solvers can change their problem
solving set when they are given direction
(hints), have a flash of insight (ah-ha).
9Does Insight Occur?
- Associationist argue that insight (ah-ha) does
not occur. - Covert behavior.
- Thorndike experimented with cats in a Puzzle Box.
Cats exhibited simple trial and error behavior
to get out of the box. - Humans substitute mental trial and error for the
physical trial and error process.
10Problem Representation
- Join all the dots by drawing four straight lines
without removing your pencil from the paper (all
lines are connected). - . . .
- . . .
- . . .
11The Importance of Problem Representation
- A key factor in problem solving.
- It is often necessary to reorganize the problem,
changing the way it is represented to be able to
solve it. - Thinking processes are often unnecessarily
restricted by a poor representation.
12Search
- In AI, problem solving is often seen as a process
of searching the problem space for a solution.
13State
- The state of the problem space must be
represented so that we know - Initial State - starting point
- Goal State - destination, what the situation must
look like to be done. - State Transition - operators, ways to move around
the problem space. - Similar to Human Problem Solving
14Three consistent features of problem solving
episodes
- Goal directedness
- behavior is organized toward achieving a goal.
- Subgoal decomposition
- decomposing the original goal into subtasks, or
subgoals. These subtasks or subgoals are often
easier to accomplish, yet by achieving them we
move towards our goal. - Operator selection
- An operator is an action that will achieve a goal
(or subgoal). By sequencing together several
operators, we can achieve the goal.
15Other Search Definitions
- Search space - is the set of state that may be
reached by applying legal operators. - Problem - find a sequence of states that lead
from the initial state to the goal state.
16Finding the Solution
- A matter of searching the problem space.
- States may
- Have already occurred at a higher level. Stop!
In a loop! - Identical states may appear on two branches at
the same level. Develop only one branch. - Be illegal. Stop!
- Goal State. Stop! Problem Solved!
- None of the above. Keep looking.
17Search Example
- Consider Kohler's experiments with Sultan.
- Suppose a bunch of bananas is hanging from the
center of the ceiling, out of Sultan's reach. - A chair is under the window and Sultan is at the
door the room. - How can Sultan get the bananas?
18Search Example
- In the actual experiments, the chimpanzees had
difficulty until they reorganized the problem
space by moving the crate under the bananas. - This is called the monkey and banana problem, it
appears in most Prolog and many AI texts.
19How to Solve in Prolog
- First, design a state representation
- What do we need to keep track of?
- horizontal position of monkey
- vertical position of monkey
- position of box
- has/has not banana
- state (horizontal, vertical, box, banana)
20Initial and Goal States
- Initial Sultan is at the door and on the floor,
the box is at the window and he does not have the
bananas - state (atdoor, onfloor, underwindow, hasnot)
- Goal Sultan is under the bananas, on the chair,
the box is under the bananas, and he has the
bananas. - state(middle, onbox, middle, has).
21Operators
- Allow changes of state
- Key is Prolog is to define the possible state and
allow Prolog to find the path (string of
operators) that yields the goal state. - Monkey and Banana operators
- walk on the floor
- climb the box
- push the box around
- grasp the banana
22See Prolog Handout
23Direction of Search
- Two general search approaches
- Data-driven search
- Goal-driven search
24Data-driven search
- also called "forward chaining" or "forward
reasoning" - start with the initial state, and work forward
applying the various operators until the goal
state is reached - if a solution exists.
25Goal-driven search
- reverse of data driven
- also called "backward chaining" or "backward
reasoning" - start at the goal and work backward to find a
path to the initial state - operators must be inverted
26Comparison of Data and Goal Driven Strategies
- Goal-driven (or backward chaining) search
strategies are often more efficient because they
search a smaller portion of the search space. - For efficiency, prefer to search as small a part
of the search space as necessary to find a
solution. - In human problem solving, we find experts
generally work forward, while novices work
backward.
27Search Strategies
- Two general search strategies
- breadth first
- depth first
28Breadth-first Search
- Each node is examined in order
- Each level of a search is filled out completely
before proceeding to the next level. - Requires a great deal of memory
- The solution path that is found is guaranteed to
be the shortest path. - But, rarely used in AI due to memory requirements.
29Depth-first Search
- The most recently encountered node is expanded
first. - Search downward all possible levels before
backtracking to a node on a higher level. - Exploring one path completely before looking at
other nodes, requires less memory (to record open
states). - However, fully exploring branches that do not
hold a solution is very time consuming.
30Human Problem Solving
- Studies of computer programmers found that
experts study a computer program in a
breadth-first fashion - study all modules on one
level before proceeding further down the calling
hierarchy. - Novice programmers study programs in a depth
first fashion, studying all lower modules in a
calling hierarchy before studying other modules
at the higher level.
31Sample Structure Chart
Expert programmer using breadth-first search
would search in the following pattern Top 1 2
3 1.1 1.2 2.1 2.2 3.1 3.2 1.1.1 1.1.2
3.1.1 3.1.2. Novice programmers using
depth-first search would search in the following
pattern Top 1 1.1 1.1.1 1.1.2 1.2 2 2.1
2.2 3 3.1 3.1.1 3.1.2.3.2.
32Bounded Depth-First Search
- Alternative to the basic strategies to gain some
of the advantages of both - Follow depth-first search, but limit the number
of levels that are searched down before
terminating the search on that node. - If reach X levels without finding a solution,
stop and backtrack. - Weakness
- if the solution is below X levels will not find
the solution. - Modify to search X 1 levels if all X levels are
search without yielding a solution.