C ONSTRAINT Networks Chapters 1-2 Compsci-275 Fall 2010 1.

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

CONSTRAINT Networks Chapters 1-2
Constraint Networks (cont.) Emma Rollón Postdoctoral researcher at UCI April 1st, 2009.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Foundations of Constraint Processing, Fall 2005 October 21, 2005CSPs and Relational DBs1 Foundations of Constraint Processing CSCE421/821, Fall 2005:
CPSC 322, Lecture 11Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Computer Science cpsc322, Lecture 11 (Textbook Chpt 4.0 – 4.2) January,
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
CONSTRAINT Networks Chapters 1-2 Compsci-275 Spring 2009 Spring
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 4.
1 Binary C ONSTRAINT P ROCESSING Chapter 2 ICS-275A Fall 2007.
1 Consistency algorithms Chapter 3. Spring 2007 ICS 275A - Constraint Networks 2 Consistency methods Approximation of inference: Arc, path and i-consistecy.
Constraint Networks ( slides courtesy of Natalia Flerova, based on slides courtesy of Rina Dechter)
4/11/03 Minute Paper How does MS window work? Like how do we have the screen on the computer. Is it just a bunch of Binary #’s representing colors? When.
Constraint Satisfaction Problem Solving Chapter 5.
Constraint Reasoning Florida Institute of Technology Computer Science.
Intro to Discrete Structures
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Introduction Chapter 0. Three Central Areas 1.Automata 2.Computability 3.Complexity.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.
DISCRETE COMPUTATIONAL STRUCTURES CS Fall 2005.
Constraint Networks Overview. Suggested reading Russell and Norvig. Artificial Intelligence: Modern Approach. Chapter 5.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Solving Constraint Satisfaction Problems (CSPs) using Search CPSC 322 – CSP 2 Textbook § January 31, 2011.
Solving Constraint Satisfaction Problems (CSPs) using Search
1 Relational Algebra and Calculas Chapter 4, Part A.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
LAC group, 16/06/2011. So far...  Directed graphical models  Bayesian Networks Useful because both the structure and the parameters provide a natural.
Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”
Chapter 5 Constraint Satisfaction Problems
DISCRETE COMPUTATIONAL STRUCTURES
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
CS 175 Project in AI. 2 Lectures: ICS 180 Tuesday, Thursday Hours: am Discussion: DBH 1300 Wednesday Hours: pm Instructor: Natalia.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
Lecture 5: Constraint Satisfaction Problems
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Problem Solving with Constraints CSPs and Relational DBs1 Problem Solving with Constraints CSCE496/896, Fall
Karnaugh Maps The minimization method using Boolean Algebra, apart from being laborious and requiring the remembering all the laws, can lead to solutions.
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
Introduction to graphical models. Outline Course goals and policies Overview of graphical models, examples Constraint networks Probabilistic networks.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (CSPs) Introduction
Constraint Satisfaction Problems (CSPs) Introduction
Constraint Satisfaction Problem
Lecture 7 Constraint Satisfaction Problems
Jaya Krishna, M.Tech, Assistant Professor
Relational Algebra 461 The slides for this text are organized into chapters. This lecture covers relational algebra, from Chapter 4. The relational calculus.
Relational Algebra 1.
Basic Logic Gates 1.
Foundations of Constraint Processing
Problem Solving with Constraints
Artificial Intelligence
Advanced consistency methods Chapter 8
Constraint satisfaction problems
Problem Solving with Constraints
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Consistency algorithms
Presentation transcript:

C ONSTRAINT Networks Chapters 1-2 Compsci-275 Fall

Class Information Instructor: Rina Dechter Days: Tuesday & Thursday Time: 11: :20 pm Class page: Fall 20102

Text book (required) Rina Dechter, Constraint Processing, Morgan Kaufmann Fall 20103

Outline Motivation, applications, history CSP: Definition, and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Outline Motivation, applications, history CSP: Definition, representation and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Graphical Models Those problems that can be expressed as: A set of variables Each variable takes its values from a finite set of domain values A set of local functions Main advantage: They provide unifying algorithms: oSearch oComplete Inference oIncomplete Inference Those problems that can be expressed as: A set of variables Each variable takes its values from a finite set of domain values A set of local functions Main advantage: They provide unifying algorithms: oSearch oComplete Inference oIncomplete Inference Combinatorial Problems MO Optimization Optimization Decision Graphical Models Combinatorial Problems

Many Examples Combinatorial Problems MO Optimization Optimization Decision x1x2x1x2 x3x3 x4x4 Graph ColoringTimetabling EOS Scheduling … and many others. Combinatorial Problems Bayesian Networks Graphical Models

