spring 2016 lecture 8: dynamic point labeling

Post on 23-Feb-2022

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

2IMA20 Algorithms for Geographic Data

Spring 2016

Lecture 8: Dynamic Point Labeling

Point label placement

What do we know so far?

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

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

Recap: Sliding labels

4-slider model2-slider model

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

Not yet discretized

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

Recap: Heuristic

Choose shortest label, eliminate the intersecting candidates and repeat

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)

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 ½

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

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

Point label placement

Which maps did you use recently?

Many maps today are dynamic

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?

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

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?

Some complexity classes

P

NP

PSPACE

EXPSPACE

EXP

NEXP

P =? NP

PSPACE = NPSPACE

Decidable

P ⊂ EXP

PSPACE ⊂ EXPSPACE

P ⊆ NP ⊆ PSPACE

Undecidable

Constraint logic

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

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.

Structure of the reduction

Structure of the reduction

orthogonal graph

drawing

Structure of the reduction

orthogonal graph

drawing

Structure of the reduction

gadgets

orthogonal graph

drawing

Structure of the reduction

configuration sequence of moves

static labelingdynamic labeling

orthogonal graph

drawing

gadgets

AND gadget

must not happen

AND gadget

must not happen

AND gadget

must not happen

AND gadget

must not happen

AND gadget

must not happen

AND gadgetmust not happen

AND gadget

must not happen

AND gadget

must not happen

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)

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

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

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

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

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

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

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

large scale small scale

Labeling with zooming

zoom out → additional conflicts:

• relative size of labels increases

• additional points in view area

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

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

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

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

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

Variable gadget

cones touch at height zmax/2

Variable gadget

x is true

Variable gadget

x is false

Clause gadget

cones touch at height zmax/2

Clause gadget

3 literals true: clause contributes ???

Clause gadget

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

Clause gadget

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

Clause gadget

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

Clause gadget

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

Clause gadget

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

Active range maximization

NP-hard

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

algorithms (next)

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Greedy top-down sweep

Algorithm: always completely add remaining range with highest z

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Greedy top-down sweep

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

Optimal?

Greedy top-down sweep

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

Optimal? No!

Greedy top-down sweep

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

Optimal? No!

Running time: ???

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: ???

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!

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?

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

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

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 … (?)

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)

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

Example

π0

π1

π2

Example

π0

π1

π2

Example

π0

π1

π2

Example

π0

π1

π2

Example

π0

π1

π2

Example

π0

π1

π2

Example

π0

π1

π2

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

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

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

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

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

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.

top related