A Unified Model and Algorithms for Temporal Map Labeling

We consider map labeling for the case that a map undergoes a sequence of operations such as rotation, zoom and translation over a specified time span. We unify and generalize several previous models for dynamic map labeling into one versatile and flexible model. In contrast to previous research, we completely abstract from the particular operations and express the labeling problem as a set of time intervals representing the labels’ presences, activities and conflicts. One of the model’s strength is manifested in its simplicity and broad range of applications. In particular, it supports label selection both for map features with fixed position as well as for moving entities (e.g., for tracking vehicles in logistics or air traffic control). We study the active range maximization problem in this model. We prove that the problem is NP-complete and W[1]-hard, and present constant-factor approximation algorithms. In the restricted, yet practically relevant case that no more than k labels can be active at any time, we give polynomial-time algorithms as well as constant-factor approximation algorithms.


Introduction
Dynamic digital maps are becoming more and more ubiquitous, especially with the rising numbers of location-based services and smartphone users worldwide.Consumer applications that include personalized and interactive map views range from classic navigation systems to map-based search engines and social networking services.Likewise, interactive digital maps are a core component of professional geographic information systems.All these map services have in common that the content of the map view is changing over time based on interaction with the system (i.e., zooming, panning, rotating, content filtering, etc.; see Fig. 1 for a schematic illustration of interactive maps) or based on the physical movement of the user or a set of tracked entities.Creating smooth visualizations under such map dynamics induces challenging geometric problems, e.g., continuous generalization [22] or dynamic map labeling.
In the past decade, dynamic map labeling has therefore captured the interest of researchers.In 2003, Petzold et al. [21] presented a framework for automatically placing labels on dynamic maps.They split the label placement procedure into two phases, namely a (possibly time-consuming) pre-processing phase and a query phase which computes the labeling of custom-scale maps.However, this approach does not guarantee that labels do not jump or flicker while transforming the map.
In 2006, Been et al. [1] introduced the first formal model for dynamic maps and dynamic labels, formulating a general optimization problem.They describe the change of a map by the operations zooming, panning, and rotation.They observe that the selection and placement of labels must be temporally coherent (or consistent) during all map animations resulting from interactions, rather than being optimized individually for each map view as in static map labeling.In order to avoid flickering and jumping labels while transforming the map with zooming and panning, they require four desiderata for consistent dynamic map labeling.These comprise monotonicity, i.e., labels should not vanish when zooming in or appear when zooming out (or any of the two when panning), invariant point placement, i.e., label positions and size remain invariant during movement, and history independence, i.e., placement and selection of labels should be a function of the current map state only.Monotonicity is modeled as selecting for each label at most one scale interval, the so-called active range, during which the label is  displayed.They introduce the active range optimization problem (ARO) maximizing the sum of active ranges over all labels such that no two labels overlap and all desiderata are fulfilled.They prove that ARO is NP-hard for star-shaped labels and present a greedy algorithm that computes an optimal solution for a simplified variant in polynomial time.
That model is the starting point for several subsequent papers considering the operations zooming, panning and rotation, mostly independently.Been et al. [4] take a closer look at different variants of ARO for zooming.They show NP-hardness and give approximation algorithms.In the same manner further variants are investigated by Liao et al. [14].Gemsa et al. [9] present a fully polynomial-time approximation scheme (FPTAS) for a special case of ARO, where the given map is one-dimensional and only zooming is allowed.However, they combine the selection problem with a placement problem in a slider model.Zhang et al. [27] also consider the model of Been et al. [1] for zooming, however, instead of maximizing the total sum of active ranges, they maximize the minimum active range among all labels.They discuss similar variants as Liao et al. [14] and Been et al. [4], and also prove NP-hardness and give approximation algorithms.
Gemsa et al. [10,11] extend the ARO model to rotation operations.They first show that the ARO problem is NP-hard in the considered setting and introduce an efficient polynomial-time-approximation scheme (FPTAS) for unit-height rectangles [10].In subsequent work, they experimentally evaluate heuristics, algorithms with approximation guarantees and optimal approaches based on integer linear programming [11].A similar setting for rotating maps is considered by Yokosuka and Imai [26].However, instead of ARO, they aim at finding the maximum font size for which all labels can always be displayed without overlapping.
Apart from the results based on the consistency model of Been et al. [1], other approaches and models are considered, too.Maass et al. [17] describe a view management system for interactive three-dimensional maps of cities also considering label placement.Mote [20] presents a fast label placement strategy without a preprocessing phase.Luboschik et al. [15] describes a fast particle-based strategy that locally optimizes the label placement.None of these approaches takes consistency criteria for dynamic map labeling into account.
A different generalization of static point labeling is dynamic point labeling.Instead of transforming the map, the point set changes over time by adding or removing points as well as by moving points continuously.Inspired by air-traffic control, De Berg and Gerrits [6] consider moving points on a static map that must be labeled.They present a sophisticated heuristic for finding a reasonable trade-off between label speed and label overlap.Finally, Buchin and Gerrits [2] show that dynamic point labeling is strongly PSPACE-complete.
Embedded labels for road maps are also considered for interactive and dynamic maps.Maass and Döllner [18] provide a heuristic for labeling interactive 3D road maps taking obstacles into account.Vaaraniemi et al. [25] present a study on a forcebased labeling algorithm for dynamic maps considering both point and line features.Schwartges et al. [24] investigate embedded labels in interactive maps allowing panning, zooming and rotation of the map.They evaluate a simple heuristic for maximizing the number of placed labels.In [23] Schwartges et al. take another approach using billboards (labels with short leaders) for naming roads in interactive 3D maps to avoid label distortion.
Contribution and Outline Most existing algorithmic results in dynamic map labeling take a global view on the map, which optimizes over the whole interaction space, regardless of which portion of that space is actually explored by the user.In this paper we take a more local view on dynamic map labeling.Our aim is to develop algorithms that optimize the labeling for a specific map animation given offline as input.Any feature or label that is not relevant for that particular animation-for example, because it never enters the map view-can be ignored by our algorithms.This approach not only allows us to compute better labelings by removing unnecessary dependencies and non-local effects, but it also reduces the problem size, since fewer features and labels must be taken into account.
In Sect.2, we first formulate an abstract, generic model for offline, temporal labeling problems, in which labels and potential conflicts between labels are represented as intervals over time.To represent a label's presence, we use a presence interval, which corresponds to the time that a label is present (but not necessarily displayed) in the map view.That is, whenever a label enters the map view, a corresponding presence interval starts, and whenever a label leaves the view, its current presence interval ends.Next, a conflict interval (or simply conflict) between two present labels starts and ends at the points in time at which the two labels start and stop intersecting.A temporal labeling is then simply represented as a set of subintervals-the labels' activity intervals, during which the labels are displayed such that no two conflicting labels are displayed simultaneously.Depending on the objective and additional consistency constraints of the labeling model, different sets of subintervals may be chosen by the algorithm.This is a very versatile model, which includes, for instance, map labeling for car navigation systems, in which the map view changes position, angle, and scale according to the car's position, heading, and speed following a particular route; see Fig. 2. To give another, seemingly different example, it also includes the problem of labeling a set of moving entities in a map view (e.g., for tracking vehicles in logistics  applications or planes in air traffic control).Also non-map related applications such as labeling 3D scenes as they occur in medical information systems is covered by our model.Put differently, the model comprises any application in which start and end times of label presences and conflicts can be determined in advance.Further, the conflicts are not restricted to label-label conflicts but may also include label-object conflicts.This flexibility of the abstract model comes at the cost of concealing the geometric information behind the particular problem settings.Hence, one might find faster algorithms for the concrete geometric problem setting.On the other hand, our approach is easily implementable for rather different problem settings.In particular, it splits the problem into two independent sub-problems.The first is about transforming a particular geometric instance into intervals and the second is about finding good activity ranges based on these intervals.We deem both problems to be two relevant research challenges.
Based on this model we introduce the two optimization problems GeneralMax-Total and k-RestrictedMaxTotal.While in the former problem we simply maxi- mize the number of visible labels integrated over time, in the latter problem we further require that at most k labels are active at any time for some constant k.We note that limiting the number of simultaneously active labels is of practical interest as to avoid overly dense labelings, in particular for dynamic maps on small-screen devices such as in car navigation systems.We further refine our model by the three activity models AM1, AM2 and AM3, which introduce special requirements to enforce temporal consistency avoiding flickering when switching labels on and off.
In Sect.3, we investigate the problem GeneralMaxTotal.We first prove that GeneralMaxTotal is NP-complete; in fact it is even W [1]-hard and thus it is unlikely that a fixed-parameter tractable algorithm exists.For the special case of unit-square labels, we give an efficient approximation algorithm with different approximation ratios depending on the actual label activity model.In Sect. 4 we present polynomial-time algorithms for k-RestrictedMaxTotal in AM1 and AM2.For AM3 we show that the problem is NP-hard for k ≥ 2 .Further, for k-Restrict-edMaxTotal we present efficient constant-factor approximation algorithms for all three activity models assuming that all labels are unit squares.

