spring 2016 lecture 8: dynamic point labeling

95
2IMA20 Algorithms for Geographic Data Spring 2016 Lecture 8: Dynamic Point Labeling

Upload: others

Post on 23-Feb-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spring 2016 Lecture 8: Dynamic Point Labeling

2IMA20 Algorithms for Geographic Data

Spring 2016

Lecture 8: Dynamic Point Labeling

Page 2: Spring 2016 Lecture 8: Dynamic Point Labeling

Point label placement

What do we know so far?

Page 3: Spring 2016 Lecture 8: Dynamic Point Labeling

Set of n points to be labeled, each with a text, wherea label is a rectangle (bounding box)

Objective: label as many points as possible without overlap, where the label must have a corner at its point (NP-hard)

EindhovenEindhoven

Eindhoven

Recap: Point label placement

EindhovenGeldrop

Geldrop Geldrop

Geldrop

Page 4: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Point label placement

Common: the 4-position or the 8-position model

Solution method e.g. greedy, dynamic programming, simulated annealing, genetic, LP-based branch & cut

4-position

8-position

Page 5: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Sliding labels

4-slider model2-slider model

The label may touch the point anywhere on its (top or bottom) boundary

Not yet discretized

Page 6: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Maximum Independent Set

4-position: If the four label positions of a point intersect, then we get maximum non-intersecting subset of rectangles

Also: maximum independent set in rectangle intersection graphs

Page 7: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Heuristic

Choose shortest label, eliminate the intersecting candidates and repeat

Page 8: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Heuristic

Any chosen label can eliminate many candidate labels, but:every eliminated label contains a corner of the chosen label!

The chosen label together with the intersected (eliminated) rectangles has an MIS of size ≤ 4 ¼-approximation (tight)

Page 9: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Greedy (4-position), approximation

R

cannot exist because R is leftmost non-chosen

All candidates that intersect R contain the upper right or lower right corner of R

Hence, the max. non-intersecting subset of R and the intersected candidates has size 2

We choose 1, so approximation is ½

Page 10: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Greedy algorithm (4-position)

Leftmostlabel Regions where no

reference points can lie

The algorithm discards all useless candidates immediately after a new label is placed efficiently using a range searching data structure

Page 11: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: PTAS for labels

L1

L2

L3

L4

L5

L6

1. Optimal algorithm if all rectangles intersect one horizontal line

2. New ½-approximation algorithm

3. Dynamic programming for optimal sub-solutions

4. Shifting lemma to combine sub-solutions into a PTAS

Page 12: Spring 2016 Lecture 8: Dynamic Point Labeling

Point label placement

Which maps did you use recently?

Many maps today are dynamic

Page 13: Spring 2016 Lecture 8: Dynamic Point Labeling

Static vs dynamic labeling

Most heuristics for static maps search for an independent set in the conflict graph

What if we do this each time the map changes? Even if done fast, undesirable effects: flickering, jumps,

inconsistencies, …

Criteria for dynamic label placement?

Page 14: Spring 2016 Lecture 8: Dynamic Point Labeling

moving objects

De Berg, Gerrits ’13:

clear label-point association as many labels as readable as

possible direction of point movement

unobscured slow, continuous label

movement

continuous zoom/pan/rotate/tilt

Been, Daiches, Yap ’06:

label visible in a continuouszooming range

continuous change of size/position

labels should not vanish or appear during panning (except when leaving view area)

unique label placement/selection for a given map state

Criteria for dynamic labeling

Page 15: Spring 2016 Lecture 8: Dynamic Point Labeling

Complexity

How difficult is general dynamic label placement?

Static label placements: most variants NP-complete e.g., 4-position, max-#-labels

Is dynamic label placement more difficult?

Page 16: Spring 2016 Lecture 8: Dynamic Point Labeling

Some complexity classes

P

NP

PSPACE

EXPSPACE

EXP

NEXP

P =? NP

PSPACE = NPSPACE

Decidable

P ⊂ EXP

PSPACE ⊂ EXPSPACE

P ⊆ NP ⊆ PSPACE

Undecidable

Page 17: Spring 2016 Lecture 8: Dynamic Point Labeling

Constraint logic

introduced to analyze the complexity of games [Hearn,Demaine ’02]

