Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Graph Colouring Various Models. an obvious model SAT sets demo random graphs chromatic number maxCol phase transition."— Presentation transcript:

1 Graph Colouring Various Models

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

3 kCol We are given a graph G = (V,E) where V is set of vertices and E is set of edges G is simple, undirected graph Given k colours, can we label vertices with colours such that for all (i,j)  E  colour(i) ≠ colour(j)

4 0 1 2 34 7 5 6 9 8 A Graph G = (V,E)

5 0 1 2 34 7 5 6 9 8 Colour such that adjacent vertices are different

6 Model 1

7 kCol Model 1 Have a constrained integer variable v[i] for each vertex i  V Domain of v[i] is {1..k} the set of avaliable colours For all for all (i,j)  E v[i] ≠ v[j] Decision variable are v[0] to v[n-1] Heuristic, Brelaz

8

9

10

11

12

13

14

15

16 Model 2

17 kCol Model 2 SAT encoding Consider as an example a 3Col instance with 2 adjacent vertices, i and j boolean variable to represent a vertex x taking a specific colour k “at least one and at most one” constraint adjacent vertices take different colours

18 kCol Model 2 SAT encoding Heuristics?

19 Implementation … generate data and pass to minisat+

20 Model 3

21 kCol Model 3 Have a constrained set variable S[i] for each colour Colour Sets of Vertices Decision variables are S[0] to S[k-1] Heuristics? Where col is a set of colours An edge is not in a coloured set All vertices are coloured

22

23

24

25

26

27

28

29

30 an example

31 0 1 2 34 7 5 6 9 8 g10.txt

32 0 1 2 34 7 5 6 9 8

33 0 1 2 34 7 5 6 9 8

34 0 1 2 34 7 5 6 9 8 1 is red 2 is green 3 is blue g10.txt

35 0 1 2 34 7 5 6 9 8 A different colour with Colour02

36 Generating random graphs

37

38

39

40

41

42 Small demo with data directory

43 Chromatic NumberChromatic Number

44 Chromatic NumberChromatic Number

45 We want the minimum number of colours to colour G Chromatic NumberChromatic 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)

46 Chromatic NumberChromatic Number

47 Chromatic NumberChromatic Number

48 Chromatic NumberChromatic Number

49 What should we do if there are not enough colours and we want 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)

50 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

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

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

53 Lassie, are you lying? Woof!

54

55

56 Constrainedness 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, is zero, easy, overconstrained Applied to: CSP, TSP, 3-SAT, 3-COL, Partition, HC, …?

57

58

59

60

61 Random Graphs

62

63 Make Experiments as a Job

64

65 The Results File

66 Analyse Results

67 4Col n = 50 sample size = 50 0.1 ≤ p ≤ 0.3

68

69

70

71 Check Out the Dates 1 day’s work

72 fin


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

Similar presentations


Ads by Google