Top Banner
Graph Colouring Various Models
72

Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Dec 29, 2015

Download

Documents

Victor Green
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Graph Colouring

Various Models

Page 2: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

• an obvious model• SAT• sets• demo• random graphs• chromatic number• maxCol• phase transition

Page 3: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

kCol

We are given a graph G = (V,E) whereV is set of vertices and E is set of edgesG is simple, undirected graph

Given k colours, can we label vertices with colourssuch that for all (i,j) E colour(i) ≠ colour(j)

Page 4: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

A Graph G = (V,E)

Page 5: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

A Graph G = (V,E)

Colour such that adjacent vertices are different

Page 6: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Model 1

Page 7: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

kColModel 1

Have a constrained integer variable v[i] for each vertex i VDomain of v[i] is {1..k} the set of avaliable coloursFor all for all (i,j) E v[i] ≠ v[j]Decision variable are v[0] to v[n-1]Heuristic, Brelaz

Page 8: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 9: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 10: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 11: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 12: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 13: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 14: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 15: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 16: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Model 2

Page 17: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

kColModel 2 SAT encoding

kivtruev ki ][

Consider as an example a 3Col instance with 2 adjacent vertices, i and j

)()()()( 323121321iiiiiiiii vvvvvvvvv

boolean variable to represent a vertex x taking a specific colour k

“at least one and at most one” constraint

)()()( 332211jijiji vvvvvv

)()()()( 323121321jjjjjjjjj vvvvvvvvv

adjacent vertices take different colours

Page 18: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

kColModel 2 SAT encoding

Heuristics?

Page 19: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Implementation … generate data and pass to minisat+

Page 20: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Model 3

Page 21: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

kColModel 3

Have a constrained set variable S[i] for each colour

Colour Sets of Vertices

icoliEvu Svu },{),(

Decision variables are S[0] to S[k-1]Heuristics?

nScoli i

Where col is a set of colours

An edge is notin a coloured set

All vertices are coloured

Page 22: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 23: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 24: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 25: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 26: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 27: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 28: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 29: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 30: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

an example

Page 31: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

g10.txt

Page 32: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

g10.txt

Page 33: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

g10.txt

Page 34: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

1 is red

2 is green

3 is blue

g10.txt

Page 35: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

0 1 2

3 4

75

6

98

g10.txtA different colour with Colour02

Page 36: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Generating random graphs

Page 37: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 38: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 39: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 40: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 41: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 42: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Small demo with data directory

Page 43: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Chromatic Number

Page 44: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Chromatic Number

Page 45: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

We want the minimum number of colours to colour G

Chromatic Number

• introduce a constrained integer variable maxCol• maxCol has domain {1 .. n}• each vertex has a constrained integer variable v[i]• v[i] has domain {1 .. n}• for (int i=0;i<n;i++) modl.addConstraint(leq(v[i],maxCol))• sol.minimise(maxCol)

Page 46: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Chromatic Number

Page 47: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Chromatic Number

Page 48: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Chromatic Number

Page 49: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

What should we do if there are not enough colours and wewant to do the best that we can? That is, colour as many vertices

as possible leaving some vertices uncoloured, or colour all vertices and minimise conflicts?

MaxCol (min-conflicts)

Page 50: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

MaxCol (min-conflicts)

• associate a dummy colour into domains• dummy colour doesn’t conflict with any other colours• get occurrence of dummy colour and minimise that

OR

• associate a penalty with a conflict• for edge {i,j} have constrained integer variable P[i][j]• domain P[i][j] is {0,1}• modl.addConstraint(or(and(neq(v[i],v[j]),eq(P[i][j],0)),• (and(eq(v[i],v[j]),eq(P[i][j],1)))• minimise the sum of the penalty variables

Page 51: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Lassie, do you think we could have a look at the phase transition in kCol?

Woof!

Page 52: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Lassie, remember the paper by Cheeseman, Kanefsky and Taylor, and that stuff on constrainedness?

Woof!

Page 53: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Lassie, are you lying?

Woof!

Page 54: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 55: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 56: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

1 2log ( )Sol

N

Constrainedness

<Sol> is expected number of solutions N is log_2 of the size of the state space

k = 0, all states are solutions, easy, underconstrained

k =

k = 1, critically constrained, 50% solubility, hard

, <Sol> is zero, easy, overconstrained

Applied to: CSP, TSP, 3-SAT, 3-COL, Partition, HC, …?

Page 57: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 58: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 59: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 60: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 61: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Random Graphs

Page 62: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Random Graphs

Page 63: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Make Experiments as a Job

Page 64: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Make Experiments as a Job

Page 65: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

The Results File

Page 66: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Analyse Results

Page 67: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

4Coln = 50sample size = 500.1 ≤ p ≤ 0.3

Page 68: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 69: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 70: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.
Page 71: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

Check Out the Dates

1 day’s work

Page 72: Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition.

fin