0% found this document useful (0 votes)
10 views3 pages

Unit 2 5.1

Chapter 5 defines Constraint Satisfaction Problems (CSPs) as consisting of variables, domains, and constraints, with the goal of finding consistent and complete assignments. It provides examples such as map coloring and job-shop scheduling to illustrate CSP applications, highlighting advantages like natural representation and efficient solvers. Variations in CSP formalism include different types of domains and constraints, as well as the potential for soft constraints in optimization problems.

Uploaded by

SUDEEP SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Unit 2 5.1

Chapter 5 defines Constraint Satisfaction Problems (CSPs) as consisting of variables, domains, and constraints, with the goal of finding consistent and complete assignments. It provides examples such as map coloring and job-shop scheduling to illustrate CSP applications, highlighting advantages like natural representation and efficient solvers. Variations in CSP formalism include different types of domains and constraints, as well as the potential for soft constraints in optimization problems.

Uploaded by

SUDEEP SINGH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

unit 2 5.1 .

md 2025-05-06

Chapter 5: Constraint Satisfaction Problems


5.1 Defining Constraint Satisfaction Problems
A Constraint Satisfaction Problem (CSP) consists of:

A set of variables: X = {X₁, X₂, …, Xₙ}.


A set of domains: D = {D₁, D₂, …, Dₙ}, where each Dᵢ is the set of allowable values for Xᵢ.
A set of constraints: C, where each constraint specifies allowable combinations of values for
certain variables.

Terminology:

Assignment: A variable Xᵢ is assigned a value vᵢ ∈ Dᵢ.


Consistent (or legal) assignment: An assignment that does not violate any constraints.
Complete assignment: Each variable in the CSP has a value, with all constraints satisfied.
Partial assignment: Some variables may be unassigned. If it satisfies constraints for all assigned
variables, it is a partial solution.
Solving a CSP: Finding a consistent and complete assignment.
CSP solving is generally NP-complete, but special classes can be more tractable.

5.1.1 Example Problem: Map Coloring


Task: Color each region (e.g., of Australia) with colors (e.g., red, green, blue) such that no adjacent
regions share the same color.
Variables: States/territories (WA, NT, Q, NSW, V, SA, T).
Domain: {red, green, blue} for each variable.
Constraints: Neighboring regions must have distinct colors.
Example constraints:
SA ≠ WA
SA ≠ NT
… etc.
Possible solutions: Assigning colors consistently (e.g., WA=red, NT=green, Q=red, etc.) so no adjacent
states share a color.
Constraint graph representation: Nodes = variables, edges = constraints between variables.

Advantages of CSP Formulation

Natural representation: Many problems map easily to CSPs.


Efficient solvers: CSP solvers prune large sections of the search space quickly.
Constraint-based pruning: Once a partial assignment violates a constraint, it is discarded immediately.

5.1.2 Example Problem: Job-Shop Scheduling


Common in manufacturing/production lines:
Each task is a variable with a domain of possible start times.
Constraints can include:

1/3
unit 2 5.1 .md 2025-05-06

Precedence constraints: Certain tasks must finish before others begin.


Resource constraints: Limited tools or workers.
Duration constraints: Each task runs for a fixed amount of time.
Example (car assembly with 15 tasks):
Variables: AxleF, AxleB, WheelRF, WheelLF, WheelRB, WheelLB, NutsRF, NutsLF, NutsRB, NutsLB,
CapRF, CapLF, CapRB, CapLB, Inspect.
Domains: Possible start times (e.g., 0 to 30).
Precedence constraints (examples):
AxleF + 10 ≤ WheelRF (must install front axle before front right wheel).
WheelRF + 1 ≤ NutsRF (tighten nuts after attaching wheel).
Disjunctive constraints: Some tasks cannot overlap in time (e.g., AxleF and AxleB if there’s only
one tool).
Overall goal: Ensure all tasks fit within feasible time ranges without violating constraints.

Task Predecessors Duration (minutes) Additional Constraint

AxleF – 10 Cannot overlap with AxleB

AxleB – 10 Cannot overlap with AxleF

WheelRF AxleF 1 Must follow AxleF + 10

WheelLF AxleF 1 Must follow AxleF + 10

WheelRB AxleB 1 Must follow AxleB + 10

WheelLB AxleB 1 Must follow AxleB + 10

NutsRF WheelRF 2 –

NutsLF WheelLF 2 –

NutsRB WheelRB 2 –

NutsLB WheelLB 2 –

CapRF NutsRF 1 –

CapLF NutsLF 1 –

CapRB NutsRB 1 –

CapLB NutsLB 1 –

Inspect All tasks (before) 3 Must be last

5.1.3 Variations on the CSP Formalism


Domains:
Finite or discrete domains (e.g., red, green, blue; or integers 1–8 in 8-queens).
Infinite domains (potentially unbounded integers, real numbers).
Continuous domains (common in real-world scenarios like scheduling observations, linear or
quadratic programming).
Constraints:

2/3
unit 2 5.1 .md 2025-05-06

Unary constraints: Restrict values of a single variable (e.g., SA ≠ green).


Binary constraints: Between two variables (e.g., SA ≠ WA).
Global constraints: Involve multiple variables (e.g., Alldiff across several variables).
Example: Cryptarithmetic puzzle with a global Alldiff constraint on letters representing digits.
Constraint Graphs/Hypergraphs:
Constraint graph for binary CSPs.
Hypergraph if constraints involve multiple variables (n-ary constraints).
Dual graph transformation can convert an n-ary CSP to a binary CSP, but global constraint
handling can be more efficient with specialized algorithms.
Preferences:
Some CSPs include soft constraints or preferences (which yield a Constrained Optimization
Problem, COP).
Assign a cost to each constraint violation or to less-preferred assignments.
Optimize to find the best (minimum-cost) solution.

3/3

You might also like