# problem solving what is ai way of solving problem?

Post on 19-Dec-2015

228 views

Embed Size (px)

TRANSCRIPT

Problem Solving

What is AI way of solving problem?

CS 331 Dr M M Awais 2

Problem Solving

Example

CAR BREAK DOWN

CS 331 Dr M M Awais 3

Problem Solving

Steps

• Analyze the problem

• Represent it

• Observe the present state

• Infer actions

• Solve to achieve the goal

Development Phase

Implementation Phase

CS 331 Dr M M Awais 4

Problem Solving

Analyze• Identify possible states• Identify possible actions• Identify possible goals• States, Actions, and Goals relate

through rules• Generate Rules that govern the

problem/or are helpful in searching the goal

CS 331 Dr M M Awais 5

Problem Solving

Analyze: Car Break Down

• Possible States (that you can observe or measure): –Air fuel ratio–Temperature–Engine sound–Fuel Consumption

CS 331 Dr M M Awais 6

Problem Solving

Analyze: Goals

• Reduction in Fuel Consumption

• High Pickup

• Low Coolant Temperature

• High Air-Conditioning Efficiency

• etc…

CS 331 Dr M M Awais 7

Problem Solving

Analyze: Actions

• Change condenser

• Change carburetor

• Get wheel alignment

• Etc…

CS 331 Dr M M Awais 8

Problem Solving

Analyze: RulesIf the air fuel (A/F) ratio is not correct (state observed)

THENTHENCarburetor needs adjustment (action identified)

WHICHWHICH Will achieve correct A/F ratio (Goal to be achieved)

CS 331 Dr M M Awais 9

Problem Solving

Represent Problem

• Convert the problem into a format that is understood by the computer system for automatic processing

• Numerous Techniques are available• Propositional /Predicate Calculus (formal)• Semantic / Conceptual Graphs (Graphical)• Search Trees (Graph Theory)• Rule Based/Expert Systems (Informal)• Learning Methods (Statistical/Symbolic)

CS 331 Dr M M Awais 10

Problem Solving

Represent: Example

IF the A/F ratio > 1.5

THEN change carburetor

IF coolant temperature > 250 c

THEN change condenser

MATLAB,

Prolog,

C++,

Lisp

As the course progresses we will study more of these representational techniques

CS 331 Dr M M Awais 11

Problem Solving

Implementation Phase

• Observe:– Use sensors/stored information/user input to get the

information about the present state within the problem domain.

• Infer:– Use above information to select appropriate actions that

will lead to the goal.

• Achieve Goal:– Apply actions in sequence/parallel to achieve goal

CS 331 Dr M M Awais 12

Problem Solving

Problem types

• Deterministic, fully observable

• Partial Deterministic and observable– Partial knowledge of states and actions

CS 331 Dr M M Awais 13

Problem Solving

Problem types

• Deterministic, fully observable

single state problem– know exactly present state;– solution is a sequence of known actions.

CS 331 Dr M M Awais 14

Problem Solving

Problem types

Partial knowledge of states and actions:• Non-observable sensorless or conformant problem

• May have no idea where one is; • solution (if any) is a sequence.• As if you are blind folded

• Nondeterministic and/or partially observable contingency problem

• Percepts provide new information about current state • solution is a tree or policy; often interleave search and execution.• States, actions and Rules of the environment are known, but current

state assessment is only possible after observation

• Unknown state space exploration problem (“online”)– When states and actions of the environment are unknown.

CS 331 Dr M M Awais 15

Problem Solving

More Examples

• Path Finding

• 8 Puzzle

• Robot Assembly

Primary FOCUS of discussion:

How to Analyze a given problem?

CS 331 Dr M M Awais 16

Problem Solving

Example: Romania

CS 331 Dr M M Awais 17

Problem Solving

Example: Romania

• On holiday in Romania; currently in Arad– Flight leaves tomorrow from Bucharest

• Formulate goal– Be in Bucharest

• Formulate problem– States: various cities– Actions: drive between cities

• Find solution– Sequence of cities; e.g. Arad, Sibiu, Fagaras, Bucharest, …

Identify Current StateIdentify GoalAnalyzeSolution

CS 331 Dr M M Awais 18

Problem Solving

Example: vacuum world

• Goal: Clean all the rooms

• Current State: 5• Single state, start in

#5. Solution??• Possible Actions

CS 331 Dr M M Awais 19

Problem Solving

Example: vacuum world

• Single state, start in #5. Solution??

[Movement, clean action]

[Right, Vacuum]

CS 331 Dr M M Awais 20

Problem Solving

Example: vacuum world• Single state

start in #5. Solution??[Right, Vacuum]

• Sensorless: start in {1,2,3,4,5,6,7,8} Solution??

• Contingency: start in {1,3}. Solution??

CS 331 Dr M M Awais 21

Problem Solving

Example: vacuum world

• States??• Initial state??• Actions??• Goal test??• Path cost??

CS 331 Dr M M Awais 22

Problem Solving

Example: vacuum world

• States?? two locations with or without dirt: 2 x 22=8 states.• Initial state?? Any state can be initial• Actions?? {Left, Right, Vacuum}• Goal test?? Check whether squares are clean.• Cost?? Number of actions to reach goal.

CS 331 Dr M M Awais 23

Problem Solving

Example: 8-puzzle

• States??• Initial state??• Actions??• Goal test??• Path cost??

CS 331 Dr M M Awais 24

Problem Solving

Example: 8-puzzle

• States?? Integer location of each tile • Initial state?? Any state can be initial• Actions?? {Left, Right, Up, Down}• Goal test?? Check whether goal configuration is reached• Cost?? Number of actions to reach goal

CS 331 Dr M M Awais 25

Problem Solving

Example: 8-queens problem

• States??• Initial state??• Actions??• Goal test??• Cost??

CS 331 Dr M M Awais 26

Problem Solving

Example: 8-queens problem

Incremental formulation vs. complete-state formulation• States?? • Initial state??• Actions??• Goal test??• Cost??

CS 331 Dr M M Awais 27

Problem Solving

Example: robot assembly

• States?? • Initial state??• Actions??• Goal test??• Cost??

CS 331 Dr M M Awais 28

Problem Solving

Example: robot assembly

• States?? Real-valued coordinates of robot joint angles; parts of the object to be assembled.

• Initial state?? Any arm position and object configuration.• Actions?? Continuous motion of robot joints• Goal test?? Complete assembly (without robot)• Cost?? Time to execute

CS 331 Dr M M Awais 29

Problem Solving

Summary

• Analyze:– States, Actions, Goals, Rules

• Represent: – Using any appropriate technique – Estimate the Cost factors (Time and Space Complexity)

• Implement:– Do actual coding/real world implementation– Validate and Test