Model
In this section we formally describe our temporal labeling model.In particular, it unifies and generalizes the models presented by Been et al. [1] and by de Berg and Gerrits [6].

Basic Model
We are given a set O = {o 1 , … , o n } of objects in a scene over a given time span T = [0, 1] .Further, for each object o we are given a label , e.g., text describ- ing o.We denote the set of labels by L = { 1 , … , n } , where i is the label of o i .
To quantify the importance of a label, we define for each label ∈ L a positive weight w ∈ ℝ + .
We have a restricted view on the scene through a camera, i.e., the objects are projected onto an infinite plane P such that we can only see a restricted section V of P, where V models the viewport of the camera; see Fig. 3 for an example.During the time interval T , the objects are moving and the camera changes its perspective by changing its position, direction and zoom.We denote the plane P and the viewport V at time t by P(t) and V(t), respectively.Depending on the position of the object o i ∈ O , each label i has a certain shape and position on P(t) at time t; we denote the geometric shape of at time t by (t) .Following typical map labeling models we may assume that (t) is a (closed) rectangle enclosing the text; one may also consider other shapes.In the following, we introduce some further notations to describe the setting precisely.
According to the perspective and position of the camera, not every label (t) is contained in the viewport at time t.We say that a label is present at time t if (t) is (partly) contained in V(t); that is, (t) ∩ V(t) ≠ � .We assume that the time intervals, during which a label is present, are given by a set Ψ of disjoint, closed sub-intervals of T ; see Fig. Two labels and ′ are in conflict at time t ∈ T , if the geometric shapes of both labels intersect, i.e., (t) ∩ � (t) ≠ � .We describe the occurrences of con- flicts between two labels , � ∈ L by a set of closed intervals, and ′ are in conflict for all t ∈ [a, b] and[a,b]is maximal} .For such an interval [a, b] ∈ C , � we also write [a, b] , � indicating that it is a conflict interval between and ′ .We denote the set of all conflict intervals over all pairs of labels by the multiset C.
To avoid overlaps between labels, we display a label only at certain times when no other displayed label overlaps ; the label is said to be active at those times.We describe the activity of , by a set Φ of disjoint intervals. 1For such an interval [a, b] ∈ Φ we also write [a, b] to indicate that the activity interval belongs to .The union of all activity intervals over all labels is denoted by the multi-set Φ.
We say that two activity (presence) intervals [a, b] and [c, d] � of two labels and ′ are in conflict if there is a time t in the intersection of the open intervals (a, b) ∩ (c, d) such that the labels and ′ are in conflict at t.
An instance of temporal labeling is then defined by the set L of labels, the set Ψ of presence intervals and the set C of conflict intervals.We thus completely abstract away the geometry of the problem, while all essential information of the temporal labeling instance is captured combinatorially in Ψ and C .In this paper, we primarily focus on conflict-free label selection, and therefore assume that Ψ and C are given as input.In [3] we describe how to construct Ψ and C for the specific application of navigation systems.
Similarly to Been et al. [1] we require the following temporal consistency criteria: (C1) A label should not be set active and inactive repeatedly to avoid flickering.
(C2) The position and size of a label should be changed continuously, it should not jump.(C3) Labels should not overlap.
We formalize these consistency criteria and say the activity set Φ is valid (see Fig. 4a) if (R1) for each activity interval I ∈ Φ there is a presence interval I � ∈ Ψ with I ⊆ I ′ , (R2) for each presence interval I � ∈ Ψ there is at most one activity interval I ∈ Φ with I ⊆ I ′ , and (R3) no two activity intervals of Φ are in conflict.
Requirement (R1) enforces that a label is only displayed if it is present in the viewport.Requirement (R2) prevents a label from flickering during a presence interval (C1), while (R3) enforces that no two displayed labels overlap (C3).In fact, (R2) is only a minimum requirement for avoiding flickering labels, which we later extend to stronger variants.By assuming that labels' positions are fixed relative to their anchors, labels may not jump (C2) as long as labeled objects are either fixed or move continuously.From now on we assume that an activity set is valid, unless stated otherwise.

Optimization Problems
Based on the introduced model we investigate two optimization problems for temporal labeling that aim to maximize the overall active time of labels.The first problem allows for any number of labels to be active at the same time, and the second allows at most k labels to be active at the same time, which reduces the amount of presented information.We define the weight of an activity interval Figure 5a shows an example of a single frame of a temporal labeling that is optimal with respect to GeneralMaxTotal.While such a labeling is acceptable for general applications such as spatial data exploration, for small-screen devices, such as car navigation systems, the same labeling may overwhelm or distract the user with too much additional information.In fact, psychological studies have shown that untrained users are strongly limited in receiving, processing, and remembering information (e.g., see [19]).For applications that do not receive a user's full attention it is therefore desirable to restrict the number of simultaneously displayed labels (see Fig. 5b), which we formalize as an alternative optimization problem as follows.
Problem 2 (k-RestrictedMaxTotal) ) , such that at any time t at most k labels are active.

