G53CLP Constraint Logic Programming

Similar documents
Week 8: Constraint Satisfaction Problems

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

CS 188: Artificial Intelligence Fall 2011

Constraint Satisfaction Problems

CS 343: Artificial Intelligence

Constraint Satisfaction Problems

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Artificial Intelligence

Artificial Intelligence

CS 4100 // artificial intelligence

Constraint Satisfaction Problems

Game theory (Ch. 17.5)

Artificial Intelligence Constraint Satisfaction Problems

Constraint Satisfaction Problems

Announcements. CS 188: Artificial Intelligence Fall 2010

Constraint Satisfaction Problems

CS 188: Artificial Intelligence Fall 2008

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens

CSE 473: Artificial Intelligence

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence

Constraint Satisfaction Problems Part 2

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012

Constraint Satisfaction Problems

Discussion Section Week 1

Lecture 9 Arc Consistency

Constraint Satisfaction Problems (CSPs)

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria

Chapter 6 Constraint Satisfaction Problems

Constraint Satisfaction

Solving Problems by Searching: Constraint Satisfaction Problems

Iterative improvement algorithms. Today. Example: Travelling Salesperson Problem. Example: n-queens

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

CS W4701 Artificial Intelligence

Lecture 6: Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction. AI Slides (5e) c Lin

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018

Spezielle Themen der Künstlichen Intelligenz

Constraint Satisfaction Problems

Foundations of Artificial Intelligence

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Moving to a different formalism... SEND + MORE MONEY

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

CS 188: Artificial Intelligence Spring Announcements

Constraint Satisfaction Problems (CSPs)

Recap: Search Problem. CSE 473: Artificial Intelligence. Space of Search Strategies. Constraint Satisfaction. Example: N-Queens 4/9/2012

CS 188: Artificial Intelligence. Recap: Search

Constraint Satisfaction Problems

ARTIFICIAL INTELLIGENCE (CS 370D)

Constraint Satisfaction Problems (CSP)

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Foundations of Artificial Intelligence

Constraint Satisfaction Problems

CONSTRAINT SATISFACTION

Constraint Satisfaction Problems

Artificial Intelligence

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

Artificial Intelligence

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

CS 4100/5100: Foundations of AI

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph

General Methods and Search Algorithms

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability.

CS 188: Artificial Intelligence Fall 2008

Artificial Intelligence

CS 188: Artificial Intelligence Spring Announcements

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

constraint propagation, answer set programming CS 4100/5100 Foundations of AI

What is Search For? CS 188: Artificial Intelligence. Example: Map Coloring. Example: N-Queens. Example: N-Queens. Constraint Satisfaction Problems

CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

Outline. Best-first search

Set 5: Constraint Satisfaction Problems

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search

Mathematical Programming Formulations, Constraint Programming

Constraint Satisfaction Problems

This lecture: Convex optimization Convex sets Convex functions Convex optimization problems Why convex optimization? Why so early in the course?

AI Fundamentals: Constraints Satisfaction Problems. Maria Simi

Circuit analysis summary

1 Inference for Boolean theories

Set 5: Constraint Satisfaction Problems Chapter 6 R&N

Introduction to Algorithms. Lecture 24. Prof. Patrick Jaillet

Constraint (Logic) Programming

05 - Constraints Programming

CONSTRAINT Networks Chapters 1-2

Steven Skiena. skiena

Constraint Satisfaction Problems

CS 188: Artificial Intelligence Fall 2011

Transcription:

G53CLP Constraint Logic Programming Dr Rong Qu Constraint Satisfaction Problems

An Example Map coloring A region in a map has several sub-regions Given a set of colors Assign each sub-region a color so that no adjacent sub-regions have the same color 2

An Example Map coloring Can we use 3 colors to color the map below (Australia)? How about 100 sub-regions? WA NT SA Q NSW V T 3

An Example Map coloring The above map can be modelled as a graph WA NT Q NT Node: sub-region Q WA Edge: constraint (adjacency) SA Problem modelled NSW as graph coloring: adjacent Vnodes have different colors T SA V NSW T 4

CSP Definition A constraint satisfaction problem (CSP) consists of a set of variables {x 1, x 2, x i }; a finite set of domain D (possible values) associated with each variable; a set of constraints C restricting the values that the variables can simultaneously take CSP is to assign values to variables so that all constraints are satisfied 5

CSP - Domain The domain of a variable is a set of possible values that can be assigned to the variable Finite domain vs. infinite domain {1 500} {red, green, blue} {yes, no} Temperatures In this module we consider the CSPs with finite domains 6

CSP - Domain The domain of a variable is a set of possible values that can be assigned to the variable Discrete vs. continuous {1 500} Temperatures 7

