15 july 2005edward tsang (copyright)1 constraint satisfaction and optimization professor edward...

22
15 July 2005 Edward Tsang (Copyright) 1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL: http://cswww.essex.ac.uk/CSP/

Upload: gavin-moore

Post on 13-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 1

Constraint Satisfaction and Optimization

Professor Edward TsangUniversity of Essex

URL: http://cswww.essex.ac.uk/CSP/

Page 2: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 2

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 a (finite) number of

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

Page 3: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 3

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)

Page 4: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 4

Sample Constraint Applications• Resources Allocation

– Staff rostering, timetabling– British Telecom’s work fo

rce scheduling– British Airway’s flight sch

eduling

• 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

Page 5: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 5

Car Sequencing Problem

OptionsABSCD…

30 2030 40Total:120Production:

ABS area: 3/5 CD area: 2/3

Page 6: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 6

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.

Page 7: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 7

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.

Page 8: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 8

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

Page 9: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 9

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.

Orders Steel Slabs

Page 10: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 10

Constraint Programming

• Areas: modelling, algorithms, algorithm mapping, monitoring, packages

Given:ProblemDescription

Formulations(Modelling)

Algorithms Implementations(e.g. ILOG Solver)

Page 11: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 11

Constraint Techniques Overview• Brute-force Search• Problem Reduction• Lookahead Search

– Forward Checking, Arc-consistency Lookahead, …

• Failure handling at dead-ends– Intelligent Backtracking, Learning Nogoods, …

• Variables ordering heuristics• Stochastic methods

– Local Search, GSAT, Guided Local Search, …

• Constrained optimization

Page 12: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 12

Maintaining Arc-Consistency

• Variables: x, y, z

• Domains: {1, 2, 3, 4}

• Constraints: x < y ; y < z

x 1 2 3 4

y 1 2 3 4

z 1 2 3 4

• x<y means <x,4> is not supported by y and <y,1> is not supported by x

X

• y<z means <y,4> is not supported by z and <z,1> & <z,2> is not supported by y

X X

X X

• Re-check x<y would delete <x,3> as now (with <y,4> gone) it has no support from y

X

Page 13: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 13

1

2

3

4

5

6

7

8

A B C D E F G 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

Strategies at dead-ends:• Learning “no goods” • dependency directed

backtracking

Page 14: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 14

1

2

3

4

5

6

7

8

A B C D E F G 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

X X

X

X

X

X

X

X

X

X

X

XDead-end detected after Queen 4 – no legal space for row 6, backtrack…

Page 15: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 15

Arc-Consistency Lookahead

• 8-Queens Problem• Three queens have

been placed• Maintaining AC

1

2

3

4

5

6

7

8

A B C D E F G H

X

XX

XXXX

XX XXX

X XX X

XX X

X

X

X XXX X

16

16

2626

26

26

34

45 58

• Result: dead-end found in row 7

• Backtrack required – typically remove Queen 3

Page 16: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 16

1

2

3

4

5

6

7

8

A B C D E F G HBack Jumping

• Jump to the latest culprit

11 33 22 44 33 11 22 33

Recorded earliest conflict

Identify the latest culprit, which is 4

Undo queens 5 and 4, continue

Page 17: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 17

Combinatorial Explosion of the Car Sequencing Problem

• Schedule 30 cars:– Search space: 30 factorial 1032 leaf nodes

• Generously allow:– Explore one in every 1010 leaf nodes!

– Examine 1010 nodes per second!

• Problem takes over 32 thousand years to solve!!!– 1032 ÷ 1010 ÷ 1010 ÷ 60 ÷ 60 ÷ 24 ÷ 365 31,710

• How to contain combinatorial explosion?

Page 18: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 18

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

better

worse

Page 19: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 19

The GLS Algorithm

• Iterative local search

• In a local minimum s*– Select Features

• Maximize utility

– Increase penalties (strengthen constraints)• Resume Local Search from s*

Ii

scipi

( *) 1

Ii(s*) = 1 if s* exhibits feature i; 0 otherwise

pi = penalty of feature I (init. to 0)

ci = cost of feature i

GLS->TSPFunction

Page 20: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 20

GLS: Augmented Cost Function • Identifying solution features, e.g. Edges used

• associate costs and penalties to features

• Given cost function g to minimize

• Augmented Cost Function

h(s) = g(s) + × pi × Ii(s))

is parameter to GLS

Ii(s) = 1 if s exhibits feature i; 0 otherwise

pi is penalty for feature i, initialized to 0

Page 21: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 21

GLS on TSP

• Local search: 2-opting = a g(t* ) / n 1 2 3 4 5 6

1 X

2 X

3 X

4 X

5 X

6 X

Features:n2 Featurescost = distance givene.g. tour [1,5,3,4,6,2]

t* = first local minimum produced by local search; g(t*) = cost of t*

n = # of cities

a = parameter to tune, within (0, 1]

Page 22: 15 July 2005Edward Tsang (Copyright)1 Constraint Satisfaction and Optimization Professor Edward Tsang University of Essex URL:

15 July 2005Edward Tsang (Copyright) 22

Summary, Constraint Programming

• Focus on (finite choices) decision problem• Constraint satisfaction is a general problem

– Many applications

• Efficient algorithms developed– To exploit the specific features of the problems

• CP is a successful multi-£/$M business– ILOG Solver, ECLiPSe, Actenum

• CP is a technique that can’t be ignored