24
Algorithms for Graph Coloring Problem Wang Shengyi National University of Singapore November 6, 2014 Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 1 / 24

Algorithms for Graph Coloring Problem

Embed Size (px)

Citation preview

Page 1: Algorithms for Graph Coloring Problem

Algorithms for Graph Coloring Problem

Wang Shengyi

National University of Singapore

November 6, 2014

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 1 / 24

Page 2: Algorithms for Graph Coloring Problem

Introduction Problem Description

Problem Description

• For a graph G = (V, E) and a color sequence c = (c0, c1, . . . , cn), firstlychoose a node v ∈ V and populate with c0

• Populate the rest of G in order of the rest of color sequence c such that onlynew nodes connected to a previously populated node may be populated.

• Each populated G can be called a configuration, which can be seen as afunction fmapping node to color. We can calculate a reward value for sucha configuration f by the following formula:

H =∑

All filled (i,j)∈E

1− δ(f(i), f(j)) where δ(x, y) =

{0 x ̸= y1 x = y

• For any G and c, develop an algorithm to generate a configuration that givesthe maximum reward.

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 2 / 24

Page 3: Algorithms for Graph Coloring Problem

Introduction Data Set

Data Set

Set Number of Vertices Number of Edges Length of Color Sequences01 10 29 1002 153 5533 2003 153 5533 13004 590 658 40005 2969 3372 400006 483 1358 40007 11748 34716 9000

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 3 / 24

Page 4: Algorithms for Graph Coloring Problem

Introduction Data Set

Data Set

We can explore more…

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 4 / 24

Page 5: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 01

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 5 / 24

Page 6: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 02 & 03

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 6 / 24

Page 7: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 04

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 7 / 24

Page 8: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 05

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 8 / 24

Page 9: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 06

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 9 / 24

Page 10: Algorithms for Graph Coloring Problem

Introduction Data Set

Graph Visualization: Graph 07

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 10 / 24

Page 11: Algorithms for Graph Coloring Problem

Introduction Data Set

Color Sequence Visualization

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 11 / 24

Page 12: Algorithms for Graph Coloring Problem

Algorithms Representation

States

• Each state can be represented as a triple t = (γ, p, σ)• γ is the subgraph which has not been populated.• p is the set of all permitted choices.• σ is a sequence of nodes which have been populated chronologically.

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 12 / 24

Page 13: Algorithms for Graph Coloring Problem

Algorithms Representation

State Transition Function: Transit

• Input: An old state (γ, p, σ) and n ∈ p• Output: An new state (γ′, p′, σ′)

• γ′ = γ removing n and related edges• p′ = p ∪ neighbors of n in γ − {n}• σ′ = σ :: n

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 13 / 24

Page 14: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Search Component Generators: A Pentomino Style

• A search component S ∈ S is a stochastic algorithm.• Input: t = (γ, p, σ), Output: One or multiple final states t1, t2, . . . , tm• Before running, S would check the budget. For each final state, S comparesthe reward with the best result so far and updates the budget.

• A search component generatorΨ : Θ → S• Given a set of parameters θ ∈ Θ,Ψ(θ) is a search component• Simulate, Repeat, LookAhead, Step and Select

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 14 / 24

Page 15: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Simulate

Parameters: Policy πsimu, mappingfrom permitted set p tochoice n.

Algorithm: Repeatedly samplingnodes according to πsimu

and performs transitionsTransit until reachingthe final state.

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 15 / 24

Page 16: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Repeat

Parameters: A positive integer N > 0,a search component S

Algorithm: It repeats performing Sfor N times.

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 16 / 24

Page 17: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

LookAhead

Parameters: A search component SAlgorithm: For each n ∈ p, it

performs S onTransit(t, n).

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 17 / 24

Page 18: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Step

Parameters: A search component SAlgorithm: For each remaining steps

until the final state, itperforms S first. Then itextracts the local bestchoice nl and performstransitionTransit(tstep, nl).

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 18 / 24

Page 19: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Select

Parameters: A selection policy πsel, asearch component S

Algorithm: It looks like Step. But ineach step, it chooses nodeaccording to πsel.

πsel: πUCB-1C

s(t, c): Sum of rewards,from Swith Transit(t, c)

n(t, c): Number of times c wasselected in state t

n(t): Sum of n(t, c)

argmaxc∈p

s(t, c)n(t, c)

+ C

√ln n(t)n(t, c)

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 19 / 24

Page 20: Algorithms for Graph Coloring Problem

Algorithms Randomized Algorithms

Compisition

• Is = Step(Repeat(N, Simulate(πrandom)))

• Nmc(0) = Simulate(πrandom)Nmc(l) = Step(LookAhead(Nmc(l− 1)))

• Uct(C) = Step(Repeat(N, Select(πUCB-1C , Simulate(πrandom))))

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 20 / 24

Page 21: Algorithms for Graph Coloring Problem

Algorithms Greedy Algorithm

Greedy Strategy

argmaxc∈p

Reward({c} ∪ Neighbors(c,G))

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 21 / 24

Page 22: Algorithms for Graph Coloring Problem

Result

Results of Iterative Sampling (Is)

N set01 set02 set03 set04 set05 set06 set071 11 50 1981 129 1039 439 972110 16 58 2091 159 1107 473 9777100 19 74 2127 167 1126 483 98781000 19 79 2147 167 1158 489 99384000 19 84 2181 175 1158 506 10006

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 22 / 24

Page 23: Algorithms for Graph Coloring Problem

Result

Result of Different Algorithms for Budget 1000

Algorithms set01 set02 set03 set04 set05 set06 set07Is 19 79 2147 167 1158 489 9938

Nmc(2) 19 79 2171 171 1152 498 9953Nmc(3) 18 75 2158 173 1145 503 9912Uct(0.3) 19 98 2165 171 1141 504 9933Uct(0.5) 19 98 2165 171 1141 500 9933Greedy 19 156 2719 219 1473 737 16118

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 23 / 24

Page 24: Algorithms for Graph Coloring Problem

Thank you!

Wang Shengyi (NUS) Algorithms for Graph Coloring Problem November 6, 2014 24 / 24