Example: student course selection Context: You are a senior in college Problem: You need to register in 4 courses for the Spring semester Possibilities: Many courses offered in Math, CSE, EE, CBA, etc. Constraints: restrict the choices you can make – Unary: Courses have prerequisites you have/don't have Courses/instructors you like/dislike – Binary: Courses are scheduled at the same time – n-ary: In CE: 4 courses from 5 tracks such as at least 3 tracks are covered You have choices, but are restricted by constraints – Make the right decisions!! – ICS Graduate program ICS Graduate program Fall

Student course selection (continued) Given – A set of variables: 4 courses at your college – For each variable, a set of choices (values) – A set of constraints that restrict the combinations of values the variables can take at the same time Questions – Does a solution exist? (classical decision problem) – How many solutions exists? – How two or more solutions differ? – Which solution is preferrable? – etc. Fall

The field of Constraint Programming How did it started: – Artificial Intelligence (vision) – Programming Languages (Logic Programming), – Databases (deductive, relational) – Logic-based languages (propositional logic) – SATisfiability Related areas: – Hardware and software verification – Operation Research (Integer Programming) – Answer set programming Graphical Models; deterministic Fall

Fall Scene labeling constraint network

Fall Scene labeling constraint network

Fall dimentional interpretation of 2-dimentional drawings

The field of Constraint Programming How did it started: – Artificial Intelligence (vision) – Programming Languages (Logic Programming), – Databases (deductive, relational) – Logic-based languages (propositional logic) – SATisfiability Related areas: – Hardware and software verification – Operation Research (Integer Programming) – Answer set programming Graphical Models; deterministic Fall

Applications Radio resource management (RRM) Databases (computing joins, view updates) Temporal and spatial reasoning Planning, scheduling, resource allocation Design and configuration Graphics, visualization, interfaces Hardware verification and software engineering HC Interaction and decision support Molecular biology Robotics, machine vision and computational linguistics Transportation Qualitative and diagnostic reasoning Fall

Outline Motivation, applications, history CSP: Definitions and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Fall AB redgreen redyellow greenred greenyellow yellowgreen yellow red Example: map coloring Variables - countries (A,B,C,etc.) Values - colors (red, green, blue) Constraints: C A B D E F G A Constraint Networks A B E G D F C Constraint graph

Fall Example: map coloring Variables - countries (A,B,C,etc.) Values - colors (e.g., red, green, yellow) Constraints:ABCDE… red green red greenblue red blue green blue ………… green …………red blue red green red Constraint Satisfaction Tasks Are the constraints consistent? Find a solution, find all solutions Count all solutions Find a good solution

Information as Constraints I have to finish my class in 50 minutes 180 degrees in a triangle Memory in our computer is limited The four nucleotides that makes up a DNA only combine in a particular sequence Sentences in English must obey the rules of syntax Susan cannot be married to both John and Bill Alexander the Great died in 333 B.C. Fall

Constraint Network; Definition Fall A constraint network is: R= (X,D,C) – X variables – D domain – C constraints – R expresses allowed tuples over scopes A solution is an assignment to all variables that satisfies all constraints (join of all relations). Tasks: consistency?, one or all solutions, counting, optimization

Fall The N-queens problem The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables.

A solution and a partial consistent tuple Fall Not all consistent instantiations are part of a solution: (a)A consistent instantiation that is not part of a solution. (b) The placement of the queens corresponding to the solution (2, 4, 1,3). c) The placement of the queens corresponding to the solution (3, 1, 4, 2).

Example: Crossword puzzle Fall Variables: x 1, …, x 13 Domains: letters Constraints: words from {HOSES, LASER, SHEET, SNAIL, STEER, ALSO, EARN, HIKE, IRON, SAME, EAT, LET, RUN, SUN, TEN, YES, BE, IT, NO, US}

Fall Constraint graphs of the crossword puzzle and the 4-queens problem.

Configuration and design Want to build: recreation area, apartments, houses, cemetery, dump – Recreation area near lake – Steep slopes avoided except for recreation area – Poor soil avoided for developments – Highway far from apartments, houses and recreation – Dump not visible from apartments, houses and lake – Lots 3 and 4 have poor soil – Lots 3, 4, 7, 8 are on steep slopes – Lots 2, 3, 4 are near lake – Lots 1, 2 are near highway Fall

Example: configuration and design Fall

Configuration and design Fall Variables: Recreation, Apartments, Houses, Cemetery, Dump Domains: {1, 2, …, 8} Constraints: derived from conditions