Page 18: Spring 2016 Lecture 8: Dynamic Point Labeling

Non-deterministic constraint logic

1-player puzzle game played on a constraint graph, an undirected {1, 2 }-edge-weighted graph.

Configuration: specifies edge directions where each vertex has inflow ≥ 2.

Move: reversal of one edge, not breaking inflow constraints.

May assume the graph is planar, 3-regular, and contains only two types of vertices:

AND OR “Can configuration A be transformed into B” is PSPACE-complete.

Page 19: Spring 2016 Lecture 8: Dynamic Point Labeling

Structure of the reduction

Page 20: Spring 2016 Lecture 8: Dynamic Point Labeling

Structure of the reduction

orthogonal graph

drawing

Page 21: Spring 2016 Lecture 8: Dynamic Point Labeling

Structure of the reduction

orthogonal graph

drawing

Page 22: Spring 2016 Lecture 8: Dynamic Point Labeling

Structure of the reduction

gadgets

orthogonal graph

drawing

Page 23: Spring 2016 Lecture 8: Dynamic Point Labeling

Structure of the reduction

configuration sequence of moves

static labelingdynamic labeling

orthogonal graph

drawing

gadgets

Page 24: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 25: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 26: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 27: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 28: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 29: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadgetmust not happen

Page 30: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 31: Spring 2016 Lecture 8: Dynamic Point Labeling

AND gadget

must not happen

Page 32: Spring 2016 Lecture 8: Dynamic Point Labeling

Complexity (summary)

Other components can be simulated similarly

“Can moving points be labeled without overlap?” is strongly PSPACE-complete in 4-position model 2- and 4-slider models

Also if points not moving but added and removed over time viewed through a panning, rotating,

or zooming viewport

Consequences? heuristics: static labeling+interpolation restrictions: 1-position model (not for moving objects)

Page 33: Spring 2016 Lecture 8: Dynamic Point Labeling

Labeling moving objects

1. clear label-point association2. as many labels as readable as possible3. direction of point movement unobscured4. slow, continuous label movement

1. 2.

show all but as many as possible without overlap

3. 4.

KLM042

DLH073

Page 34: Spring 2016 Lecture 8: Dynamic Point Labeling

Labeling moving objects

1. clear label-point association → enforce2. as many labels as readable as possible → optimize3. direction of point movement unobscured → enforce4. slow, continuous label movement → optimize

1. 2.

show all but as many as possible without overlap

3. 4.

KLM042

DLH073

trade-off

Page 35: Spring 2016 Lecture 8: Dynamic Point Labeling

Heuristic algorithm

Input: point trajectories + timestep ∆t

1. compute static labelings every ∆t with many free labels2. interpolate label positions minimizing avg & max speed

Output: continuous dynamic labeling

Page 36: Spring 2016 Lecture 8: Dynamic Point Labeling

Heuristic algorithm

Input: point trajectories + timestep ∆t

1. compute static labelings every ∆t with many free labels2. interpolate label positions minimizing avg & max speed

Output: continuous dynamic labeling

Page 37: Spring 2016 Lecture 8: Dynamic Point Labeling

Heuristic algorithm

Input: point trajectories + timestep ∆t

1. compute static labelings every ∆t with many free labels2. interpolate label positions minimizing avg & max speed

Output: continuous dynamic labeling

Page 38: Spring 2016 Lecture 8: Dynamic Point Labeling

Interpolating label positions

Lemma: shortest path minimizes avg & max label speed But static labelings do not “minimize change” Open problem: approximation algorithms?

y

tx

y

t

x

Page 39: Spring 2016 Lecture 8: Dynamic Point Labeling

moving objects

De Berg, Gerrits ’13:

clear label-point association as many labels as readable as

possible direction of point movement

unobscured slow, continuous label

movement

continuous zoom/pan/rotate/tilt

Been, Daiches, Yap ’06:

label visible in a continuouszooming range

continuous change of size/position

labels should not vanish or appear during panning (except when leaving view area)

unique label placement/selection for a given map state

Criteria for dynamic labeling

Page 40: Spring 2016 Lecture 8: Dynamic Point Labeling

large scale small scale

Labeling with zooming

zoom out → additional conflicts:

• relative size of labels increases

• additional points in view area

