FA21-BCS-020 (AI Assignment 2)
FA21-BCS-020 (AI Assignment 2)
Sahiwal Campus
Theory Assignment# 02
Submitted To:
Submitted By:
Muhammad Usman
Registration No:
FA21-BCS-020
Section:
Subject:
Artificial Intelligence
Date:
- Constraints: X1 ≠ X2, X2 = X3
In this problem, you need to assign values to X1, X2, X3 such that the constraints are
met.
Constraint Propagation
Constraint propagation is the process of using constraints to reduce the domain of variables by
ruling out values that cannot be part of any valid solution. It helps narrow down possible
solutions by updating variable domains.
Example: If X1 ∈ {1, 2, 3} and the constraint is X1 ≠ 2, you can remove 2 from X1's
domain, reducing it to {1, 3}.
Inference in CSP
Inference involves deducing new constraints or information by analyzing current assignments
and constraints. It typically helps during the search process by reducing unnecessary choices.
Node Consistency
A CSP is node consistent if, for every variable, all values in its domain satisfy the unary
constraints. This checks if each variable's value is consistent within its own domain.
Example: If X1 ∈ {1, 2, 3} and the constraint is X1 > 1, the domain becomes {2, 3}.
Arc Consistency
A CSP is arc consistent if, for every pair of variables related by a binary constraint, each value of
one variable has a corresponding value in the other variable that satisfies the constraint.
Example: If X1 ∈ {1, 2, 3} and X2 ∈ {2, 3}, and the constraint is X1 < X2, then X1 = 3
is not arc-consistent with X2, so you remove 3 from X1’s domain.
Path Consistency
A CSP is path consistent if, for every three variables, the assignment of any two variables is
consistent with the third. This extends arc consistency by considering triples of variables.
Example: If there are constraints between X1, X2, and X3, path consistency ensures that
an assignment of X1 and X2 is compatible with possible values of X3.
K-Consistency
A CSP is k-consistent if, for any set of k variables, any consistent assignment to k - 1 of them can
be extended to the k-th variable.
Example: A CSP is 3-consistent if, for any two variables X1 and X2, a consistent
assignment can be extended to a third variable X3.
Global Constraints
Global constraints are constraints that apply to a large set of variables and have more complex
conditions than basic binary constraints. They capture common patterns like 'all values must be
different.'
Example: The 'AllDifferent' constraint ensures that all variables must have distinct
values, such as X1 ≠ X2 ≠ X3.
Example: If you assign X1 = 1, then X2 = 2, but later find that this leads to a conflict,
backtracking will undo one of these assignments.
Example: If X1 has fewer available values than X2, you might prioritize X1.
Example: After assigning X1, inference would reduce the domain of X2 before
continuing with the search.
Constraint Learning
Constraint learning involves learning new constraints during the search to prevent revisiting the
same failures. This is similar to learning in SAT solvers.
Example: In a scheduling problem, you might swap the assignment of two tasks to try to
reduce conflicts.
Min-Conflicts Heuristics
The min-conflicts heuristic is a strategy for local search in CSPs where, at each step, you assign
values to variables that result in the fewest conflicts with other variables.
Example: In a scheduling problem, you assign tasks to time slots in a way that
minimizes conflicts with already scheduled tasks.
Constraint Weighting
Constraint weighting is a technique used in local search to escape local minima by dynamically
adjusting the importance (weight) of constraints. When a constraint is violated repeatedly, its
weight is increased.
Example: If a specific constraint is frequently violated, you increase its weight so that
the algorithm prioritizes satisfying it in future steps.
Example: A CSP with a tree structure can be solved in polynomial time using dynamic
programming.
Cutset Conditioning
Cutset conditioning is a technique used to solve CSPs by temporarily removing a set of variables
(the cutset) to reduce the problem to a simpler tree-structured problem.
Example: In a CSP with a cyclic structure, you remove a few variables to break the cycle
and then solve the problem more easily.
Tree Decomposition
Tree decomposition is a way to transform a CSP into a tree-like structure by grouping variables
and constraints into clusters, making it easier to solve using dynamic programming.
Example: In a graph representing a CSP, tree decomposition groups variables with shared
constraints into clusters, creating a tree structure.
Value Symmetry
Value symmetry occurs when swapping values leads to equivalent solutions. Identifying
symmetries can reduce the search space.
Example: In a graph coloring problem, swapping colors that are not distinguished by any
constraints results in equivalent solutions. You can prune symmetric solutions to speed up
the search.