Activity Models
So far labels may become active or inactive within the viewport without any external influence, see, e.g., the second activity interval of 3 in Fig. 4a.Hence, the activity behavior of labels, even in an optimal solution Φ , is not necessarily explainable to a user by simple and direct observations such as "the label becomes inactive at time t, because at that moment an overlap starts with another active label".The absence of those simple logical explanations may lead to unnecessary irritations of the user.To account for that we introduce the concept of justified activity intervals.
Consider a label with activity interval [a, b] ∈ Φ .We say that the start of [a, b] is justified if enters the viewport at time a or if there is a witness label ′ such that a conflict of and ′ ends at a and ′ is active at a; see Fig. 4b.
Analogously, we say that the end of [a, b] is justified if leaves the viewport at time b or if there is a witness label ′ such that a conflict of and ′ begins at b and ′ is active at b; see Fig.We distinguish the three activity models AM1, AM2, and AM3 that consider justified activity intervals; see Fig. 6.While for AM1, a label may only become active and inactive when it enters and leaves the viewport, for AM2 it may also become inactive before leaving the viewport if a witness label justifies this event.AM3 further allows a label to become active after entering the viewport if a witness label justifies that event.AM3 An activity set Φ satisfies AM3 if any activity interval [a, b] ∈ Φ is justi- fied.For AM2 one might also consider the symmetric variant in which the activity interval starts in the middle of the presence interval and ends with the presence interval; due to symmetry we do not consider the variant explicitly.We have described only the core of the model.Depending on the application it can be easily extended to more complex variants, e.g., requiring minimum durations of activity intervals.

Solving GeneralMaxTotal
In this section we discuss GeneralMaxTotal.First, we present results on its computational complexity and then we present a simple approximation algorithm for the case that the labels are unit squares.

Computational Complexity
We first prove that the corresponding decision problem of GeneralMaxTotal is NPcomplete with respect to the three activity models.The membership in NP follows from the fact that the start and the end of an active interval may be assumed to coincide with the start or end of a presence interval or a conflict interval.Thus, there is a finite number of candidates for the endpoints of the active intervals so that a solution L can be guessed.Verifying that L is valid in one of the three models and that its value exceeds a given threshold can obviously be checked in polynomial time.
For the NP-hardness we apply a straight-forward reduction from the NP-complete maximum independent set of rectangles problem [7].We simply interpret the set of rectangles as a set of labels with unit weight, choose a short vertical trajectory T and a viewport R that contains all labels at any point of T. Since the conflicts do no change over time, the reduction can be used for all three activity models.By means of the same reduction and Marx' result [16] that finding an independent set for a given set of axis-parallel unit squares is W[1]-hard we derive the next theorem.
Theorem 1 GeneralMaxTotal is NP-hard and [1]-hard for all activity models AM1, AM2, AM3.In particular, the respective decision problem is NP-complete for all activity models AM1, AM2, AM3.
As a consequence, GeneralMaxTotal is not fixed-parameter tractable unless W [1]=FPT.Note that this also means that for k-RestrictedMaxTotal we cannot expect to find an algorithm that runs in O(f (k) ⋅ n c ) time, where c is a constant, n is the number of presence and conflict intervals, and f(k) is a computable function that 1 3 Algorithmica (2020) 82:2709-2736 depends only on the parameter k.Assume for the sake of contradiction that there is an algorithm A k for k-RestrictedMaxTotal with O(f (k) ⋅ n c ) running time.We then could use A k to check whether the input set of unit squares contains an independent set of size as follows.We use the same reduction as above and determine the largest k ∈ {1, … , } for which the solution of A k contains exactly k labels.This par- ticularly implies that for every k ′ with k ′ > k the algorithm A k ′ also yields a solution with k labels.If k = , this implies that the input instance contains an independent set of unit squares, which contradicts that selecting intersection-free unit squares from a set of intersecting unit squares is W[1]-hard.

Approximation of GeneralMaxTotal
We now describe a simple greedy algorithm for GeneralMaxTotal in all three activity models assuming that all labels are unit squares anchored at their lower-left corner.We assume that the map changes via the standard operations panning, rotation and zooming.Further, the weight of each presence interval Starting with an empty solution Φ , our algorithm GreedyMaxTotal removes the maximal interval I from Ψ and adds it to Φ , i.e., the label of I is set active during I.Then, depending on the activity model, it updates all presence intervals that have a conflict with I in Ψ and continues until the set Ψ is empty.
For AM1 the update process simply removes all presence intervals from Ψ that are in conflict with the newly selected interval I.For AM2 and AM3 let I j ∈ Ψ and let I 1 j , … , I k j be the longest disjoint sub-intervals of I j for some k ≥ 0 that are not in conflict with the selected interval I.We assume that I 1 j , … , I k j are sorted by their left endpoint.The update operation for AM2 replaces every interval I j ∈ Ψ that is in conflict with I with I 1 j .As I 1 j is a prefix of I j , selecting I j in a later step satisfies the condition that the label becomes active with the beginning of its presence interval.Further, the conflict with I justifies the end of I 1 j .In AM3 we replace I j by I 1 j if I 1 j is not fully contained in I. Otherwise, I j is replaced by I k j .Note that this discards some candidate intervals, but the chosen replacement of I j is enough to prove the approxi- mation factor.We observe that due to the conflicts with I (and possibly other intervals chosen in a previous step) the new interval is justified.Note that after each update all intervals in Ψ are valid choices according to the specific model.Hence, we can conclude that the result Φ of GreedyMaxTotal is also valid in that model.
In the following, we analyze the approximation quality of GreedyMaxTotal.To that end we first introduce a purely geometric packing lemma.Similar packing lemmas have been introduced before, but to the best of our knowledge for none of them it is sufficient that only one prescribed corner of the packed objects lies within the container.

√
2 in the plane and let Q be a set of non- intersecting closed and axis-parallel unit squares with their bottom-left corner in C. Then Q cannot contain more than eight squares.

