Download presentation

Presentation is loading. Please wait.

Published byJase Rice Modified over 2 years ago

1
Constraint Satisfaction taking advantage of internal structure of states when paths don’t matter

2
D Goforth - COSC 4117, fall 20032 Constraint satisfaction problems (CSPs) no prescribed start state path does not matter acceptable states must satisfy constraints functions of state variables among acceptable states, goal states will optimize an objective function

3
D Goforth - COSC 4117, fall 20033 Example problem – timetable of university (1) state - collection of schedule objects schedule professor(~10 2 ) (~350 at LU) course (~10 3 ) time slot (~10) (16 at LU) location (~10 2 ) constraints objective function

4
D Goforth - COSC 4117, fall 20034 Example problem – timetable of university (2) constraints professors assigned to courses one course per location per time slot location capacity >= course (projected) enrollment professors assigned only once per time slot rooms assigned only once per time slot courses in program in different time slots

5
D Goforth - COSC 4117, fall 20035 Example problem – timetable of university (3) objective function minimize total course enrollment in early morning time slots distribute program courses across days concentrate professor assignments on same day accommodate special requests

6
D Goforth - COSC 4117, fall 20036 Solving CSPs analysis of problem state structure is critical two basic approaches: start state is null: assign state variables one at a time and backtrack if constraint is violated assign variables ‘randomly/intelligently’ to make a start state and use greedy search by changing variable assignments

7
D Goforth - COSC 4117, fall 20037 Example problem – timetable of university (4) analyzing the problem e.g. fix time slots for all weekly sessions of a course (tutorials?) problem solving approaches allocate courses to rooms and times one after the other assign all courses then start moving those involved in constraint violations

8
D Goforth - COSC 4117, fall 20038 CSP – problem definition state representation (R&N) state variables X 1, X 2, …, X n X i from domain D i constraints C 1, C 2, …, C m Cj are functions of Xi (unary, binary, … fns) solution – assignment of values v i to all X i so all constraint functions C j are satisfied objective function – optimized function of X i over solution set

9
D Goforth - COSC 4117, fall 20039 Example problem – timetable of university (4) variables: array of assignments of courses (c k ) to locations (loc i )and time (t j ) slots c k :prof,enroll,prog loc i : capacity t j : time, day A[loc,t] = c k constraints: loc.capacity >= c.enroll (unary) if (loc i1 != loc i2 ) A[loc i1,t j ].prof != A[loc i2,t j ].prof

10
D Goforth - COSC 4117, fall 200310 Modelling a state as constraint graph variables are nodes loc 1: 25loc 2: 100 t 1 t 2 t 3 c 1:Ann20 c 2:Ben45 c 3:Cec 15 c 4:Ben80 c 5:Ann90

11
D Goforth - COSC 4117, fall 200311 Modelling a state as constraint graph unary constraints reduce domains loc 1: 25loc 2: 100 t 1 t 2 t 3 c 1:Ann20 c 2:Ben45 c 3:Cec 15 c 4:Ben80 c 5:Ann90 for A(loc 1, t) {c 1,c 3 } for A(loc 2, t) {c 1,c 2,c 3,c 4,c 5 }

12
D Goforth - COSC 4117, fall 200312 Modelling a state as constraint graph binary constraints are edges loc 1: 25loc 2: 100 t 1 t 2 t 3 c 1:Ann20 c 2:Ben45 c 3:Cec 15 c 4:Ben80 c 5:Ann90 for A(loc 1, t) {c 1,c 3 } for A(loc 2, t) {c 1,c 2,c 3,c 4,c 5 } A[loc 1,t j ].prof != A[loc 2,t j ].prof

13
D Goforth - COSC 4117, fall 200313 Modelling a state as constraint graph multiple constraints are ‘hubs’ loc 1: 25loc 2: 100 t 1 t 2 t 3 c 1:Ann20 c 2:Ben45 c 3:Cec 15 c 4:Ben80 c 5:Ann90 for A(loc 1, t) {c 1,c 3 } for A(loc 2, t) {c 1,c 2,c 3,c 4,c 5 } each course in one slot only

14
D Goforth - COSC 4117, fall 200314 Variable domains discrete finite discrete infinite continuous Domains may be distinct or shared among variables (typical)

