46
It is rocket science CPM

CPM!

Embed Size (px)

DESCRIPTION

CPM!. JChoco. We jumped in, and took it for a spin. Some counting problems. Sudoku you got your hands dirty. search. Opening up the hood: part 1, search. So how does CP work?. BT: Chronological BackTracking Thrashing! FC: forward checking Thrashing! - PowerPoint PPT Presentation

Citation preview

Page 1: CPM!

It is rocket science

CPM

Page 2: CPM!
Page 3: CPM!
Page 4: CPM!

Just do it!

Page 5: CPM!

We jumped in and did it!

Page 6: CPM!
Page 7: CPM!

mantra

A constraint satisfaction problem (CSP) is a triple, (V,D,C) where V is a set of variables, each with a domain of values (in D) and a set of constraints C restricting the set of allowed values.The problem is then to find an assignment of values to variablesfrom their domains, such that the constraints are satisfied (sat) …or to show no such assignment exists (unsat)

Generally, this problem in NP-complete

Page 8: CPM!

looking under the hood search

Page 9: CPM!

looking under the hood search

Taking graph colouring as an example (simple & easy to visualise)

•chronological backtracking • backward checking• thrashing (slavishly repeating actions with same outcomes)

•chronological backtracking • forward checking• Also thrashes

•conflict directed backjumping• learning from dead-ends• check backwards or forwards

Page 10: CPM!
Page 11: CPM!

looking under the hood Arc consistency

Page 12: CPM!

looking under the hood Arc consistency

viewing the CSP as a graph (the constraint graph)

node consistency (1-consistency) and arc consistency (2-consistency)

Page 13: CPM!

looking under the hood Arc consistency

• AC3 for binary constraints (using revise)• Coarse grained ).( 3deO

Page 14: CPM!

looking under the hood Arc consistency

• Fine grained, two pass algorithms• AC4, AC6, …, AC8 ).( 2deO

Page 15: CPM!

looking under the hood Arc consistency

• Object oriented perspective (AC5)• Constraints as objects• Specialised revise function• Complexity then a function of revision

Page 16: CPM!

looking under the hood Arc consistency

• AC2001 • A simple trick makes coarse grained optimal (when we have no semantics to exploit)

Page 17: CPM!

looking under the hood Arc consistency

Page 18: CPM!

looking under the hood all different

Page 19: CPM!

looking under the hood all different

An example of a specialised constraint•N-ary•Use of Hall sets•Example was sudoku

Page 20: CPM!

looking under the hood all different

Page 21: CPM!

looking under the hood heuristics

Page 22: CPM!

looking under the hood heuristics

Static, topological properties

Fail-first, and it’s realisation

Constrainedness

Dual viewpoint heuristics

Promise

Regret

Domain Specific (example JSSP slack-based)

Page 23: CPM!

looking under the hood heuristics

Page 24: CPM!

A problemNumber Partitioning

• A variety of models• Static variable ordering heuristic• Symmetry breaking• Use of “scalar” constraint• Optimisation (minimise difference)• First experience of phase transition phenomena

Page 25: CPM!

A problemBin Packing

• A model presented• Modelling of bins using 0/1 variables and scalar• … and sum• Optimise as sequence of decision problems• Recognise decision variables• Effect of value ordering• First-fit decreasing heuristic• Symmetry breaking on bins

• lex or load?• Consider alternative model• Code & empirical study

Page 26: CPM!

A problem

Bin Packing N-Queens

Crystal Maze Job Shop Scheduling Problem

Graph Colouring

Number Partitioning

Banquet Planning

Meeting Scheduling Problem

Workforce Management

Stable Roommates

Super Tree ConstructionMatch Race Scheduling

Maximum Clique

Page 27: CPM!

A problem

Lecture Lecture

Lecture Lecture

Lecture

Lecture

Assessed Exercise

Assessed Exercise

Homework

For Information Only

For Information OnlyFor Information Only

Lecture

Page 28: CPM!

A problem

Page 29: CPM!

A problem

Page 30: CPM!

Phase Transition Phenomena Where are the hard problems?

• Ubiquitous • SAT, GCol, Number Partition, SAT, …

• Theory! (kappa)• Can use kappa to engineer heuristics!

Page 31: CPM!

Phase Transition Phenomena Where are the hard problems?

Page 32: CPM!

Discrepancy Search

• Limited Discrepancy Search … and why it might work• Improved LDS• Take discrepancies late or early?

Page 33: CPM!

Parallel CP (part 1)

Page 34: CPM!

Parallel CP (part 2)

Page 35: CPM!

Local Search

It’s search Jim, but not as we know it

Page 36: CPM!

Local Search

• TSP as a working example• Hill Climbing (HC)

• Cost function• Representation• Move operator

• HC gets stuck in local minima• Local search cannot prove optimality• Local search can be very very very fast

Page 37: CPM!

Local Search

Escaping local minima•Simulated annealing (SA)

• Needs an annealing schedule• Parameter need to be tuned

•Tabu Search (TS)• Tabu list and what to put in it

•Guided Local Search (GLS)•Genetic Algorithms (GA)

• Population based• Representation as chromosone• Cross over and mutation• Fitness function• Survival of the fittest

• Balance exploration with exploitation

Page 38: CPM!

5 lectures

Page 39: CPM!

Levels of Consistency

• Node Consistency (NC)• Arc-consistency (AC)• Path Consistency (PC)• Generalised arc-consistency (GAC)• Bounds consistency• Inverse Path Consistency (IPC aka PIC)• Singleton Arc-consistency (SAC)• … and others

Page 40: CPM!
Page 41: CPM!

So?

Page 42: CPM!

• Know about BT & FC and CBJ (high level)

• Know about levels of consistency and cost• NC, AC, PC, PIC, SAC, GAC

• Know about local search• HC, SA, TS, GA would suffice

• Discrepancy Search and Parallel Search• Why LDS? • Why parallel search?• What is best that can be had?

• Heuristics• What do they hope to achieve?• Can you suggest some?• Given a problem, what would be appropriate?

• …

So?Part 1 Preparing for the exam

Page 43: CPM!

• Model and Solve a given problem•Variables, domains, constraints, …•…, heuristics, symmetry break, alternative model

• Have a look at Ciaran’s slides on allDifferent

• If you were given a piece of choco3 code could you understand it?•“name that code”

• If you were given some variables, with domains, and constraints•Could you make the variables arc consistent?

• Have a look at the homework•Why not do the homework.?

• The last “Three Problems”•Ignore these. These were to give you insight to research in CP•This is a Masters course after all

• …

So?Part 2 Preparing for the exam

Page 44: CPM!

• Follow up the links on Barbara Smith’s AR33 notes

So?Part 3 Preparing for the exam

Page 45: CPM!

30 lectures were given

Page 46: CPM!

One of your challenges for the future is to “do more with less”.

You are now in a better position to do that.

Many of the really important, and unseen, computational challengesare hard: resource allocation, packing, production scheduling, workforcemanagement, routing problems, transportation problems, matching, rostering,timetabling, energy use, energy planning ….

Few people stop to think how these problems are actually addressed, if at all.

You have looked at some of these problems. You have tried to model and solve them, sometimesusing complete search (bt, fc, cbj, mac), quasi-complete (lds) and incomplete (local search),finding appropriate heuristics and trying to locate “the really hard problems”

Last Words