3
Proof First, we show that Q cannot contain more than nine squares and extend the result to the claim of the lemma.We begin by proving the following claim.
(S) At most three squares of Q can be stabbed by a vertical line.In order to prove (S) let Q ′ ⊆ Q be a set of squares that is stabbed by an arbitrary vertical line l and let q t be the topmost square stabbed by l and let q b be the bottommost square stabbed by l.Since both the bottom-left corner of q t and q b are in C, their vertical distance is at most 2 √ 2 .Consequently, there can be at most one other square in Q ′ that lies in between q t and q b , which shows the claim (S).Now let l 1 be the left vertical tangent of C and let l 2 be its right vertical tangent; see Fig. 7.We define Q l ⊆ Q to be the set of squares whose bottom-left corner has distance of at most 1 to l 1 .Hence, there is a vertical line that stabs all squares in Q l .By (S) it follows that |Q l | ≤ 3 .We can analogously define the set Q r ⊆ Q whose bottom-left corner has distance of at most one to the vertical line l 2 .By the same argument it follows that |Q r | ≤ 3 .Further, the bottom-left corners of the squares Hence, there is a vertical line that stabs all squares of Q m and |Q m | ≤ 3 follows.We conclude that the set Q contains at most nine squares; in fact, |Q| ≤ 8 as we show next.
For the sake of contradiction we assume that |Q| = 9 , i.e., We denote the topmost square in Q l by t l and the bottommost square by b l , and define t r and b r for Q r analogously.Further, let s m be the vertical line through the center of C, let s l be the vertical line that lies one unit to the left of s m and let s r be the vertical line that lies one unit to the right of s m .Note that the length of the segment of s l and s r that is contained in C has length 2. Since the bottom-left corners of t l and b l have vertical distance strictly greater than 2, both squares lie to the right of s l .Hence, t l and b l intersect s m .Analo- gously, the bottom-left corners of t r and b r lie to the left of s r , and, hence intersect s r .The line s m is intersected by two squares of Q l .By (S) there can be at most one additional square of Q m that intersects s m .Thus, there are two squares in Q m whose anchors lie to the right of s m .But then they both intersect s r which itself is already intersected by at least the squares t r and b r .This is a contradiction to (S), and con- cludes the proof.◻ Algorithmica (2020) 82:2709-2736 Figure 8 shows that the bound is tight.Based on Lemma 1 we now show that for any label with anchor p there is no point of time t ∈ [0, 1] for which there can be more than eight active labels whose anchors are within distance √ 2 of p.We call a set X ⊆ Ψ conflict-free if it contains no pair of presence intervals that are in conflict.Further, we say that X is in conflict with I ∈ Ψ if every element of X is in conflict with I, and we say that X contains t ∈ [0, 1] if every element of X contains t.
Lemma 2 For every t ∈ [0, 1] and every I ∈ Ψ any maximum cardinality conflict- free set X I (t) ⊆ Ψ that is in conflict with I and contains t satisfies |X I (t)| ≤ 8.
Proof Assume that there is a time t and an interval I such that there is a set X I (t) that contains more than eight intervals.Let be the label that corresponds to I.For an interval I � ∈ X I (t) to be in conflict with I the anchors of the two corresponding labels must have a distance of at most √ 2 .Hence, there are |X I (t)| labels corresponding to the intervals in X I (t) with anchors of distance at most √ 2 to the anchor of .By Lemma 1 we know that two of these labels must overlap.This implies that there is a conflict between the corresponding intervals contained in X I (t) , which is a contra- diction. ◻ With this lemma we can finally obtain the approximation guarantees for Greedy-MaxTotal for all activity models.Consider the model AM1.Since I is the longest interval in Ψ when it is chosen, the intervals in C I are completely contained in J = [a − w(I), b + w(I)] .As C I con- tains all presence intervals that are in conflict with I, it is sufficient to consider J to bound the effect of selecting I. Obviously, the interval J is three times as long Analogously, for AM3 we can argue that it is sufficient to consider the interval J = [a, b] .By definition of the update operation of GreedyMaxTotal at least the prefix or suffix subinterval of each [c, d] � ∈ C I remains in Ψ that extends beyond I (if such an interval exists).Thus, selecting I influences only the interval J and its cost is at most 8w(I).The approximation bounds of 1/24, 1/16, and 1/8 follow immediately.
We use a binary search tree to achieve the time complexity O(n log n) of Greedy- MaxTotal for AM1.We first add all intervals sorted by their weights to the binary tree.We then successively remove the intervals with maximal weight and its conflicting neighbors.As each interval is inserted and removed exactly once, we obtain O(n log n) running time.For AM2 and AM3 we use a linear sweep to identify the longest interval contained in Ψ .In each step we need O(n) time to update all inter- vals in Ψ , and we need a total of O(n) steps.Thus, GreedyMaxTotal needs O(n 2 ) time in total for AM2 and AM3.◻ In case that we exclude rotation as an operation and only consider panning and zooming, we can improve the approximation by a factor of two, as we can use a more restrictive packing argument instead of Lemma 1.
Observation 1 Let S be a square with side length 2 in the plane and let Q be a set of non-intersecting closed and axis-parallel unit squares with their bottom-left corner in S. Then Q cannot contain more than four squares.
With this observation we can strengthen Lemma 2 and thus Theorem 2 by a factor of two and hence obtain the following corollary.

Solving k-RestrictedMaxTotal
In this section we prove that unlike GeneralMaxTotal the problem k-Restrict-edMaxTotal can actually be solved in polynomial time for AM1 and AM2.We give a detailed description of our algorithm for AM1, and then show how it can be extended to AM2.Note that solving k-RestrictedMaxTotal is related to finding a maximum cardinality k-colorable subset of n intervals in interval graphs.This can be done in polynomial time in both n and k [5].However, we have to consider additional constraints due to conflicts between labels, which makes our problem more difficult.First, we discuss how to solve the case for k = 1 and then give an algorithm that solves k-RestrictedMaxTotal for k > 2 .Altogether, we obtain an algorithm that runs in O(n f (k) ) time, where f is a polynomial function.Hence, k-Restricted-MaxTotal lies in the complexity class XP for AM1 and AM2.Due to the [1]-hardness of GeneralMaxTotal, we cannot expect running times in O(f (k) ⋅ n c ) , where f is a computable function and c is a constant.In contrast, for AM3 we prove that k-RestrictedMaxTotal is NP-hard for k ≥ 2 .Since the running times of the pre- sented algorithms for AM1 and AM2 are, even for small k, prohibitively expensive in practice, we finally propose an approximation algorithm for k-RestrictedMaxTotal in all three activity models.