CSP - Domain The domain of a variable is a set of possible values that can be assigned to the variable Different types Boolean: {yes, no} Symbols: {red, green, blue} Reals: Time of days, Temperatures Integers: 1, 2, 500 8

CSP - Constraints Properties of objects and relations between them Formulated as predicates in logic A constraint on a set of variables Restriction on the values the variables can simultaneously take What values are (dis-)allowed among the variables 9

CSP - Constraints Examples of constraints The demand will be more than five thousands units in August Optimise the benefit of products John prefer to work at only weekends Schedule these employees to cover all shifts 10

CSP - Constraints Constraint is a set of relations upon domains of variables Functions Matrices Inequalities x 1 x 2 or x 1 < x 2 3x + 6y = 0, y + x < 7 alldifferent(x,y,z) 11

CSP - Constraints Formal definition A constraint C i,j,k is a subset of possible relations between values of variables x i, x j, x k,...; C i,j,k is a subset of D i D j D k 12

CSP - Constraints Types of constraints Unary: affects only one variable x >= 1, WA = green Binary: affects two variables x >= y, WA NT High-order: affects more than two variables alldifferent(wa, NT, Q) x = y = z 13

CSP - Constraints How the values of one variable restrict those of the others 3x + 6y = 0 x є {0, 1, 2, 3}, y є {-2, -1, 0} x > y x = 2, y = -1 x = 0, y = 0? 14

CSP - Constraints Redundant constraints One constraint C1 implies another constraint C2, C1 C2 Solutions of C1 are a subset of the solutions of C2 x <3 & x < 4 C1 and C1 Λ C2 are equivalent Equivalent constraints Two constraints C1 and C2 are equivalent if they have the same set of solutions 15

CSP - Constraints Simplification of constraints Replace a constraint by an equivalent constraint which has a simpler form Problem is easier to understand Information of original form is more apparent 16

CSP - Solutions A solution to a CSP is an assignment of each variable with a value (within its domain), such that all constraints C are satisfied if a CSP has a feasible solution find one (any) solution all solutions 17

CSP - Solutions Often we not only want a CSP solution but also the best one (optimal solution) Constraint Optimisation Problems (COP) Objective function: to measure how good a solution is 18

CSP Other Definitions Label a variable-value pair representing assigning the value to the variable Compound label the finite set of labels representing simultaneous assignments 19

CSP Other Definitions Projection(N,M) m and n are integers, m <=n n-compound label N m-compound label M M is a projection of N if labels in M all appear in N (<a,1><c,3>) is a projection of (<a,1><b,2><c,3>) Projection ((<a,1><b,2><c,3>), (<a,1><c,3>)) is true 20

CSP Other Definitions Satisfiable a CSP (V,D,C) is satisfiable iff there is a compound label assigning values to all variables V that satisfy all constraints C A solution can then be defined as A compound label for all variables which satisfy all the constraints 21

CSP Other Definitions Binary CSP With only unary and binary constraints Other definitions may be introduced in the context of the module 22

CSP Example I Variables {WA, NT, Q, SA, NSW, V, T} WA SA NT NSW Q Domains {red, green, blue} V T Constraints {not_same(wa,nt), not_same(wa, SA), not_same(nt,sa), } 23

CSP Example I WA NT Q SA NSW V T The above formulate the map coloring problem into a CSP Solution {WA=red, NT=green, SA=blue, Q=red, NSW=green, V=red, T=red} 24

CSP Example I WA = red is a label The problem is satisfiable. 25

CSP Example I The above solution using 3 colors Is actually an optimal solution (using the least colors) There are more than one solution For example, given 7 colors We ll have 7! solutions for the problem 26

CSP Example I Graph coloring is NP-Hard (Karp, 1972) Optimal solutions of least colors cannot be obtained for 90-vertice graph (Johnson, 1991) Constraint based techniques are the mostly studied early approaches 27

CSP Example II Scene labeling problem The first CSP studied In vision, scene are captured as images, and processed as lines to represent images Lines need to be interpreted into types 28

CSP Example II Scene labeling problem Types of lines Convex edges + Concave edges - Occluding edges + + - + - 29

CSP Example II Scene labeling problem defined as CSP Variables Domains F E G I D + - A B H C 30

CSP Example II Scene labeling problem defined as CSP Constraints 31

CSP Example III Sudoku Variables Domain Constraints 6 5 2 3 9 7 6 1 6 3 4 4 7 1 5 9 8 4 1 6 3 8 2 4 5 32

CSP Real World Applications Graph layout Natural language processing Molecular biology / genomics Optimization Machine vision Scheduling Resource allocation Theorem proving Building design Planning 33

Summary Constraint satisfaction problems Examples map coloring, scene labeling Defining a CSP Variables Domain Constraints Other definitions Solutions, compound label, projection 34