Artificial Intelligence: (Unit 3: Problem Solving)
Artificial Intelligence: (Unit 3: Problem Solving)
com
1
Downloded from: CSITauthority.blogspot.com
Artificial Intelligence Chapter- Problem Solving
Problem Solving:
Problem formulation:
A solution is a sequence of actions from initial to goal state. Optimal solution has the
lowest path cost.
The state space is commonly defined as a directed graph in which each node is a state and
each arc represents the application of an operator transforming a state to a successor state.
For following topics refer Russell and Norvig’s Chapter 3 from pages 87-96.
Problem Types: Toy Problems & Real World Problems (Discussed in class) .
Well Defined Problems (Discussed in class).
If
hall _wet and kitchen_dry
then
leak_in_bathroom
If
hall_wet and bathroom_dry
then
problem_in_kitchen
If
window_closed or no_rain
then
no_water_from_outside
Production System:
A production system (or production rule system) is a computer program typically used
to provide some form of artificial intelligence, which consists primarily of a set of rules
about behavior. These rules, termed productions, are a basic representation found useful
in automated planning, expert systems and action selection. A production system provides
the mechanism necessary to execute productions in order to achieve some goal for the
system.
Productions consist of two parts: a sensory precondition (or "IF" statement) and an action
(or "THEN"). If a production's precondition matches the current state of the world, then the
production is said to be triggered. If a production's action is executed, it is said to have
fired. A production system also contains a database, sometimes called worcking memory,
which maintains data about current state or knowledge, and a rule interpreter. The rule
interpreter must provide a mechanism for prioritizing productions when more than one is
triggered.
Situation-action rules
If it is raining then open the umbrella.
Inference rules
If Cesar is a man then Cesar is a person
Consider an example:
5
Bal Krishna Subedi
Downloded from: CSITauthority.blogspot.com
Artificial Intelligence Chapter- Problem Solving
Problem:
There are two jugs, a 4-gallon one and a 3-gallon one. Neither jug has any measuring
markers on it. There is a pump that can be used to fill the jugs with water.
How can you get exactly n ( 0, 1, 2, 3, 4) gallons of water into one of the two jugs ?
Solution Paradigm:
State = (x, y); where: x represents the number of gallons in the 4-gallon jug; y represents
the number of gallons in the 3-gallon jug. x ε{0, 1, 2, 3, 4} and y ε{0, 1, 2, 3}.
The initial state represents the initial content of the two jugs.
For instance, it may be (2, 3), meaning that the 4-gallon jug contains 2 gallons of water and
the 3-gallon jug contains three gallons of water.
The left hand side of a production rule indicates the state in which the rule is applicable
and the right hand side indicates the state resulting after the application of the rule.
For instance;
(x, y) such that x < 4 →(4, y) represents the production
If the 4-gallon jug is not full then fill it from the pump.
7
Bal Krishna Subedi
Downloded from: CSITauthority.blogspot.com
Artificial Intelligence Chapter- Problem Solving
The constraint satisfaction problem is to find, for each i from 1 to n, a value in Di for xi so
that all constraints are satisfied. Means that, we must find a value for each of the variables
that satisfies all of the constraints.
A CS problem can easily be stated as a sentence in first order logic, of the form:
8
Bal Krishna Subedi
Downloded from: CSITauthority.blogspot.com
Artificial Intelligence Chapter- Problem Solving
that satisfy all the unary constraints. Higher order constraints are represented by hyperarcs.
In the following we restrict our attention to the case of unary and binary constraints.
Constraints
Example: In N-Queens: Place N queens on an NxN chess board so that queen can attack
any other queen.
3. Along a diagonal, they cannot be the same number of columns apart as they
are rows apart: we need the constraint |i-j| ≠|Qi-Qj| ( | | is absolute value)
Representing the Constraints;
1. Between every pair of variables (Qi,Qj) (i ≠j), we have a constraint Cij.
2. For each Cij, an assignment of values to the variables Qi= A and Qj= B,
satisfies this constraint if and only if;
A ≠B
| A-B| ≠|i-j|
Solutions:
o A solution to the N-Queens problem will be any assignment of values to the
variables Q1,…,QN that satisfies all of the constraints.
o Constraints can be over any collection of variables. In N-Queens we only need
binary constraints---constraints over pairs of variables.
Refer Russell and Norvig’s Chapter 5 from pages 165-169. Also have a brief look on
page 172-173 for forward checking that we have discussed in class.
10
Bal Krishna Subedi