An Algorithm for k-RestrictedMaxTotal in AM1
In this section we present a dynamic programming approach for computing an optimal solution for an instance (L, Ψ, C) of k-RestrictedMaxTotal in AM1.The approach is based on the idea to systematically identify and solve smaller subinstances that are independent from each other.As separators of these sub-instances we systematically explore all choices of k intervals that have a point in time in common.More precisely, a separating k-tuple ⃗ v is a set of k presence intervals that are not in conflict with each other and that have a non-empty intersection We observe that a separating k-tuple ⃗ v contained in a solution of k-RestrictedMaxTotal splits the set of presence intervals into two independent subsets.Specifically, a left (right) subset contains only intervals which lie completely to the left (right) of K ⃗ v and are not in conflict with any interval of ⃗ v ; see Fig. 9.
v { Fig. 9 The separating 3-tuple (orange) splits the set of presence intervals into a left and right subinstance (blue).The presence intervals (gray) intersecting K ⃗ v (green box) cannot be selected since at most three labels can be active at the same time (Color figure online) Given two separating k-tuples ⃗ u and ⃗ v (where K ⃗ u lies to the left of We observe that with respect to these conditions the activity set Φ respects the sepa- rating tuples ⃗ u and ⃗ v , but Φ does not contain any intervals of ⃗ u and ⃗ v .We call ⃗ u and ⃗ v the boundary separating k-tuples of Φ. We define the algorithm A k recursively such that it uses A k−1 as subroutine.Ini- tially, for the input instance we call A k (d l , d r ) where d l and d r are two dummy sepa- rating k-tuples such that the presence intervals of d l are strictly to the left of 0 and the presence intervals of d r are strictly to the right of 1.Since all original presence intervals are completely contained in [0, 1], every optimal solution contains both dummy separating k-tuples.
So assume in the following that the algorithm A k is called with the two separat- ing k-tuples ⃗ u and ⃗ v and let . We first explain how to solve the base case k = 1 and then present the algorithm for k > 1.
Case k = 1 .First note that for the case that at most one label can be active at any given point in time ( k = 1 ), conflicts between labels do not matter.Thus, for solving 1-RestrictedMaxTotal it is sufficient to find an independent subset of Ψ of maxi- mum weight.This is equivalent to finding a maximum weight independent set on interval graphs, which can be done in O(n 2 ) time using dynamic programming given n sorted intervals [13].The algorithm basically computes a table T 1 indexed by the intervals in X, where an entry T 1 [I j ] stores the value of a maximum weight independ- ent set Q of L 1 [I j ] and a pointer to the rightmost interval in Q.Hence, using this approach we obtain an activity set Φ .As no interval of X intersects any interval of the singletons ⃗ u and ⃗ v , the set Φ also satisfies the conditions (C1)-(C3) from above.Case k > 1 .We say that a separating k-tuple ⃗ v is smaller than a separating k-tuple ⃗ w if K ⃗ v begins to the left of K ⃗ w .Ties are broken arbitrarily.This lets us define the ordered set S k = {⃗ v 1 , … , ⃗ v z } of all separating k-tuples of X.In order to ease notation we denote the given boundary separating k-tuples ⃗ u by ⃗ v 0 and ⃗ v by ⃗ v z+1 .Further, we say a set C of presence intervals is k-compatible if no more than k intervals in C intersect at any point and there are no conflicts in C. Two separating k-tuples ⃗ x and ⃗ y are k-compatible if they are disjoint, i.e., they have no interval in common, and ⃗ x ∪ ⃗ y is k-compatible.Further, for a separating k-tuple ⃗ x let l k−1 (⃗ x) be the set of the k − 1 intervals of ⃗ x whose right end points are rightmost; in case that this is not uniquely defined, we choose any of those subsets.Analogously, let r k−1 (⃗ x) be the set of the k − 1 intervals of ⃗ x whose left end points are leftmost.We observe that l k−1 (⃗ x) and initialize T k [⃗ v 0 ] = 0 .Then, the remaining entries of T k can be obtained by comput- ing (see also Fig. 10) we also store for each separating k-tuple v j the separating k-tuple v i for which the expression above is maximized; we define pred(⃗ v j ) = ⃗ v i .Starting a standard backtracking procedure at ⃗ v z+1 we obtain a activity set Φ(⃗ v z+1 ) recursively defined by As the result of the algorithm we return the set Φ = Φ(v z+1 ) ⧵ (⃗ v 0 ∪ ⃗ v z+1 ) .Hence, Φ is an activity set for the instance X.
For the case k = 1 this is clearly the case.So assume k > 1 .Since A k considers only solutions where adjacent separating k-tuples are k-compatible with each other and both boundary k-tuples, we cannot invalid solution, i.e., a solution with conflicts or more than k active intervals at any point.Hence, both condition (C1) and (C2) are satisfied.We prove condition (C3) by contradiction.So assume that there is an instance X for which A k does not compute an optimal solution and let OPT be an optimal solution.There must be a smallest separating k-tuple ⃗ v j , j > 0 , for which there are at most k − 1 active intervals at any point (otherwise ⃗ v i is not rightmost).This means that when we run algorithm A k−1 on that instance with the boundary tuples l k−1 (⃗ v i ) and r k−1 (⃗ v j ) , we obtain by the Fig. 10 Illustration for computing the table entry T k [⃗ v j ] for k = 3 .The intervals K ⃗ v i and K ⃗ v j are marked in green.The dotted intervals illustrate the optimal solution represented by T k [⃗ v i ] .The separating k-tuples (orange) enclose an instance for 2-RestrictedMaxTotal (blue).The algorithm A 2 (l 2 (⃗ v i ), r 2 (⃗ v j )) computes an optimal solution (blue intervals) for that instance respecting ⃗ v i and ⃗ v j (Color figure online) induction hypothesis a solution that is at least as good as the restriction of OPT to that instance.Since , which is at least as good as OPT restricted to L k [⃗ v j ] .This is a contradiction and proves condition (C3).
For proving the time and space complexity let z i be the number of separating i-tuples in an instance for 1 < i ≤ k .Each z i is in O(n i ) .We again use induction on k.Algorithm A 1 needs O(n 2 ) and O(n) space, which match the bounds to be shown.So let k > 1 .The table T k has O(z k ) ⊆ O(n k ) entries and each of the recur- sive computations of A k−1 need O(n k−1 ) space by the induction hypothesis.Thus the overall space is dominated by T k and the bound follows.Checking whether a separat- ing k-tuple ⃗ v i ∈ S k is a feasible predecessor for a particular ⃗ v j can easily be done in O(k 2 ) time, which dominated by the time to compute for the running time we observe that each entry in . ◻

Extending the Algorithm for k-RestrictedMaxTotal to AM2
With some modifications and at the expense of another polynomial factor in the running time we can extend algorithm A k of the previous section to the activity model AM2, which shows that k-RestrictedMaxTotal in AM2 can still be solved in poly- nomial time.In the following, we give a sketch of the modifications.The important difference between AM1 and AM2 is that presence intervals can be truncated at their right side if there is an active conflicting witness label causing the truncation.We need two modifications to model this behavior.First, we create for each original presence interval , where c ij is the start of the first conflict between I i and I j ∈ Ψ .Each interval I j i inherits the conflicts of I i that intersect I j i .We obtain a modified set of presence intervals Ψ � = Ψ ∪ {I j i | I i , I j ∈ Ψ and I i , I j in conflict} of size O(n 2 ) .We create mutual con- flicts among all intervals that are prefixes of the same original interval.This will enforce that at most one of them is active.We still have to take care that a truncated interval I j i can only be active if I j (or a prefix of I j ) is active at c ij as a witness.In order to achieve this we instantiate the algorithm A k ′ for every k ′ ≤ k not only with its two boundary k-tuples ⃗ v 0 and ⃗ v z+1 but also with a set W of at most k witness intervals that are k-compatible and must be made active at some stage of the algorithm.In a valid solution we have However, the truncated intervals in ⃗ v themselves define a family of O(n k � ) possible witness sets W(⃗ v) to be respected to the right of ⃗ v .So when we compute the table entry for a separating k ′ -tuple ⃗ v j and consider a particular predecessor k ′ -tuple ⃗ v i we must in fact iterate over all possible witness sets W(⃗ v i ) as well.We need to make sure that For the recursive call to 1 3 Algorithmica (2020) 82:2709-2736 , those witness inter- vals of W(⃗ v i ) that are not part of ⃗ v j .The increase in running time is caused by dealing with O(n 2 ) intervals in Ψ � and by the fact that instead of one call to A k−1 ( ⃗ v i , ⃗ v j ) in the computation of table T k we make O(n k ) calls, one for each possible witness set of ⃗ v i .By an inductive argument one can show that the running time is in O(n 3k 2 +2k ).

Complexity of k-RestrictedMaxTotal in AM3
In this section we discuss the complexity of k-RestrictedMaxTotal with respect to AM3.For k = the problem is equivalent to finding a maximum weighted independent set on interval graphs, which can be done in linear time [13].
We show that the corresponding decision problem, which is defined as follows, is NP-complete for k ≥ 2.

Given:
Instance I = (L, Ψ, C) , k ∈ ℕ and W ∈ ℝ + .Question: Is there an activity set Φ for I such that

at most k labels are active at the same time?
We first show that the decision problem is NP-hard for k ≥ 2 , which implies that the corresponding optimization problem is NP-hard as well.We reduce from the NP-complete problem 3-Partition.For the convenience of the reader, we repeat the definition given by Garey and Johnson [8].

Given:
Set X of 3m elements, bound B ∈ ℤ + , and a size s(x) Note that each X i must contain exactly three elements.We first present a con- struction that transforms a given instance I of 3-Partition into an instance I ′ of k-RestrictedMaxTotal.As the construction is rather technical, we give a short sketch beforehand discussing the main ideas.Afterwards, we present the formal details.Finally, we show that I is a yes-instance of 3-Partition if and only if I ′ is a yes-instance of k-RestrictedMaxTotal with respect to AM3.

Sketch.
The construction is schematically illustrated in Fig. 11 and an example for a concrete instance of 3-Partition is given in Fig. 12.We observe that 3-Partition can be slightly reformulated as follows.Let  ⊆ X be a triplet such that the three elements in are mutually distinct and ∑ x∈ s(x) = B and let T = { 1 , … , h } denote the set of all these triplets.The problem 3-Partition is then equivalent to selecting a subset T ′ ⊆ T with size m such that each element x ∈ X is contained in exactly one triplet ∈ T � .We model this selection problem using three groups of labels.The first group consists of a single label K .We choose its presence interval appropriately long in order to enforce that it is active for its complete presence interval.Further, for all other labels we will choose their presence intervals such that they are contained in K 's presence interval.By introducing conflicts between K and these labels, this provides us with the possibility of defining exact ranges in which a label can be active during its presence interval.The second group L con- sists of 3m labels each representing one element of X.In our construction we will enforce that the label x ∈ L of each element x ∈ X is active for exactly s(x) time.Further, we ensure that its activity interval can be uniquely assigned to one of the triplets in T that contains x.The third group L consists of h − m many labels repre- senting the triplets in T that are not selected in a solution.More precisely, we ensure for each label in L that its activity interval is uniquely assigned to one of the triplets in T such that we interpret this label as not selected for the solution.
Further, we ensure that if a label x ∈ L is active for triplet , then no label of L is active for .Choosing W appropriately, we enforce that all defined labels must have an activity interval.Depending on the chosen activity intervals we then derive a solution for 3-Partition.

Details.
Let s max = max x∈X s(x) .We first construct every triplet  ⊆ X such that the three elements in are mutually distinct and ∑ x∈ s(x) = B .Let T = { 1 , … , h } denote the set of those triplets.For each triplet i ∈ T we fix an arbitrary order of its elements, and denote its j-th element by j i (with j ∈ {1, 2, 3} ).We define In case that h < m , the given instance is a no-instance.Hence, in the following we assume that m ≥ h .For each element x ∈ X we create one label x with presence interval Let L denote the set of those labels, and let l 1 denote the common length of those intervals.The interval I can be partitioned into a set S of 3h intervals of length s max and a set U of 3h + 1 intervals of unit length such that the intervals in S and U alter- nate, starting with an interval of U ; see Fig. 11.We call an interval in S a slot.We denote the slots by S 1 = [a 1 , b 1 ], … , S 3h = [a 3h , b 3h ] in increasing order, i.e., a i < a j for i < j .We say that the slots S 3i−2 , S 3i−1 and S 3i belong to the triplet i ( 1 ≤ i ≤ h).Thus, for each x i we have a slot S i with 1 ≤ i ≤ 3h .In our construction we will enforce that a label x ∈ L can only be active during a slot S i ( 1 ≤ i ≤ 3h ) if y i = x .More precisely, we define Times for which a label ∈ L ∪ L is in conflict with K are marked red.For each label its activity interval is blue.Further, for each label x ∈ L the other times when it can possibly be active are marked orange.The solution is 1 = {x 1 , x 3 , x 5 } , 3 = {x 2 , x 6 , x 7 } and 4 = {x 4 , x 8 , x 9 (Color figure online) Thus, S x,i ⊆ S i .We will enforce that x can only be active during S x,i .To that end we introduce a single label K with presence interval where we choose M > 3l 1 .We denote the length of K by l 2 and note that l 2 ≥ 2M.
For each x ∈ X we introduce conflicts between x and K such that x and K are not in conflict at time t if and only if there is an i with 1 ≤ i ≤ 3h and t ∈ S x,i .Put differently, x and K are in conflict during the time expressed by Assume that K is active during the complete interval [0, l 1 ] , then any label x with x ∈ X can only be active during ⋃ 3h i=1 S x,i .Since the slots are disjoint, S x,i ⊆ S i , and each label can only be active once per presence interval, each label x can only be active during at most one slot S i , but not outside of a slot.Further, the element x must contained the corresponding triplet j with j = ⌈ i 3 ⌉.Moreover, we introduce h − m labels with presence interval I.We denote the set of these labels by L .We define that any label ∈ L and K are in conflict during the time expressed by Thus, is not in conflict with K during any interval T i = [a 3i−2 , b 3i ] (with 1 ≤ i ≤ h ), which spans the slots S 3i−2 , S 3i−1 , S 3i the i .We note that the length of T i is l 3 = 3s max + 2 .We further define that the labels in L ∪ L are pairwise in conflict during the complete interval I, which implies that at most two labels can be active at any time, namely K and at most one label of L ∪ L .Finally, for any constructed label we set w = 1 and define Hence, we have w([a, b] ) = (b − a) for any presence/activity interval of .
Altogether, we obtain the instance I � = (L = L ∪ { } ∪ L , Ψ, C, W) , which can obviously be constructed in polynomial time with respect to the given 3-Partition instance I .Lemma 3 Let I be an instance of 3-Partition and let I ′ be an instance of k-Restrict-edMaxTotalDecision (k ≥ 2) with respect to AM3 constructed from I as described.The instance I is a yes-instance if and only if I ′ is a yes-instance.
Algorithmica (2020) 82:2709-2736 Proof First assume that I is a yes-instance of 3-Partition.Let T ′ ⊆ T be the set of the m triplets such that each element x ∈ X is contained in exactly one triplet of T ′ and the sizes of the elements in each triplet of T ′ sum up to B. We now construct an activity set Φ for I ′ with weight W Φ ≥ W .To that end we first set K active for the interval K. Thus, W Φ ≥ l 2 .Further, for each triplet ∈ T � and each element x ∈ we add the slot S x,i to Φ , where 1 ≤ i ≤ 3h , x = x and S x,i belongs to By construction x is not in conflict with K during S x,i , but directly before and after that interval.Since K is completely contained in Φ , the label K is also active directly before and after that interval, which altogether satisfies AM3.Further, only two labels are at the same time.This follows directly from the fact that the slots are disjoint and we set for each slot at most two labels active, namely x and K .Since each added interval S x,i has length s(x) and each x belongs to exactly one triplet ∈ T � , the activity set Φ now has weight For each such triplet i j we know by construction that no label x ∈ L is active during T i j .Hence, we set the label j active during the interval T i j .Since j is in conflict with K directly before and after T i j , the model AM3 is satisfied.Further, since T i 1 , … , T i h−m are pairwise disjoint, at most two labels are active at the same time.In total we obtain a valid activity set Φ with weight Hence, Φ is a solution for k-RestrictedMaxTotalDecision for any k ≥ 2. Now assume that I ′ is a yes-instance of k-RestrictedMaxTotal ( k ≥ 2 ) with respect to AM3, i.e., we are given an activity set Φ for I ′ with W Φ ≥ W .We show how to construct a valid solution for I.
Recall that since the labels in L ∪ L are pairwise in conflict for the complete interval I, for any k ≥ 2 at most two labels can be active at the same time, namely K and one label of L ∪ L .
We now argue that K is active for the complete interval [0, l 1 ] .If this was not the case, then the prefix [−M, 0] or the suffix [l 1 , l 1 + M] of K cannot belong to the activity of K .Further, for the interval [0, l 1 ] we obtain less than 2 3 M weight in total, because at most two labels can be active at the same time and l 1 < M 3 .Thus, we obtain W Φ < M + 2 3 M < 2M .On the other hand, because of l 2 ≥ 2M and W Φ ≥ W , we have W Φ ≥ 2M , which is a contradiction.On that account, the label K is active during the complete interval [0, l 1 ] .It is even active for the complete interval K to sustain the requirements of AM3.As reasoned previously, the activity interval of any label ∈ L must be thus contained in one of the slots S 1 , … , S 3h ; otherwise there would be an unresolved conflict between and K .Similarly, the activity interval of any label ∈ L must be contained in one of the intervals T 1 , … , T h .
By the construction of the conflicts, a label x ∈ L can be active for at most s(x) time and a label i ∈ L can be active for at most l 3 time.Due to W Φ ≥ W , each label x ∈ L x is therefore active for exactly s(x) time and, consequently, there is a slot S x,i with 1 ≤ i ≤ 3h that is the activity interval of x .Similarly each label ∈ L is active for exactly l 3 time and, consequently, there is an interval T i with 1 ≤ i ≤ h that is the activity interval of .More precisely, there are m triplets i 1 , … , i m such that the activity intervals of the labels in L are contained in ⋃ m j=1 T i j .To see that, consider any label ∈ L .By the previous reasoning there is a triplet i with 1 ≤ i ≤ h such that the activity inter- val T i of contains S 3i−2 , S 3i−1 , S 3i .This implies that no label x ∈ L with x ∈ i can be active during T i .Since no two labels , � ∈ L can active during the same interval T i and |L = h − m , the m remaining intervals T i 1 , … , T i m contain the activ- ity intervals of the labels in L .
Those triplets i 1 , … , i m form the desired solution for I : Since label x ∈ L is active for exactly one interval, each element x ∈ X is contained in exactly one tri- plet i j with 1 ≤ j ≤ m .Further, we have ∑ x∈ i j s(x) = B , which concludes the proof.

◻
The lemma directly implies that the problem k-RestrictedMaxTotal is NP-hard for k ≥ 2 and AM3.Moreover, it is easy to see that the decision problem is in NP.For each label ∈ L we guess intervals that are contained in the presence inter- vals of and whose beginnings and ends coincide with the beginnings and ends of presence and conflict intervals in Ψ ∪ C .We further check whether the intervals are valid activity intervals with respect to AM3, whether their weights sum up at least to and labels at the same time.Obviously this takes time polynomial in the size of the input.We summarize the results of this section in the following theorem.We observe that from a computational point of view this hardness result justifies the use of AM2.While AM2 is more flexible then AM1, it is less difficult to solve than AM3.It is an open question, whether k-RestrictedMaxTotal in AM3 remains NP-hard for k ≥ 2 if the concrete geometric setting is also taken into account.For example, in case that the viewport follows a predefined trajectory, does this help to solve the problem in polynomial time?

Approximation of k-RestrictedMaxTotal
Since the running times of our algorithms for k-RestrictedMaxTotal are, even for small k, prohibitively expensive in practice, we propose an approximation algorithm for k-RestrictedMaxTotal based on GreedyMaxTotal for all activity models.
Our algorithm GreedyRestrictedMaxTotal is a simple extension of Greedy-MaxTotal.Recall that GreedyMaxTotal greedily removes the longest interval I from Ψ and adds it to the set Φ that contains the active intervals of the solution.Then, it updates all intervals contained in Ψ that are in conflict with I.This process is repeated until Ψ is empty.For approximating k-RestrictedMaxTotal we need to 1 3 Algorithmica (2020) 82:2709-2736 ensure that there is no point in time t that is contained in more than k intervals in Φ .We call intervals which we cannot add to Φ without violating this property invalid.
Our modification of GreedyMaxTotal is as follows.After adding an interval I to Φ and handling conflicts as before, we remove intervals from Ψ that became inva- lid.We say that we ensure that I is valid.Note that we cannot shorten those intervals because then we could not ensure that adding an interval from Ψ to Φ is valid according to our model.
In order to prove approximation ratios we first introduce the following lemma that describes the structure of a solution of k-RestrictedMaxTotal.

Lemma 4 ([12]
) Let S be a set of intervals such that there is no number that is contained in more than k intervals from S. Then, there is a partition S into k sets M 1 , , M k , such that no two intersecting intervals are in the same set M i .
For the proof we refer to [12].With this lemma we now can prove the following theorem that makes a statement about the approximation ratio of GreedyRestrictedMaxTotal .Let L be a fixed, but arbitrary optimal solution.If I ∈ L , there is no lost weight compared to the optimal solution when choosing I.
Thus, assume that I ∉ L .Let C(I) ⊆ L be the set of intervals that are in conflict with I. Identically to the proof of Theorem 2 we can argue that w(C(I)) = ∑ I∈C w(I) ≤ (4 − X) ⋅ 8 ⋅ w(I) considering activity model AMX with X ∈ {1, 2, 3}.
We now show that at most 3w(I) weight of the optimal solution is lost when ensuring that I is valid.
By Lemma 4 we can partition L into k sets M 1 , … , M k such that no two inter- secting intervals are in the same set M i .If I is in L , then we do not lose any weight compared to the optimal solution.Hence, assume that I is not in L .Take any M i , 1 ≤ i ≤ k , remove all intervals of L ⧵ Φ that intersect I.We denote the set of removed intervals by R. In the following, we bound the cost of removing the intervals in R. If there are intervals in R that are longer than I, then we have already accounted for them in previous steps.This relies on the fact that we consider the intervals sorted by their length in non-ascending order, and, hence if those longer intervals are not in Φ , we must have removed them in an earlier step.Thus, we only need to bound the length of intervals in R which have length at most w(I).Those intervals must lie in J, and due to the definition of M i they must be disjoint.Hence, the cost for ensuring that I is valid is bounded by 3w(I).
For k < 8 we can improve w(C(I)) ≤ (4 − X) ⋅ 8 ⋅ w(I) to w(C(I)) ≤ (4 − X) ⋅ k ⋅ w(I) considering activity model AMX with X ∈ {1, 2, 3} because we know that I cannot be in conflict with more than k intervals of the optimal solution.Thus, we can bound the loss of choosing I by 3w(I) + (4 − X) ⋅ k ⋅ w(I) .In total this yields the claimed approximation ratios for the three activity models.
Finally, we argue the correctness of the claimed running time of O(n 2 ) .Since the worst-case running time of GreedyMaxTotal is O(n 2 ) we only need to argue that we can delete those intervals from Φ , which are not valid anymore, in O(n) time per step.To do this we simply the intervals in Ψ in non-decreasing order by their left-endpoint.We also maintain Φ in the same way.Then, we can check for non- valid intervals with a simple linear sweep over Ψ and Φ .Hence, each iteration of the algorithm requires O(n) time, which yields a total running time of O(n 2 ) .◻

Conclusions
In this paper, we introduced a temporal model for dynamic map labeling that satisfies the consistency criteria demanded by Been et al. [1], even in a stronger sense, where each activity change of a label must be explainable to the user by some witness label.Our model transforms the geometric information specified by the motion of the camera as well as the labels into the two combinatorial problems General-MaxTotal and k-RestrictedMaxTotal that are expressed in terms of presence and conflict intervals.Thus, our algorithms apply to any dynamic labeling problem that can be transformed into such an interval-based problem.We showed that GeneralMaxTotal is NP-complete and W[1]-hard and presented constant-factor approximation algorithms for our three different activity models.The problem k-RestrictedMaxTotal, where at most k labels can be visible at any time, can be solved in polynomial time O(n f (k) ) in activity models AM1 and AM2 for any fixed k, where f is a polynomial function.Hence, k-RestrictedMaxTotal lies in the complexity class XP for AM1 and AM2.Due to the W[1]-hardness of General-MaxTotal we cannot expect to find better results for the running times, apart from improving upon the function f.Further, we proved NP-hardness for k-Restricted-MaxTotal in AM3 for k ≥ 2 .We also presented an O(n 2 )-time approximation algo- rithm for k-RestrictedMaxTotal in all three activity models.
The analysis of the approximation algorithms for both k-RestrictedMaxTotal and GeneralMaxTotal relies on the assumption that labels are unit squares.We can soften this assumption by bounding the ratio between the largest and smallest label size.We observe, that the core of our packing arguments remains valid obtaining constant-factor approximations for this setting as well.However, the more the label size ratio increases, the more the approximation ratios decline.

Fig. 1
Fig. 1 Illustration of interactive maps providing zooming, panning, and rotation as user interaction

Fig. 2 3
Fig. 2 Trajectory-based labeling.a Viewport moves and aligns along a given trajectory (fat orange line).Labels align to the viewport.b The user's view on the scene

4 .Fig. 3 Fig. 4 1 3
Fig. 3 Model.a Overall view of the scene.Depending on the rotation, translation, and zoom, the camera shoots a restricted part of the scene.The objects to be labeled are represented by black dots.b The corresponding viewport of the camera.The labels are placed near their objects

Fig. 5 3
Fig.5 Frame of a dynamic map labeling.While in a 54 labels are displayed at the same time, in b 10 labels are displayed in order to limit the informational content 4c.If both the start and end of [a, b] are justified, then [a, b] is justified.

Fig. 7
Fig. 7 Illustration for the proof of Lemma 1

Theorem 2
Assuming that all labels are unit squares and w([a, b]) = b − a , Greedy- MaxTotal is a 1/24-, 1/16-, 1/8-approximation for AM1-AM3, respectively, and needs O(n log n) time for AM1 and O(n 2 ) time for AM2 and AM3.Proof To show the approximation ratios, we consider an arbitrary step of Greedy-MaxTotal in which the presence interval I = [a, b] is selected from Ψ .Let C I be the set of presence intervals in Ψ that are in conflict with I.

Fig. 8 2 C
Fig. 8 Example configuration of eight axis-aligned, nonintersecting, unit-squares whose bottom-left corners lie inside a circle C of radius √ 2

3
r k−1 (⃗ x) are separating k − 1-tuples; in the recursion step we use l k−1 (⃗ x) and r k−1 (⃗ x) as left and right boundary separating k − 1-tuples, respectively.The algorithm A k fills a one-dimensional table T k .Similarly to the case k = 1 , each entry T k [⃗ v] stores the value of the optimal solution for L k [⃗ v] .Then the solution of the given subinstance bounded by ⃗ v 0 and ⃗ v z+1 can be obtained from T k [⃗ v z+1 ] .We 1 Algorithmica (2020) 82:2709-2736

Theorem 3
Algorithm A k solves k-RestrictedMaxTotal in AM1 in O(n k 2 +k−1 ) time and O(n k ) space.Proof We first show the correctness of A k by induction on k.Given two separating k-tuples ⃗ u and ⃗ v (where ⃗ u is smaller than ⃗

Fig. 11 3
Fig. 11 Illustration of the construction used for the reduction from 3-Partition to k-RestrictedMaxTotal. Times for which a label ∈ L ∪ L is in conflict with K are marked red.For each label x ∈ L the times when it can possibly be active are marked orange (Color figure online)

Theorem 5
For k = 1 the problem k-RestrictedMaxTotal can solved in linear time for AM3, while k-RestrictedMaxTotalDecision is NP-complete for k ≥ 2.