Page 41: Spring 2016 Lecture 8: Dynamic Point Labeling

Active range maximization

(inverse) scale on z-axis horizontal slice z=z0: map of scale 1/z0

Input: fixed cone per label L: no jumps

Page 42: Spring 2016 Lecture 8: Dynamic Point Labeling

Active range maximization

(inverse) scale on z-axis horizontal slice z=z0: map of scale 1/z0

Input: fixed cone per label L: no jumps SL range of selectable scales for L

x

z

Page 43: Spring 2016 Lecture 8: Dynamic Point Labeling

Active range maximization

(inverse) scale on z-axis horizontal slice z=z0: map of scale 1/z0

Input: fixed cone per label L: no jumps SL range of selectable scales for L

x

z

Page 44: Spring 2016 Lecture 8: Dynamic Point Labeling

Active range maximization

(inverse) scale on z-axis horizontal slice z=z0: map of scale 1/z0

Input: fixed cone per label L: no jumps SL range of selectable scales for L

Output: per label: active z-interval AL ⊆ SL:

no flickering active truncated cones may not overlap: labels do not overlap Objective: Maximize ∑L AL

x

z

Page 45: Spring 2016 Lecture 8: Dynamic Point Labeling

Complexity

Active range maximization is NP-hard (even if SL = [0,zmax] )

Reduction from planar 3SAT

planar 3-Sat Formel ϕ

cones SL, K > 0:ϕ satisfiable ⇔ max ∑L AL ≥ K

x 1 ∨ x 2 ∨ x 3

x 1 ∨ x 3 ∨ x 4

x 1 ∨ x 2 ∨ x 4

x 2 ∨ x 3 ∨ x 4

x 1 x 2 x 3 x 4x 1 x 2

• variable gadget

• clause gadget

Page 46: Spring 2016 Lecture 8: Dynamic Point Labeling

Variable gadget

cones touch at height zmax/2

Page 47: Spring 2016 Lecture 8: Dynamic Point Labeling

Variable gadget

x is true

Page 48: Spring 2016 Lecture 8: Dynamic Point Labeling

Variable gadget

x is false

Page 49: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

cones touch at height zmax/2

Page 50: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

3 literals true: clause contributes ???

Page 51: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

3 literals true: clause (yellow) contributes 2*zmax

Page 52: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

2 literals true: clause (yellow) contributes 2*zmax

Page 53: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

1 literals true: clause (yellow) contributes 2*zmax

Page 54: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

0 literals true: clause (yellow) contributes ???

Page 55: Spring 2016 Lecture 8: Dynamic Point Labeling

Clause gadget

0 literals true: clause (yellow) contributes 1.5*zmax

Page 56: Spring 2016 Lecture 8: Dynamic Point Labeling

Active range maximization

NP-hard

“good news”: decision problem in NP more good news: approximation

algorithms (next)

Page 57: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Page 58: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Page 59: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Page 60: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 61: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 62: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 63: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 64: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 65: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 66: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 67: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 68: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 69: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 70: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 71: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Page 72: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Optimal?

Page 73: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Optimal? No!

Page 74: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Optimal? No!

Running time: ???

Page 75: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Optimal? No!

Running time: O(n2)

Approximation ratio: ???

Page 76: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Heuristic for static labels

small-to-large: Any chosen label can eliminate many candidate labels, but:every eliminated label contains a corner of the chosen label!

Page 77: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Heuristic for static labels

small-to-large: Any chosen label can eliminate many candidate labels, but:every eliminated label contains a corner of the chosen label!define c = #pairwise independent labels that any label can eliminate

Approximation ratio: 1/c for squares? for rectangles of equal size?

Page 78: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Running time: O(n2)

Approximation ratio: “1/c”

For “equal-sized axis-aligned rectangles”: Approximation ratio: ¼ Alternative running time: O((n+k) log2 n), where k is the number

of intersecting cones

Page 79: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Greedy algorithm (4-position)

Leftmostlabel Regions where no

reference points can lie

The algorithm discards all useless candidates immediately after a new label is placed efficiently using a range searching data structure

Page 80: Spring 2016 Lecture 8: Dynamic Point Labeling

Recap: Greedy algorithm (4-position)

Leftmostlabel Regions where no

reference points can lie