Example: Sudoku Fall Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints Constraint propagation Variables: 81 slots Domains = {1,2,3,4,5,6,7,8,9} Constraints: 27 not-equal

Outline Motivation, applications, history CSP: Definition, representation and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Mathematical background Sets, domains, tuples Relations Operations on relations Graphs Complexity Fall

Fall Two graphical representation and views of a relation: R = {(black, coffee), (black, tea), (green, tea)}.

Operations with relations Intersection Union Difference Selection Projection Join Composition Fall

Local function where var(f) = Y  X: scope of function f A: is a set of valuations In constraint networks: functions are boolean Local Functions x1x1 x2x2 f aatrue abfalse ba bbtrue x1x1 x2x2 aa bb relation 33Fall 2010

34 Example of set operations intersection, union, and difference applied to relations.

Fall Selection, Projection, and Join operations on relations.

Local function where var(f) = Y  X: scope of function f A: is a set of valuations In constraint networks: functions are boolean Local Functions x1x1 x2x2 f aatrue abfalse ba bbtrue x1x1 x2x2 aa bb relation 36Fall 2010

Join : Logical AND: x1x1 x2x2 aa bb x2x2 x3x3 aa ab ba x1x1 x2x2 x3x3 aaa aab bba Local Functions Combination x1x1 x2x2 f aatrue abfalse ba bbtrue x2x2 x3x3 g aa ab ba bbfalse x1x1 x2x2 x3x3 h aaa true aab aba false abb baa bab bba true bbb false 37Fall 2010

Global View of the Problem x1x1 x2x2 x3x3 h aaa true aab aba false abb baa bab bba true bbb false x1x1 x2x2 aa bb x2x2 x3x3 aa ab ba x1x1 x2x2 x3x3 aaa aab bba C1C1 C2C2 Global View=universal relation The problem has a solution if the global view is not empty The problem has a solution if there is some true tuple in the global view, the universal relation Does the problem a solution? TASK 38Fall 2010

Global View of the Problem x1x1 x2x2 x3x3 h aaa true aab aba false abb baa bab bba true bbb false x1x1 x2x2 aa bb x2x2 x3x3 aa ab ba x1x1 x2x2 x3x3 aaa aab bba C1C1 C2C2 Global View What about counting? x1x1 x2x2 x3x3 h aaa 1 aab 1 aba 0 abb 0 baa 0 bab 0 bba 1 bbb 0 Number of true tuples Sum over all the tuples true is 1 false is 0 logical AND? TASK 39Fall 2010

Outline Motivation, applications, history CSP: Definition, representation and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Modeling; Representing a problems If a CSP M = represents a problem P, then every solution of M corresponds to a solution of P and every solution of P can be derived from at least one solution of M The variables and values of M represent entities in P The constraints of M ensure the correspondence between solutions The aim is to find a model M that can be solved as quickly as possible goal of modeling: choose a set of variables and values that allows the constraints to be expressed easily and concisely Fall

Representing a problemModelling Example: Magic Square Problem Arrange the numbers 1 to 9 in a 3 x 3 square so that each row, column and diagonal has the same sum. Variables and Values 1.A variable for each cell, domain is the numbers that can go in the cell 2.A variable for each number, domain is the cells where that number can go What about constraints? It’s easy to define them: x1 + x2 + x3 = x4 + x5 + x6 = … Definetely not easy … x1x2x3 x4x5x6 x7x8x9 42Fall 2010

Examples Propositional Satisfiability  = {(A v B), (C v ¬ B)} Given a proposition theory does it have a model? Can it be encoded as a constraint network? Variables: Domains: Relations: {A, B, C} D A = D B = D C = {0, 1} AB BC If this constraint network has a solution, then the propositional theory has a model 43Fall 2010

Constraint’s representations Relation: allowed tuples Algebraic expression: Propositional formula: Semantics: by a relation Fall

Constraint Graphs: Primal, Dual and Hypergraphs Fall A (primal) constraint graph: a node per variable, arcs connect constrained variables. A dual constraint graph: a node per constraint’s scope, an arc connect nodes sharing variables =hypergraph C A B D E F G

Graph Concepts Reviews: Hyper Graphs and Dual Graphs A hypergraph Dual graphs Primal graphs Factor graphs Fall

Propositional Satisfiability Fall  = {(¬C), (A v B v C), (¬A v B v E), (¬B v C v D)}.

Examples Radio Link Assignment Given a telecommunication network (where each communication link has various antenas), assign a frequency to each antenna in such a way that all antennas may operate together without noticeable interference. Encoding? Variables: one for each antenna Domains: the set of available frequencies Constraints: the ones referring to the antennas in the same communication link 48Fall 2010