15
D Goforth - COSC 4117, fall 200315 Constraints enumerations of possible combinations functions of variables linear, non-linear, … unary, binary,…

16
D Goforth - COSC 4117, fall 200316 Solution by incremental formulation initial state – no variable assigned successor function for transition: pick a variable and set a value that does not conflict with previous assignments by applying constraint functions goal – all variables assigned

17
D Goforth - COSC 4117, fall 200317 Solution by incremental formulation advantage depth of search is limited to number of variables in state depth limited dfs is natural algorithm ‘backtracking search’

18
Backtracking search loc 1: 25 loc 2: 100 c 1:Ann20 c 2:Ben45 c 3:Cec 15 c 4:Ben80 c 5:Ann90 c 5c 1c 5 c 1 c 5

19
D Goforth - COSC 4117, fall 200319 Efficient Backtracking search (1) Forward checking - Propagate constraints when variable is assigned, use constraints to reduce value sets of remaining variables e.g. when course is assigned: remove course from domain of all remaining variables remove courses with same prof from allocations in same time slot

20
D Goforth - COSC 4117, fall 200320 Efficient Backtracking search (2) Variable ordering – which variable to assign a value next? MRV heuristic – pick most constrained variable (minimum remaining values) e.g. – book small room first degree heuristic – pick variable involved in most constraints (propagates and prunes most)

21
D Goforth - COSC 4117, fall 200321 Efficient Backtracking search (3) Value ordering: once variable is selected, which value to try first? least constraining value heuristic – pick value that reduces value sets of remaining variables the least e.g. when assigning a course: pick location with smallest capacity that will accommodate the course (risk?)

22
D Goforth - COSC 4117, fall 200322 Efficient Backtracking search (4) Arc consistency: stronger constraint propagation check for consistency between variables after value is set forward checking remove variables arc consistency ?

23
D Goforth - COSC 4117, fall 200323 Efficient Backtracking search (5) k-consistency: extending arc- consistency forward checking remove variables arc consistency

24
D Goforth - COSC 4117, fall 200324 Norvig and Russell example chapter04b.ps

25
D Goforth - COSC 4117, fall 200325 DFS ‘chronological’ backtracking when search fails X6 (no value can be set for variable) back up one level, try again v 5 v 5 useless IF no constraint between X 5, X 6 X1 X2 X3 X4 X5 X6

26
D Goforth - COSC 4117, fall 200326 DFS backjumping when search fails X6 (no value can be set for variable) look at conflict set of X6 {X3, X1} jump back to change v3 v3 X1 X2 X3 X4 X5 X6

27
D Goforth - COSC 4117, fall 200327 Solution by local search start state has values for every variable state variables X 1 =v 1, X 2 =v 2, …, X n =v n constraints C 1, C 2, …, C m some satisfied, some violated objective function not optimized successor function changes one or more variables – evaluate to minimize conflicts

28
D Goforth - COSC 4117, fall 200328 Solution by local search timetable example: start state – assign all courses to room/time slot change assignments to reduce conflicts

29
D Goforth - COSC 4117, fall 200329 advantages of local search solves some problems very fast flexible in online situations – revised conditions can be re-solved with minimal changes e.g. course enrollment projections turn out to be wrong – conflicts with room sizes takes advantage of any known partial solutions installed in start state

30
D Goforth - COSC 4117, fall 200330 Constraint graph structure independent variables (unary constraints only) easy but rare tree graphs – process variables in top-down order from any node as root general graphs – may be reducible (by removing and assigning some nodes) to trees general graphs – may be reducible by clustering into subgraphs

31
D Goforth - COSC 4117, fall 200331 Examples crossword puzzle construction p.158 #5.4 cryptarithmetic puzzle – section 5.2 other example Sudoku puzzle

32
Sudoku constraints From rules Constraints on all cells: For rows, columns, squares Every integer occurs No integer is repeated From data (particular game) Constraints on some cells Specific value Underconstrained – many solutions Overconstrained – no solutions 123456789y123456789y x|A B C D E F G H I 1 2 3 4 5 6 7 8 9 c B3

Similar presentations

OK

CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS 3243 - Constraint Satisfaction 1 Constraint Satisfaction Problems.

CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS 3243 - Constraint Satisfaction 1 Constraint Satisfaction Problems.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google