Constraint Satisfaction Algorithm
Constraint Satisfaction Algorithm
(a) Choose the most promising task from the agenda. Notice that this
task can be represented in any desired form. It can be thought of
as an explicit statement of what to do next or simply as an
indication of the next node to be expanded.
(i) See if it is already on the agenda. If so, then see if this same reason for
doing it is already on its list of justifications. If so, ignore this current
evidence. If this justification was not already present, add it to the list. If
the task was not on the agenda, insert it.
(ii) Compute the new task’s rating, combining the evidence from all its
justifications.
Constraint Satisfaction
• Many AI problems can be viewed as problems
of constraint satisfaction.
2. If the union of the constraints discovered above defines a solution, then quit and report the
solution.
3. If the union of the constraints discovered above defines a contradiction, then return failure.
4. If neither of the above occurs, then it is necessary to make a guess at something in order to
proceed. To do this, loop until a solution is found or all possible solutions have been
eliminated:
(a) Select an object whose value is not yet determined and select a way of strengthening the
constraints on that object.
(b) Recursively invoke constraint satisfaction with the current set of constraints augmented by
the strengthening constraint just selected.
Means-Ends Analysis
• Process centers around the detection of difference between
the current state and the goal state.
• An operator that can reduce the difference must be found.
• If that operator cannot be applied to the current state. Set up
a sub problem of getting to a state in which it can be applied.
This process is known as operator subgoaling.
• The first AI program to exploit means-ends analysis was the
General Problem Solver (GPS) motivated by the observation
that people often use this technique when they solve
problems.
Means-Ends Analysis
2. Otherwise, select the most important difference and reduce it by doing the following until
success or failure is signaled:
(a) Select yet untried operator O that is applicable to the current difference. If there are no such
operators, then signal failure.
(b) Attempt to apply O to CURRENT. Generate descriptions of two states: O-START, a state in
which O’s preconditions are satisfied and O-RESULT, the state that would result if O were
applied in O-START.
(c) If
(FIRST-PART ← MEA(CURRENT, O-START))
and
(LAST-PART ← MEA(O-RESULT, GOAL))
are successful, then signal success and return the result of concatenating
FIRST-PART, O, and LAST-PART.