49 Constraint graphs of 3 instances of the Radio frequency assignment problem in CELAR’s benchmark

Fall Scene labeling constraint network

Fall Figure 1.5: Solutions: (a) stuck on left wall, (b) stuck on right wall, (c) suspended in mid-air, (d) resting on floor.

Huffman-Clowes junction labelings (1975) Fall

Fall A combinatorial circuit: M is a multiplier, A is an adder

Examples Scheduling problem Encoding? Variables: one for each task Domains: D T1 = D T2 = D T3 = D T3 = {1:00, 2:00, 3:00} Constraints: Five tasks: T1, T2, T3, T4, T5 Each one takes one hour to complete The tasks may start at 1:00, 2:00 or 3:00 Requirements: T1 must start after T3 T3 must start before T4 and after T5 T2 cannot execute at the same time as T1 or T4 T4 cannot start at 2:00 T4 1:00 3:00 54Fall 2010

55 The constraint graph and relations of scheduling problem

Examples Numeric constraints Can we specify numeric constraints as relations? {1, 2, 3, 4} { 3, 5, 7 } { 3, 4, 9 } { 3, 6, 7 } v2 > v4 V4 V2 v1+v3 < 9 V3 V1 v2 < v3 v1 < v2 56Fall 2010

57 More examples Given P = ( V, D, C ), where Example I: Define C ? {1, 2, 3, 4} { 3, 5, 7 } { 3, 4, 9 } { 3, 6, 7 } v2 > v4 V4 V2 v1+v3 < 9 V3 V1 v2 < v3 v1 < v2

Example: temporal reasoning Give one solution: ……. Satisfaction, yes/no: decision problem Fall

Outline Motivation, applications, history CSP: Definition, representation and simple modeling examples Mathematical concepts (relations, graphs) Representing constraints Constraint graphs The binary Constraint Networks properties Fall

Fall Properties of binary constraint networks Equivalence and deduction with constraints (composition) A graph  to be colored by two colors, an equivalent representation  ’ having a newly inferred constraint between x1 and x3.

Composition of relations ( Montanari'74 ) Input: two binary relations R ab and R bc with 1 variable in common. Output: a new induced relation R ac (to be combined by intersection to a pre-existing relation between them, if any). Bit-matrix operation: matrix multiplication Fall

Equivalence, Redundancy, Composition Equivalence: Two constraint networks are equivalent if they have the same set of solutions. Composition in matrix notation Rxz = Rxy x Ryz Composition in relational operation Fall

Relations vs networks Can we represent by binary constraint networks the relations R(x1,x2,x3) = {(0,0,0)(0,1,1)(1,0,1)(1,1,0)} R(X1,x2,x3,x4) = {(1,0,0,0)(0,1,0,0) (0,0,1,0)(0,0,0,1)} Number of relations 2^(k^n) Number of networks: 2^((k^2)(n^2)) Most relations cannot be represented by binary networks Fall

The minimal and projection networks The projection network of a relation is obtained by projecting it onto each pair of its variables (yielding a binary network). Relation = {(1,1,2)(1,2,2)(1,2,1)} – What is the projection network? What is the relationship between a relation and its projection network? {(1,1,2)(1,2,2)(2,1,3)(2,2,2)}, solve its projection network? Fall

Projection network (continued) Theorem: Every relation is included in the set of solutions of its projection network. Theorem: The projection network is the tightest upper bound binary networks representation of the relation. Fall Therefore, If a network cannot be represented by its projection network it has no binary network representation

Projection network Fall Therefore, If a network cannot be represented by its projection network it has no binary Binary network representation

Partial Order between networks, The Minimal Network Fall An intersection of two networks is tighter (as tight) than both An intersection of two equivalent networks is equivalent to both

Fall The N-queens constraint network. The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables.

Fall The 4-queens constraint network: (a) The constraint graph. (b) The minimal binary constraints. (c) The minimal unary constraints (the domains). Solutions are: (2,4,1,3) (3,1,4,2)

The Minimal vs Binary decomposable networks The minimal network is perfectly explicit for binary and unary constraints: – Every pair of values permitted by the minimal constraint is in a solution. Binary-decomposable networks: – A network whose all projections are binary decomposable – Ex: (x,y,x,t) = {(a,a,a,a)(a,b,b,b,)(b,b,a,c)}: is binary representeble? and what about its projection on x,y,z? – Proposition: The minimal network represents fully binary- decomposable networks. Fall