Presentation is loading. Please wait.

Presentation is loading. Please wait.

Thursday, 07 January 2016Edward Tsang (Copyright)1 Constraint Satisfaction for Decision Making Professor Edward Tsang University of Essex URL:

Similar presentations


Presentation on theme: "Thursday, 07 January 2016Edward Tsang (Copyright)1 Constraint Satisfaction for Decision Making Professor Edward Tsang University of Essex URL:"— Presentation transcript:

1 Thursday, 07 January 2016Edward Tsang (Copyright)1 Constraint Satisfaction for Decision Making Professor Edward Tsang University of Essex URL: http://www.bracil.net/CSP/

2 Thursday, 07 January 2016Edward Tsang (Copyright)2 Constraint Satisfaction A non-technical introduction

3 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 3 Sample Constraint Applications Resources Allocation –Staff rostering, timetabling –British Telecom’s work force scheduling –British Airway’s flight scheduling Transportation –ILOG Dispatcher for vehicle routing –Train and bus scheduling –Collective transportation Logistics –Satellite scheduling –Radio links assignment (military & mobiles) –Telephone Network routing –Airport / container port Industrial Scheduling –Just-in-time scheduling –Hardware configuration –Car sequencing

4 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 4 Car Sequencing Problem Options ABS CD …   30203040 Total: 120 Production: ABS area:  3/5 CD area:  2/3

5 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 5 Airline Applications Constraint satisfaction and optimization are behind many applications in airline operations; e.g. British Airways uses ECLiPSe (IC-Parc) for scheduling aircraft to serve their flights and ILOG Solver for aircraft stand allocation at airports.

6 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 6 Transportation Constraint satisfaction is one of the core technologies in transportation optimization. For example Guided Local Search was used in ILOG Solver’s vehicle routing package, Dispatcher. Cairo/Line schedule for collective transportation.

7 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 7 BT’s Workforce Scheduling BT has many jobs to be done in UK every day. It has to schedule a large number of teams to serve these jobs, subject to time, skill and other constraints. Saving of 0.5% could mean Millions of Pounds per year. Guided Local Search achieved the best results in one of BT’s challenge problems. Technicians Jobs

8 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 8 CP in Steel Industry IBM helped Korea’s biggest steel manufacturer to apply constraint technology to schedule its production to meet orders. This include the allocation of existing stocks to orders, subject to various constraints, such as size, quality and colour, in order to minimize waste and cost. OrdersSteel Slabs

9 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 9 What is Constraint Satisfaction? Constraint satisfaction is a decision problem –You are given a number of decisions to make –For each decision, you are given all the choices –Decisions constrain each other Your task is to make those decisions without violating any of the constraints Sometimes you want the “best” solution –If so, you have a (constrained) optimisation problem

10 PRCSLSF The Constraint Satisfaction Problem Constraint satisfaction is a decision problem Task: make decisions without violating constraints Sometimes you want the “best” solution October 2003Edward Tsang (Copyright) 10 Variables (Decisions) Domains (values available) Constraints On assignments x1x1 x2x2 x3x3 x4x4 X X X X

11 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 11 Why constraint satisfaction? It is a very general problem (seen everywhere) –Mainly logistics, scheduling, resources allocation Specialized methods available Now multi-million Pounds/Dollars business Scientific challenges: –Combinatorial explosion (fundamental problem) –Modelling (engineering problem)

12 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 12 Combinatorial Explosion of the Car Sequencing Problem Schedule 30 cars: –Search space: 30 factorial  10 32 leaf nodes Generously allow: –Explore one in every 10 10 leaf nodes! –Examine 10 10 nodes per second! Problem takes over 32 thousand years to solve!!! –10 32 ÷ 10 10 ÷ 10 10 ÷ 60 ÷ 60 ÷ 24 ÷ 365  31,710 How to contain combinatorial explosion?

13 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 13 Combinatorial Explosion in the Car Sequencing Problem 120 cars of four models, 30, 30, 20, 40 each Number of combinations (size of search space): 120! ÷ (30! x 30! x 20! x 40!)  10 67 Let one processes 10 5 combinations per second Let a clever algorithm evaluates only one in every 10 10 combinations The problem will take 10 52 seconds, or 10 44 years to solve by brute force search – clearly infeasible

14 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 14 Use The Force Constraints brought the problem here Constraints guide us to solutions Experts will follow the lead by constraints See Guided Local Search later The Incentive Method was used in financial forecasting and bargaining Reference to Daoism (Taoism) http://www.bracil.net/edward/library/Zhuangzi-cook

15 Thursday, 07 January 2016Edward Tsang (Copyright)15 Constraint Satisfaction A more technical account

16 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 16 Constraint Satisfaction: What is it all about? Many problems involve finding combinations of values to variables, e.g. –Telecom services scheduling –Deciding where to put warehouses Combinatorial problems are hard in nature How big a problem can one solve? Constraint research aims to extend our boundaries in these problems –It’s all about algorithms, efficiency, problem solving …