The algorithm discards all useless candidates immediately after a new label is placed efficiently using a range searching data structure Here we will not be able to delete, but … (?)

Page 81: Spring 2016 Lecture 8: Dynamic Point Labeling

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z shrink remaining ranges accordingly, and continue

Running time: O(n2)

Approximation ratio: “1/c”

For “equal-sized axis-aligned rectangles”: Approximation ratio: ¼ Alternative running time: O((n+k) log2 n), where k is the number

of intersecting cones by maintaining a 2D range tree on the apexes of the active

cones (ignore this if you don’t know range trees)

Page 82: Spring 2016 Lecture 8: Dynamic Point Labeling

Level-based small-to-large greedy

Assume Square labels All selectable ranges = [0,zmax]

Algorithm for levels πi = zmax/2i, i=0,… greedy select inactive squares

(small-to-large) that don’t overlap active squares

π0

π1

π2

Page 83: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 84: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 85: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 86: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 87: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 88: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 89: Spring 2016 Lecture 8: Dynamic Point Labeling

Example

π0

π1

π2

Page 90: Spring 2016 Lecture 8: Dynamic Point Labeling

Level-based small-to-large greedy

Assume Square labels All selectable ranges = [0,zmax]

Algorithm for levels πi = zmax/2i, i=0,… greedy select inactive squares

(small-to-large) that don’t overlap active squares

Approximation ratio: looses factor 2 by taking levels how many “independent” inactive squares can an active square

intersect? How small can these inactive squares be?

π0

π1

π2

Page 91: Spring 2016 Lecture 8: Dynamic Point Labeling

Assume Square labels All selectable ranges = [0,zmax]

Algorithm for levels πi = zmax/2i, i=0,… greedy select inactive squares

(small-to-large) that don’t overlap active squares

Approximation ratio: looses factor 2 by taking levels how many “independent” inactive squares can an active square

intersect? How small can these inactive squares be?

Level-based small-to-large greedy

active in πi

side length l

inactive in πi & overlapping, side length l’

Contradiction if green is swallowed one level up → l’>l/3

Page 92: Spring 2016 Lecture 8: Dynamic Point Labeling

Assume Square labels All selectable ranges = [0,zmax]

Algorithm for levels πi = zmax/2i, i=0,… greedy select inactive squares

(small-to-large) that don’t overlap active squares

Approximation ratio: looses factor 2 by taking levels c=12 → 1/24 approximation

Running time: O(n log3 (n)) using segment trees (ignore this if you don’t know segment trees)

Level-based small-to-large greedy

active in πi

side length l

inactive in πi & overlapping, side length l’

Contradiction if green is swallowed one level up → l’>l/3

Page 93: Spring 2016 Lecture 8: Dynamic Point Labeling

Summary Dynamic Label Placement

PSPACE-hard in general so far only heuristics for moving points

NP-complete & approximation algorithms for zooming & 1-position reused many algorithmic techniques from static label placement

Page 94: Spring 2016 Lecture 8: Dynamic Point Labeling

moving objects

De Berg, Gerrits ’13:

clear label-point association as many labels as readable as

possible direction of point movement

unobscured slow, continuous label

movement

continuous zoom/pan/rotate/tilt

Been, Daiches, Yap ’06:

label visible in a continuouszooming range

continuous change of size/position

labels should not vanish or appear during panning (except when leaving view area)

unique label placement/selection for a given map state

Summary

Page 95: Spring 2016 Lecture 8: Dynamic Point Labeling

References

Buchin, K., & Gerrits, D. H. (2013). Dynamic point labeling is strongly PSPACE-complete. In Algorithms and Computation (pp. 262-272). Springer Berlin Heidelberg.

de Berg, M., & Gerrits, D. H. (2013). Labeling moving points with a trade-off between label speed and label overlap. In Algorithms–ESA 2013 (pp. 373-384). Springer Berlin Heidelberg.

Been, K., Daiches, E., & Yap, C. (2006). Dynamic map labeling. Visualization and Computer Graphics, IEEE Transactions on, 12(5), 773-780.

Been, K., Nöllenburg, M., Poon, S. H., & Wolff, A. (2008). Optimizing active ranges for consistent dynamic map labeling. In Proceedings of the 24th Annual Symposium on Computational Geometry (pp. 10-19). ACM.