Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The...

23
Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia

Transcript of Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The...

Page 1: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Fast Node Overlap Removal

Tim Dwyer¹

Kim Marriott¹

Peter J. Stuckey²

¹Monash University

²The University of Melbourne

Victoria, Australia

Page 2: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Overlap removal by layout adjustment

Page 3: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

“Mental Map” Model (Misue et al. 1995)

Orthogonal Ordering

Proximity Relations

Topology

1 2

3

1 2

3

Page 4: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Past work – “Force” methods

Force Scan Algorithm – Misue et al. 1995

(Improved) Push Force Scan – Hayashi et al. 1998

Others – Huang and Lai 2002, Li et al. 2004

Derivation of “Overlap Force” by Misue et al. 1995

Page 5: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Past work – “Cluster busting”

Voronoi “Cluster Busting” – Lyons et al. 1998 Applied to node overlap removal by Gansner and

North 1998

Voronoi Diagram Overlap removal by neato(www.graphviz.org)

Page 6: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Constrained optimization approach He and Marriott 1998

Cost of modifying original layout:

Non-overlap constraints:(x0,y0)

Page 7: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Quadratic programming heuristic

1. Generate horizontal no-overlap constraints

3. Generate vertical no-overlap constraints

2. Minimise subject to

4. Minimise subject to

Page 8: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Our contribution

New constraint generation algorithm– O(n) constraints– O(n log n) time

New solver algorithm– High quality near optimal solution O(n log n) time– Optimal solution with simple extension

Page 9: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

d

Generating non-overlap constraints

Sweep algorithm

ca

ba

c

b

b

a c

b

d

Vertical sweep tocreate horizontalconstraints

Page 10: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

d

Generating non-overlap constraints

Sweep algorithm

ca

b

Vertical sweep tocreate horizontalconstraints

If nodes overlap more horizontally than vertically skip

Remaining overlaps handled by vertical constraints

Page 11: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Generating non-overlap constraints

Two strategies for checking neighbours Two strategies for checking neighbours1. Immediate neighbours only

Two strategies for checking neighbours1. Immediate neighbours only

2. List of all overlapping neighbours

Page 12: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Generating non-overlap constraints

Open list uses red-black tree– O(log n) insert, remove, next_left, next_right operations

Up to k·n constraints in x-dimension, 2n constraints in y-dimension

O(n log n) time assuming k is bounded

Page 13: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Solving separation constraints

Objective function:

minimize

subject to Cwhere each c∈C

has form left(c) + gap(c) ≤ right(c)

where gap(c) = ½ (left(c).size + right(c).size)

Separation constraints form DAG over variablesb

dac

e

a

bc d e

Page 14: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Approximate feasible solution

Create “blocks” by merging across violated constraints

b

d

a

c

b

d

a

c

b

d

a

c

Page 15: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Approximate feasible solution

May need to merge backwards

b

d

a

c

b

d

a

c

b

d

a

cb

d

a

c

Page 16: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Merge complexity

Significant costs:– Initial total order O(|V|+|C|) by depth-first search– Maintaining block in and out constraint priority queues

We use pairing heaps:– O(1) insert, findMax, merge– O(log n) deleteMax (amortised)

– Cost of copying variables between blocks We always copy the smaller block to the larger

We assume:– |C| prop. to k|V| – bounded k

O(n log n).

Page 17: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Approximate feasible solution

Solution after merging may not be optimal

b

d

a

cb

d

a

c

b

d

a

cb

d

a

c

Page 18: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Optimal solution

Need to “split” blocks to improve solution Within blocks we have a tree of “active” constraints

b

d

a

c

Do the sub-blocks on either side of each constraint want to move apart?

Page 19: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Optimal solution

By placing blocks at their weighted average position we minimize

such that

So summing partial derivatives to one side of each constraint c gives us the Lagrange multiplier λc

λc< 0 means we can split across c

Page 20: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Optimal solution

Splitting may trigger further merging in each direction

b

d

a

c

b

d

a

c

Optimal solution when for all active c, λc≥ 0

Page 21: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

Results

Page 22: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.
Page 23: Fast Node Overlap Removal Tim Dwyer¹ Kim Marriott¹ Peter J. Stuckey² ¹Monash University ²The University of Melbourne Victoria, Australia.

0.001

0.01

0.1

1

10

100

size200

400600

8001000

12001400

16001800

Ru

nn

ing

Tim

e (

se

co

nd

s)

SAT

SOL

QP

SAT_OO

SOL_OO

QP_OO

FSA

2000