ECE 4524 Artificial Intelligence and Engineering Applications Meeting 7: Constraint Satisfaction Reading: AIAMA 6.1-6.2 Today’s Schedule: ◮ Review of problem solving using state space search ◮ States with factored representations ◮ Define a Constraint Satisfaction Problem (CSP) ◮ Examples of CSPs ◮ AC-3 algorithm
Constraint Satisfaction Constraint Satisfaction is a relatively new field (1970’s) ◮ Early motivation was the interpretation of line drawings, Huffman-Clowes labeling (1971). ◮ Mathematically formalized by Montanari in 1974 ◮ Haralick, Davis, Rosenfeld, showed in general such problems were NP complete (1978) ◮ Applications in machine vision, belief maintenance, scheduling, temporal reasoning, graph problems, floor plan design, the planning of genetic experiments, the satisfiability problem, ... ◮ Specialized programming languages were developed in 1980’s, e.g. ALICE See Lauriere, 1978 for a good historical reference.
Review of the Problem Solving Agent Problem Solving Agents formulate problems by ◮ representing (model) the world as atomic states , ◮ defining an initial state that represents the initial condition of the world, ◮ defining a goal state that represents what they want the world to look like, ◮ and defining a function for allowable state transitions which map onto actions in the world.
Some problems have states that can be factored ◮ state = variables with values ◮ constraints specify allowed or prohibited relationships among the variables ◮ general purpose heuristics can be applied A classic example is Einstein’s Riddle (Zebra puzzle).
Einstein’s Riddle 1. There are five houses. 2. The Englishman lives in the red house. 3. The Spaniard owns the dog. 4. Coffee is drunk in the green house. 5. The Ukrainian drinks tea. 6. The green house is immediately to the right of the ivory house. 7. The Old Gold smoker owns snails. 8. Kools are smoked in the yellow house. 9. Milk is drunk in the middle house. 10. The Norwegian lives in the first house. 11. The man who smokes Chesterfields lives in the house next to the man with the fox. 12. Kools are smoked in the house next to the house where the horse is kept. 13. The Lucky Strike smoker drinks orange juice. 14. The Japanese smokes Parliaments. 15. The Norwegian lives next to the blue house.
Formally a CSP is ◮ X , a finite set of variables ◮ D , a set of Domains for each variable, each Domain also a set ◮ C , a set of constraints, each defined as (scope, relation) ◮ scope - set of variables, a subset of X involved in the relation ◮ relation - the relationship among them, a function of the scope variables that returns True or False
Warmup NPR’s Weekend Edition Sunday usually has a word puzzle, e.g. “Think of a well-known actor, three letters in the first name, seven letters in the last. One of the letters is an ”S.” Change the ”S” to a ”K” and rearrange the result, and you’ll name a well-known fictional character. Who is it?” Describe the above as a CSP.
Exercise Consider the following CSP. X = X 1 , X 2 D = X 1 ∈ Strictly Positive Real Numbers , X 2 ∈ Strictly Positive Integers C = X 2 1 + X 2 2 < 2 What is the solution (manual), i.e. what are allowed values of X 1 and X 2 ?
CSP solutions An assignment of variables to values in their respective domain can be ◮ consistent - violates no constraints ◮ partial, if some variables unassigned ◮ complete, if all variables are assigned a value A solution to the CSP is a complete and consistent assignment.
Some terminology ◮ Domains may be continuous or discrete, finite or infinite ◮ Constraints may be ◮ unary - only one variable in the scope ◮ binary - only two variables in the scope ◮ n-ary - n variables in scope ◮ global - arbitrary number of variables are in the scope (often all of them)
Most CSP algorithms assume binary constraints. How might one in general convert all n-ary constraints to binary ones? Give it some thought, can you see a solution in the case A + B = C? (Exercise 6.6 in the text)
Example: Map Coloring ������������������ ����������������� ������������ ������������ ����� ����� ������������ ������������ ����� ����� ������������������ ����������������� ���������������������������� ������������������������ ���������� ����� ��� ��� ��� �����������������
Example: Scheduling ◮ How to schedule experiments on an expensive piece of equipment, e.g. Large Hadron Collider or Hubble Space Telescope. ◮ How to schedule courses (or meetings in general) ◮ How to schedule jobs on CPUs or computer clusters ◮ How to schedule tasks on a large construction project ◮ How to pack containers and vehicles ◮ etc.
Example: Sukodu
Example: KenKen
Inference using Local Consistency ◮ Node Consistency ◮ Arc Consistency ◮ Path Consistency
AC-3 Algorithm
Exercise A CSP: X : { X 1 , X 2 , X 3 } D : X 1 ∈ { A , B , C } , X 2 ∈ { A , C , E } , X 3 ∈ { E , B , C , A } C : { X 1 = X 2 � = X 3 } Apply AC-3 to check for an inconsistency.
Next Actions ◮ Continue reading on Constraint Satisfaction, AIAMA 6.3-6.4 ◮ Take warmup before noon on Thursday 2/8. Reminders ◮ PS1 is due 2/12.
Recommend
More recommend