17 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 17 Combinatorial Explosion 1 2 3 4 5 6 7 8 ABCD EFG H 124816 3264 128 10 19 Put 1 penny in square 1 2 pennies in square 2 4 pennies in square 3, etc. Even the world’s richest man can’t afford it –10 19 p = £100,000,000 Billion

18 Thursday, 07 January 2016Edward Tsang (Copyright)18 Problem Formulation (Modelling) Is my problem a constraint satisfaction problem? If so, I can apply established techniques

19 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 19 What is constraint satisfaction? Given: Z: a set of variable (Decisions) D: mapping each variable x to a domain Dx (fixed choices) C: constraints restricting the values that variables can take simultaneously Task: Assign one value to each variable satisfying all the constraints

20 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 20 1 2 3 4 5 6 7 8 ABCD EFG H The 8-Queens Constraint Satisfaction Problem Task: to put 8 queens onto the board such that no queen attacks others No two queens appear in the same row, column and diagonal Sample Solution

21 Constraint Techniques Overview 1. Problem ReductionProblem Reduction –To reduce domain size –To add or tighten constraints –Aims: To reduce a problem to easier ones To detect dead-ends To achieve backtrack- free search 2. Search Systematic Search –LookaheadLookahead –Learning nogoods or backtrack intelligently at dead-endsLearning nogoods backtrack intelligently at dead-ends –Ordering heuristicsOrdering heuristics Aim: to exhaustively search space Stochastic methods –To repair solutions heuristically Aim: to find solutions fast, sacrificing completeness 3. (Solution Synthesis)Solution Synthesis Constraint satisfaction Constrained optimisation

22 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 22 1 2 3 4 5 6 7 8 ABCD EFG H Backtracking Search In The 8-Queens Problem Place one queen per row Place one queen at a time Examine each column Backtrack at dead-ends X Complete search, till solution found, or “no solution” is concluded

23 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 23 1 2 3 4 5 6 7 8 ABCD EFG H Forward Checking Search Problem reduction –a major technique Combined with search methods Reduce domain of future variables Detect dead-ends –To backtrack early X X X X X X X X X X X X X X X X X X X X X X X X X XX X X X X X X X X X X Dead-end detected after Queen 4 – no legal space for row 6, backtrack…

24 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 24 Constraint Optimization Constraint Satisfaction & Optimization –Some solutions are better than others Partial Constraint Satisfaction –Accept best solution when no solution is found Relevant techniques: –Complete: Branch & Bound –Incomplete: HC, SA, Tabu, NN, GA, GLS

25 Thursday, 07 January 2016Edward Tsang (Copyright)25 Problem Reduction for Constraint Satisfaction Motivations: 1. Reduce problem to easier problems 2. Detect unsatisfiability

26 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 26 Problem Reduction Overview Node-consistency (NC) Arc-consistency (AC) Path-consistency (PC) (strong) k-consistency(strong) k-consistency Directional Arc-consistency (DAC) Other Consistency Properties (not covered) –Directional PC, Adaptive consistency,...

27 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 27 Node-consistency Principle of NC: –If unary constraint C x exists for variable x –Remove any value v from D x if v does not satisfy C x E.g. D x : days of the week; C x : this job must be done in weekdays Simple pre-processing strategy Cheap to compute: O(n)

28 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 28 Maintaining AC, Example Variables: x, y, z Domains: {1, 2, 3, 4} Constraints: x < y ; y < z x1234 y1234 z1234 x not supported by y and not supported by x X y not supported by z and & not supported by y X X XX Re-check x as now (with gone) it has no support from y X

29 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 29 Example: AC but Unsatisfiable This problem is AC But unsatisfiable Can we detect unsatisfiability? X YZ {r, g}   

30 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 30 Path-consistency Principle: –Tightening constraints –By constraint composition Algorithms: PC-1, …, PC-4 Complexity manageable: O(a 3 n 3 ) Is effort justifiable?

31 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 31 Binary Constraint Representation A Binary constraint may be represented by a matrix, e.g.: D x = D y = D z = {1, 2, 3} C xy : X + Y must be even C xz : at least one of X and Z must be equal to 2 x yz {1, 2, 3} Even(X+Y) Even(Y+Z) X=2  Z=2

32 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 32 Constraint Composition Constraint C xy & C yz could tighten C xz C xz = C xz  C xy * C yz x yz {1, 2, 3} Even(X+Y) Even(Y+Z) X=2  Z=2 010 111 010 101 010 101 101 010 10 1  * = 101 010 101 000 010 00 0  = = 010 111 010

33 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 33 PC Detecting Unsatisfiability Given ( ), which satisfies C x,y It has no compatible value in z Hence not PC x yz {r, g}   

34 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 34 Example: PC but Unsatisfiable Problem is PC But unsatisfiable Can we detect unsatisfiability?  Z {r, g, b}     X W Y

