0% found this document useful (0 votes)
18 views17 pages

Class 11 Constraintsatisfactionproblem

Uploaded by

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

Class 11 Constraintsatisfactionproblem

Uploaded by

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

Constraint satisfaction

problems (CSP)
AGENDA

 Introduction to CSP
 What is a constraint
 Crypto Arithmetic puzzles
 Constraint Domain
 CSP as a search problem
 Backtracking search for CSP
 Role of Heuristics
INTRODUCTION TO CSP

• Constraint satisfaction problems (CSPs) are mathematical questions defined


as a set of objects whose state must satisfy a number of constraints or
limitations.

• CSPs represent the entities in a problem as a homogeneous collection of finite


constraints over variables, which is solved by constraint satisfaction methods.

• It is a search procedure that operates in a space of constraints.

• Any problem in the world can mathematically be represented as CSP.

• The solution is typically a state that can satisfy all the constraints.
csp

• A constraint satisfaction problem (CSP) consists of

– a set of variables,

– a domain for each variable, and

– a set of constraints.

• The aim is to choose a value for each variable so that the resulting possible

world satisfies the constraints; we want a model of the constraints.


CONSTRAINT

• It is mathematical/logical relationship among the attributes of one or more


objects.

• It is important to know the type of constraint.

– Unary Constraint - single variable.

– Binary Constraint - two variable.

– Higher order Constraint - 3 or more variables.

• Constraints can restrict the values of variables.


Real-World CSP’s

•  Assignment problems

– e.g., who teaches what class

•  Timetabling problems

– e.g., which class is offered when and where?

•  Transportation scheduling

•  Factory scheduling
Crypt Arithmetic Puzzles

 Constraints:

 1. Variables: can take values from 0-9

 2. No two variables should take same value

 3. The values should be selected such a way that it should comply


with arithmetic properties.
Rules for CSP problem

• There should be a unique digit to be replaced with a unique


alphabet.
• The result should satisfy the predefined arithmetic rules, i.e., 2+2
=4, nothing else.
• Digits should be from 0-9 only.
• There should be only one carry forward, while performing the
addition operation on a problem.
• The problem can be solved from both sides, i.e., left hand side
(L.H.S), or right hand side (R.H.S)
problem

 Given a cryptarithmetic problem,

 i.e., S E N D + M O R E = M O N E Y

 In this example, add both terms S E N D and M O R E to bring


M O N E Y as a result.
Step 1

 Starting from the left hand side (L.H.S) , the terms are S and M.
Assign a digit which could give a satisfactory result.
 Let’s assign S->9 and M->1.

 Hence, we get a satisfactory result by adding up the terms and got an


assignment for O as O->0 as well.
Step 2

 Now, move ahead to the next terms E and O to get N as its output.

 Adding E and O, which means 5+0=0, which is not possible


because according to cryptarithmetic constraints, we cannot assign the same
digit to two letters. So, we need to think more and assign some other value.
Step 3
 Further, adding the next two terms N and R we get,

 But, we have already assigned E->5. Thus, the above result does not satisfy the values

 because we are getting a different value for E. So, we need to think more.

 Again, after solving the whole problem, we will get a carryover on this term, so
our answer will be satisfied.
Step 4

 Again, on adding the last two terms, i.e., the rightmost


terms D and E, we get Y as its result.
result
 Final result Representation of the assignment

 of the digits to the alphabets.


Other problems
Constraint Domain

• It describes different constrainers, operators,


arguments, variables and their domains.
• It consists of:
1. Legal set of operators
2. Set of variables
3. Set of all types of functions
4. Domain variables
5. Range of variables
constraint domain is five-tuple and represented as
D={var,f,O,dv,rg}
Constraint domain

• A constraint without conjunction is referred as


primitive constraint.
• A conjunction of primitive constraints is called as
non-primitive constraints or generic constraints.
• The constraint problem can be visualized as a
constraint graph.
• nodes represents the groups and the arcs define the
constraint
• One of the prime benefits is the easier representation
of problem in the form of a standard pattern.

You might also like