1. AI3391 ARTIFICAL INTELLIGENCE
(II YEAR (III Sem))
Department of Artificial Intelligence and Data Science
Session 21
by
Asst.Prof.M.Gokilavani
NIET
1/24/2024 Department of AI & DS 1
2. TEXTBOOK:
• Artificial Intelligence A modern Approach, Third Edition, Stuart
Russell and Peter Norvig, Pearson Education.
REFERENCES:
• Artificial Intelligence, 3rd Edn, E. Rich and K.Knight (TMH).
• Artificial Intelligence, 3rd Edn, Patrick Henny Winston, Pearson
Education.
• Artificial Intelligence, Shivani Goel, Pearson Education.
• Artificial Intelligence and Expert Systems- Patterson, Pearson
Education.
1/24/2024 Department of AI & DS 2
3. Topics covered in session 21
1/24/2024 Department of AI & DS 3
• Game theory
• optimal decision in games
• alpha beta Search
• Monte Carlo tree search
• stochastic games
• partially observed games
• Constraint satisfaction problem
• Constraint propagation
• Backtracking search for CSP
• Local search for CSP
• structure of CSP.
4. Constraint Satisfaction Problems
• What is a CSP?
• Backtracking for CSP
• Local search for CSPs
• Problem structure and decomposition
1/24/2024 Dpaertment of CSE ( AL & ML) 4
5. What is CSP?
• A constraint satisfaction problem (or CSP) is a special kind of
problem that satisfies some additional structural properties beyond the
basic requirements for problems in general.
Definition:
• State is defined by variables Xi with values from domain Di
• Goal test is a set of constraints specifying allowable
combinations of values for subsets of variables
• Solution is a complete, consistent assignment
1/24/2024 Dpaertment of CSE ( AL & ML) 5
6. What is a CSP?
• In a CSP, the states are defined as,
• Finite set of variables V1, V2, …, Vn.
• Finite set of constrainsC1, C2, …, Cm.
• Non-emtpy domain of possible values for each variable DV1, DV2, …
DVn.
• Each constraint Ci limits the values that variables can take, e.g., V1 ≠ V2
1/24/2024 Dpaertment of CSE ( AL & ML) 6
7. CSP example: Map coloring
• Variables: WA, NT, Q, NSW, V, SA, T
• Domains: Di={red , green , blue}
• Constraints : adjacent regions must have different colors.
• E.g. WA ≠ NT (if the language allows this)
• E.g. (WA,NT) ≠ {(red , green),(red , blue),(green , red),…}
1/24/2024 Dpaertment of CSE ( AL & ML) 7
8. • A state is defined as an assignment of values to some or all variables.
• Consistent assignment: assignment does not violate the constraints.
• A solution to a CSP is a complete assignment that satisfies all constraints.
• Solution:
{WA=red,NT=green,Q=red,NSW=green,V=red,SA=blue,T=green}
1/24/2024 Dpaertment of CSE ( AL & ML) 8
9. Constraint Satisfaction Problems
• Simple example of a formal representation language
• CSP benefits
• Standard representation language
• Generic goal and successor functions
• Useful general-purpose algorithms with more power than
standard search algorithms, including generic heuristics.
• Applications:
• Time table problems (exam/teaching schedules)
• Assignment problems (who teaches what)
1/24/2024 Dpaertment of CSE ( AL & ML) 9
10. Varieties of CSPs
• Discrete variables
• Finite domains of size d ⇒O(dn) complete assignments.
• Eg: a Boolean CSP, NP-Complete problem
• Infinite domains (integers, strings, etc.)
• Eg: job scheduling, variables are start/end days for each job
• Need a constraint language
• Eg: StartJob1 +5 ≤ StartJob3.
• Linear constraints solvable, nonlinear undecidable.
• Continuous variables
• Linear constraints solvable in poly time by linear programming
methods (deal with in the field of operations research).
• Our focus: discrete variables and finite domains
1/24/2024 Dpaertment of CSE ( AL & ML) 10
11. Varieties of Constrains
• Unary constraints involve a single variable.
• e.g. SA ≠ green
• Binary constraints involve pairs of variables.
• e.g. SA ≠ WA
• Global constraints involve an arbitrary number of variables.
Eg: Crypth-arithmetic column constraints.
• Preference (soft constraints) e.g. red is better than green often
representable by a cost for each variable assignment; not considered
here.
1/24/2024 Dpaertment of CSE ( AL & ML) 11
12. Real-world CSP’s
• Assignment problems
• e.g., who teaches what class
• Timetable problems
• e.g., which class is offered when and where?
• Transportation scheduling
• Factory scheduling
1/24/2024 Dpaertment of CSE ( AL & ML) 12
13. CSP as a standard search problem
Incremental formulation
• States: Variables and values assigned so far
• Initial state: The empty assignment
• Action: Choose any unassigned variable and assign to it a value that does not
violate any constraints
• Fail if no legal assignments
• Goal test: The current assignment is complete and satisfies all constraints.
• Same formulation for all CSPs !!!
• Solution is found at depth n (n variables).
• What search method would you choose?
• How can we reduce the branching factor?
1/24/2024 Dpaertment of CSE ( AL & ML) 13
14. Commutative
• CSPs are commutative.
• The order of any given set of actions has no effect on the outcome.
• Example: choose colors for Australian territories one at a time
• [WA=red then NT=green] same as [NT=green then WA=red]
• All CSP search algorithms consider a single variable assignment
at a time ⇒ there are dn leaves.
1/24/2024 Dpaertment of CSE ( AL & ML) 14
15. Topics to be covered in next session 22
• Cryptarithmetic problem
Thank you!!!
1/24/2024 Dpaertment of CSE ( AL & ML) 15