Constraint Programming Peter van Beek University of Waterloo.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Non-binary Constraints Toby Walsh
Constraint-based problem solving n Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains.
Maximal Independent Subsets of Linear Spaces. Whats a linear space? Given a set of points V a set of lines where a line is a k-set of points each pair.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours 12.
Constraint Satisfaction Problems Russell and Norvig: Chapter
University of Toronto Mechanical & Industrial Engineering An Introduction to Constraint Programming J. Christopher Beck Dept. of Mechanical & Industrial.
Global Constraints Toby Walsh NICTA and University of New South Wales
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) Oct, 5, 2012.
Constraint Satisfaction Problems (Chapter 6). What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search.
Constraint Satisfaction Problems
Backward Checking Search BT, BM, BJ, CBJ. An example problem Colour each of the 5 nodes, such that if they are adjacent, they take different colours.
Distributed Constraint Satisfaction Problems M OHSEN A FSHARCHI.
5 x4. 10 x2 9 x3 10 x9 10 x4 10 x8 9 x2 9 x4.
Parallel algorithms for expression evaluation Part1. Simultaneous substitution method (SimSub) Part2. A parallel pebble game.
DIRECTIONAL ARC-CONSISTENCY ANIMATION Fernando Miranda 5986/M
Constraint Satisfaction taking advantage of internal structure of states when paths don’t matter.
Constraint Networks (cont.) Emma Rollón Postdoctoral researcher at UCI April 1st, 2009.
Maintaining Arc Consistency We have a constraint graph G of variables X 1,...X n, and constraint relations {X i  X j}, and each Xi has a value set V (X.
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.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Constraint Processing and Programming Introductory Exemple Javier Larrosa.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction Problems
CS460 Fall 2013 Lecture 4 Constraint Satisfaction Problems.
Constraint Satisfaction Problems
Constraint Satisfaction Problems
© J. Christopher Beck Lecture 13: Modeling in Constraint Programming.
N Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
Chapter 5 Constraint Satisfaction Problems
Constraint Satisfaction Problems (Chapter 6)
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (Chapter 6)
Hard Problems Some problems are hard to solve.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction
Constraint Satisfaction
Design and Analysis of Algorithm
CS 188: Artificial Intelligence
Constraint Propagation
Chapter 3: Finite Constraint Domains
Constraint Satisfaction Problems
Constraints and Search
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
Constraint Satisfaction
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Presentation transcript:

Constraint Programming Peter van Beek University of Waterloo

Applications n Reasoning tasks: ä abductive, diagnostic, temporal, spatial n Cognitive tasks: ä machine vision, natural language processing n Combinatorial tasks: ä scheduling, sequencing, planning

Constraint Programming n CP = solve problems by specifying constraints on acceptable solutions n Why CP? ä constraints often a natural part of problems ä once problem is modeled using constraints, wide selection of solution techniques available

Constraint-based problem solving n Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language n Solve model ä define search space / choose algorithm –incremental assignment / backtracking search –complete assignments / stochastic search ä design/choose heuristics n Verify and analyze solution

n Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language n Solve model ä define search space / choose algorithm –incremental assignment / backtracking search –complete assignments / stochastic search ä design/choose heuristics n Verify and analyze solution Constraint-based problem solving Constraint Satisfaction Problem

Constraint satisfaction problem n A CSP is defined by ä a set of variables ä a domain of values for each variable ä a set of constraints between variables n A solution is ä an assignment of a value to each variable that satisfies the constraints

n Model problem ä specify in terms of constraints on acceptable solutions ä define variables (denotations) and domains ä define constraints in some language n Solve model ä define search space / choose algorithm –incremental assignment / backtracking search –complete assignments / stochastic search ä design/choose heuristics n Verify and analyze solution Constraint-based problem solving

Example: Assembly line sequencing n What order should the cars be manufactured? n Constraints: ä even distributions ä changes in colors ä run length constraints

Example: Scheduling What is the earliest that they can all set of for school? Four students, Algy, Bertie, Charlie, and Digby share a flat. Four newspapers are delivered. Each student reads the newspapers in a particular order and for a specified amount of time. Algy arises at 8:30, Bertie and Charlie at 8:45, Digby at 9:30.

Schedule Sun 8 am91011 Express Guardian FT

Example: Graph coloring Given k colors, does there exist a coloring of the nodes such that adjacent nodes are assigned different colors

Example: 3-coloring Variables: v 1, v 2, v 3, v 4, v 5 Domains: {1, 2, 3} Constraints: v i v j if v i and v j are adjacent v2v2 v3v3 v1v1 v5v5 v4v4

Example: 3-coloring One solution: v 1 1 v 2 2 v 3 2 v 4 1 v 5 3 v2v2 v3v3 v1v1 v5v5 v4v4

Example: Boolean satisfiability Given a Boolean formula, does there exist a satisfying assignment (an assignment of true or false to each variable such that the formula evaluates to true)

Example: 3-SAT Variables: x 1, x 2, x 3, x 4, x 5 Domains: {True, False} Constraints: ( x 1 x 2 x 4 ), ( x 2 x 4 x 5 ), ( x 3 x 4 x 5 ) ( x 1 x 2 x 4 ) ( x 2 x 4 x 5 ) ( x 3 x 4 x 5 )

Example: 3-SAT One solution: x 1 False x 2 False x 3 False x 4 True x 5 False ( x 1 x 2 x 4 ) ( x 2 x 4 x 5 ) ( x 3 x 4 x 5 )

Example: n-queens Place n-queens on an n n board so that no pair of queens attacks each other

Example: 4-queens x1 x1 x2x2 x3 x3 x4 x4 Variables: x 1, x 2, x 3, x 4 Domains: {1, 2, 3, 4} Constraints: x i x j and | x i - x j | | i - j |

Example: 4-queens One solution: x 1 2 x 2 4 x 3 1 x x1 x1 x2x2 x3 x3 x4 x4 Q Q Q Q

Search tree for 4-queens x1 x1 x2x2 x3 x3 x4 x (1,1,1,1)(4,4,4,4)(2,4,1,3)(3,1,4,2)

Specification of forward checking Invariant:1 i c, c j n, ( x j, x i ) is arc-consistent x1 x1 x c-1 xc xc x c+1 xn xn currentpastfuture

Forward checking {2}{5} Q Q Q {3} {1,4,6} {1,3,4} {3,4,6} x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x x1 x1 x5 x5 x6x6 x3 x3 x4 x4 x2x2 1

Enforcing arc-consistency {a, b, c} < xi xi xj xj

Enforcing path-consistency < {a, b, c} xi xi xj xj xk xk < <

Search graph for 4-queens (1,1,1,1) (1,1,4,2) (2,4,1,3) (3,1,4,2) (1,1,1,2) (1,1,1,3) (1,1,1,4) (1,4,1,3) (4,1,4,2)

Stochastic search Q Q Q x1 x1 Q Initial assignment x2 x2 x3 x3 x4 x4 112 Pick queen in conflict Q Q Q x1 x1 Q x2 x2 x3 x3 x4 x4 Move to min. conflicts Q Q Q x1 x1 Q x2 x2 x3 x3 x4 x4 02 Pick queen in conflict Q Q Q x1 x1 Q x2 x2 x3 x3 x4 x4 2

Tractability NP NP-Complete P (SAT, TSP, ILP, CSP, …)

Reducibility NP-Complete 3-SAT ILP CSP binary CSP (0,1)-ILP

CSP, binary CSP, SAT, 3-SAT, ILP,... n Model and solve in one of these languages n Model in one language, translate into another to solve Options