35 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 35 Problem Reduction, Summary Aim: reduce problem to one that is easier to solve, or detect dead-ends Concept is simple, procedures could be complex General Concept: k-consistency –NC  1-C, AC  2-C, PC  3-C for binary CSPs NC & AC potentially reduce domains PC potentially tightens binary constraints k-C for k>2 potentially tightens k-1 constraints

36 Thursday, 07 January 2016Edward Tsang (Copyright)36 Complete Search Algorithms for Constraint Satisfaction Lookahead Gather-information-while-searching

37 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 37 Complete Search Strategies Overview Preprocessing –Problem reduction; problem transformation General Search –Chronological backtrackingChronological backtracking Lookahead –Forward Checking, DAC- & AC-LookaheadForward CheckingDAC-AC-Lookahead Gather-information-while-searching –DDBT, Learning Nogoods, BackmarkingDDBTLearning NogoodsBackmarking Hybrids, e.g. FC-BM-CBJ

38 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 38 Pre-processing – before search begins Problem reduction –1-consistency is always worth achieving –How about 2-consistency? 3-consistency? Problem transformation –Should redundant constraints be added? With A < B, B < C, would adding A < C help? –Should the problem be decomposed into sub- problems? Some sub-problems may be tractable E.g. cycle-cutset

39 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 39 1 2 3 4 5 6 7 8 ABCD EFG H Backtracking Search In The 8-Queens Problem Place one queen per row Place one queen at a time Examine each column Backtrack at dead-ends X Complete search, till solution found, or “no solution” is concluded

40 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 40 Lookahead Algorithms Lookahead so as to detect failure asap Reduce remaining problem More reduction requires more computation Does marginal gain justify marginal cost? MAC-Lookahead is effective in general –Key: to record support in maintaining AC

41 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 41 Forward Checking Algorithm FC: –Label one variable at a time –After each label is committed to: examine every future variable y remove every value v y from D y such that is incompatible with –Backtrack if any future domain becomes empty Found to be quite effective in general

42 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 42 1 2 3 4 5 6 7 8 ABCD EFG H Forward Checking Search Problem reduction –a major technique Combined with search methods Reduce domain of future variables Detect dead-ends –To backtrack early X X X X X X X X X X X X X X X X X X X X X X X X X XX X X X X X X X X X X Dead-end detected after Queen 4 – no legal space for row 6, backtrack…

43 Thursday, 07 January 2016Edward Tsang (Copyright)43 Stochastic Search Stochastic Search An element of randomness and statistics Hill ClimbingHill Climbing: Min-conflict, GSAT *Min-conflictGSAT Metaheuristic SearchMetaheuristic Search: GENET, GLS *, GGA *GENETGLSGGA * Note: not in Tsang 1993

44 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 44 Why Stochastic Search? Schedule 30 jobs to 10 machines: –Search space: 10 30 leaf nodes Generously allow: –Explore one in every 10 10 leaf nodes! –Examine 10 10 nodes per second! Problem takes 300 years to solve!!! How to contain combinatorial explosion?

45 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 45 Background: Local Search Ingredients: –Cost function –Neighbourhood function –[Optional] Strategy for visiting neighbours e.g. steepest ascent Problems: –local optimum –Plateau –When to stop? Ok with satisfiability But not optimization local max. global max. Cost function plateau neighbourhood Assume maximization problem

46 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 46 HC Example: 2-opting for TSP Candidate tour: a round trip route Neighbour: exchange two edges, change directions accordingly A B C E D A B C E D

47 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 47 List reversing  2-Opting List representation: –A list could represent cities in sequence 2-Opting can be seen as sub-list reversing –Easy to implement 1 3 654827 Breaking points 136 8 45 27

48 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 48 Min-conflict Heuristic Repair Start with a random complete assignment –May initialise with min-conflict heuristic Repeat until all constraints are satisfied or run out of resources: –Randomly pick a variable x that is in conflict –Pick value v in domain of x such that violates the least number of constraints break ties randomly

49 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 49 1 2 3 4 5 6 7 8 ABCD EFG H MC Heuristic Repair, Example Start with random assignments C2 attacks G6 D8 attacks E7 Randomly pick one, say, E7, to repair Count number of conflicts in each square Randomly pick a square with least attacks, say, B7 11331223 Repeat repair X X 21122432 X Solution found

50 PRCSLSF Thursday, 07 January 2016Edward Tsang (Copyright) 50 Meta-heuristics Hill Climbing e.g. 2-Opt in TSP Changing hill climbing behaviour mainly to escape local optima Tabu Search GENETGENET, GLSGLS Simulated Annealing (GGA)GGA


Download ppt "Thursday, 07 January 2016Edward Tsang (Copyright)1 Constraint Satisfaction for Decision Making Professor Edward Tsang University of Essex URL:"

Similar presentations


Ads by Google