動態地圖標註算法

Dynamic maps that allow continuous map rotations, e.g., on mobile devices, encounter new issues unseen in static map labeling before. We study the following dynamic map labeling problem: The input is a static, labeled map, i.e., a set P of points in the plane with attached nonoverlapping horizontal rectangular labels. The goal is to find a consistent labeling of P under rotation that maximizes the number of visible labels for all rotation angles such that the labels remain horizontal while the map is rotated. A labeling is consistent if a single active interval of angles is selected for each label such that labels neither intersect each other nor occlude points in P at any rotation angle. We first introduce a general model for labeling rotating maps and derive basic geometric properties of consistent solutions. We show NP completeness of the active interval maximization problem even for unitsquare labels. We then present a constant-factor approximation for this problem based on line stabbing, and refine it further into an efficient polynomial-time approximation scheme (EPTAS). Finally, we extend the EPTAS to the more general setting of rectangular labels of bounded size and aspect ratio.html

動態地圖,容許連續的地圖旋轉,例如,在移動設備上,遇到了新的問題,在靜態地圖標籤以前看不見。咱們研究瞭如下動態地圖標註問題:輸入是一個靜態的有標籤的地圖,即平面上帶有不重疊水平矩形標籤的點集P。目標是在旋轉下找到一致的P標記,使在全部旋轉角度下的可見標記數最大化,這樣當地圖旋轉時,標記保持水平。標記將是持續的,若是爲每一個標記選擇了單一的角度活動區間,使得標記在任何旋轉角度上既不相互交叉,也不遮擋P中的點。本文首先介紹了地圖旋轉標註的通常模型,推導了一致解的基本幾何性質。咱們證實了即便是單位平方標籤它的極大化活動區間問題仍然是NP徹底的(http://www.javashuo.com/article/p-dbsmfvmm-ga.html)。在此基礎上,咱們提出了一種基於線刺法的常因子逼近方法,並進一步改進爲一種有效的多項式時間近似格式(EPTAS)。最後,咱們將EPTAS擴展到有界尺寸和長寬比的矩形標籤的更通常的設置。react

1 Introductionios

Dynamic maps, in which the user can navigate continuously through space, are becoming increasingly important in scientific and commercial GIS applications as well as in personal mapping applications. In particular GPS-equipped mobile devices offer various new possibilities for interactive, location-aware maps. A common principle in dynamic maps is that users can pan, rotate, and zoom the map view. Despite the popularity of several commercial and free applications, relatively little attention has been paid to provably good labeling algorithms for dynamic maps.算法

用戶能夠在空間連續導航的動態地圖,在科學地理信息系統(fic)、商業地理信息系統和我的地圖應用中正變得愈來愈重要。特別是配備gps的移動設備或ffer各類新的可能性,互動的,位置感知的地圖.。動態地圖中的一個常見原則是用戶能夠平移、旋轉和縮放地圖視圖。儘管一些商業和免費的應用很流行,可是相對較少的注意力已經被證實是好的動態地圖的標記算法。數據結構

Been et al. [2] identified a set of consistency desiderata for dynamic map labeling. Labels should neither "jump" (suddenly change position or size) nor "pop" (appear and disappear more than once) during monotonous map navigation; moreover, the labeling should be a function of the selected map viewport and not depend on the user's navigation history. Previous work on the topic has focused solely on supporting zooming and/or panning of the map [2,3,11],whereas consistent labeling under map rotations has not been considered prior to this paper.app

引用論文[2]肯定了一套用於動態地圖標註的持續性要求。在單調的地圖導航中,標籤既不該該"跳轉"(忽然改變位置或大小),也不該該"POP"(出現和消失屢次);此外,標註應該是所選地圖視口的功能,而不取決於用戶的導航歷史。之前關於這一專題的工做僅側重於支持地圖的縮放和/或平移[好比參考文獻2,3,11],而在以前沒有考慮地圖旋轉下的持續標註的論文。less

Most maps come with a natural orientation (usually the northern direction facing upward), but applications such as car or pedestrian navigation often rotate the map view dynamically to be always forward facing [5]. Still, the labels must remain horizontally aligned for best readability regardless of the actual rotation angle of the map. A basic requirement in static and dynamic label placement is that labels are pairwise disjoint, i.e., in general not all labels can be placed simultaneously. For labeling point features, it is further required that each label, usually modeled as a rectangle, touches the labeled point on its boundary. It is often not allowed that labels occlude the input point of another label. Figure 1 shows an example of a map that is rotated and labeled. The objective in map labeling is usually to place as many labels as possible. Translating this into the context of rotating maps means that, integrated over one full rotation from 0 to 2π, we want to maximize the number of visible labels. The consistency requirements of Been et al. [2] can immediately be applied for rotating maps.ide

大多數地圖都有一個天然的方向(一般是朝北的方向),但汽車或行人導航等應用程序一般會動態地旋轉地圖視圖,使其始終面向前方[5]。儘管如此,標籤必須保持水平對齊,以得到最好的可讀性,而無論地圖的實際旋轉角度如何。靜態和動態標籤放置中的一個基本要求是標籤是兩兩不相交的,即一般不是全部標籤均可以同時放置。對於標註點要素,進一步要求每一個標記被建模爲一個矩形。一般不容許標籤遮擋另外一個標籤的輸入點。圖1顯示了一個被旋轉和標記的地圖示例。地圖標註的目的一般是儘量多地放置標籤。將其轉換爲旋轉地圖的上下文意味着,集成在一次從0到2π的完整旋轉中,咱們但願最大限度地增長可見標籤的數量。文獻[2]的持續性要求可當即適用於旋轉地圖。函數

Our Results. Initially, we define a model for rotating maps and show some basic properties of the different types of conflicts that may arise during rotation. Next, we prove that consistently labeling rotating maps is NP-complete, for the maximization of the total number of visible labels in one full rotation and NP hard for the maximization of the visibility range of the least visible label. Finally, we present a new 1/4-approximation algorithm and an efficient polynomial-time approximation scheme (EPTAS) for unit-height rectangles. A PTAS is called efficient if its running time is O(f(ε)·poly(n)). Both algorithms can be extended to the case of rectangular labels with the property that the ratio of the smallest and largest width, the ratio of the smallest and largest height, as well as the aspect ratio of every label is bounded by a constant, even if we allow the anchor point of each label to be an arbitrary point of the label. This applies to most practical scenarios where labels typically consist of few and relatively short lines of text.工具

咱們的成果。最初,咱們定義了一個地圖旋轉模型,並展現了旋轉過程當中可能出現的不一樣類型衝突的一些基本性質。其次,咱們證實了地圖旋轉的持續性標記問題是NP-徹底的,對於在一次全旋轉中可見標記總數的最大化是NP-徹底的,而且對於最不可見標籤的可見性範圍的最大化是NP困難的。最後,咱們提出了一種新的1/4近似算法和一個對於單位高度矩形的高效多項式時間近似模式(EPTAS)。若是一個PTAS(多項式時間近似模式)其運行時間爲O(f(ε)·Polyn),則稱爲有效的。這兩種算法均可以推廣到矩形標籤的狀況(它們的最小寬度和最大寬度之比、最小高度和最大高度之比以及每一個標籤的長寬比都有一個常數),甚至咱們容許每一個標籤的錨定點是標籤的任意點。這適用於標籤一般由不多和相對較短的文本行組成的大多數實際狀況。

Related Work. Most previous algorithmic research efforts on automated label placement cover static labeling models for point, line, or area features. For static point labeling, fixed-position models and slider models have been introduced [4, 8], in which the label, represented by its bounding box, needs to touch the labeled point along its boundary. The label number maximization problem is NP-hard even for the simplest labeling models, whereas there are efficient algorithms for the decision problem that asks whether all points can be labeled in some of the simpler models (see the discussion by Klau and Mutzel [7] or the comprehensive map labeling bibliography [14]). Approximation results [1,8], heuristics [13], and exact approaches [7] are known for many variants of the static label number maximization problem.

相關工做。之前大多數關於自動標籤放置的算法研究工做致力於包括點、線或區域特徵的靜態標記模型。對於靜態點標記,引入了固定位置模型和滑塊模型[4,8],其中標籤以須要觸摸其邊界上的標記點的矩形包圍盒來表示。即便對於最簡單的標號模型,標籤數最大化問題也是NP困難的,然而對於斷定問題,存在有效的算法來要求在一些更簡單的模型中是否全部的點均可以被標註(參見Klau和mutzel的討論[7]或綜合地圖標號文獻[14])。近似結果[1,8],啓發式[13]和精確方法[7]是已知的靜態標籤數最大化問題的許多變體。

In recent years, dynamic map labeling has emerged as a new research topic that gives rise to many unsolved algorithmic problems. Petzold et al. [12] used a preprocessing step to generate a reactive conflict graph that represents possible label overlaps for maps of all scales. For any fixed scale and map region, their method computes a conflict-free labeling using heuristics. Mote [10] presents another fast heuristic method for dynamic conflict resolution in label placement that does not require preprocessing. The consistency desiderata of Been et al. [2] for dynamic labeling (no popping and jumping effects when panning and zooming), however, are not satisfied by either of the methods. Been et al. [3] showed NP-hardness of the label number maximization problem in the consistent labeling model and presented several approximation algorithms for the problem. N¨ollenburg et al. [11] recently studied a dynamic version of the alternative boundary labeling model, in which labels are placed at the sides of the map and connected to their points by leaders. They presented an algorithm to precompute a data structure that represents an optimal one-sided labeling for all possible scales and thus allows continuous zooming and panning. None of the existing dynamic map labeling approaches supports map rotation.

(大意是近年來有一些解決方法,但都不解決地圖旋轉時的動態持續性標註問題)近年來,動態地圖標註做爲一個新的研究課題,產生了許多還沒有解決的算法問題。Petzold等人。[12]使用預處理步驟生成反應衝突圖,該圖表示全部比例尺地圖可能的標籤重疊。對於任何固定的比例尺和地圖區域,他們的方法使用啓發式計算無衝突標記.。Mote[10]提出了另外一種不須要預處理的快速啓發式方法來解決標籤放置中的動態衝突。等的一致性要求。[2]對於動態標記(在平移和縮放時沒有彈出和跳躍效果),這兩種方法中的任何一種都不能知足fi的要求。被等人。[3]證實了一致標號模型中標籤數最大化問題的NP-困難性,並給出了幾種近似算法。Ollenburg等人。[11]最近研究了一種動態的替代邊界標註模型,其中標籤放置在地圖的兩側,並由領導將標籤鏈接到它們的點上。他們提出了一種預先計算數據結構的算法,該結構表示全部可能的尺度的最優單邊標記,從而容許連續縮放和平移。現有的動態地圖標註方法都不支持地圖旋轉。

2 Model

In this section we describe a general model for rotating maps with axis-aligned rectangular labels. Let M be a labeled input map, i.e., a set P = {p1,...,pn} of points in the plane together with a set L = {1,...,n} of pairwise disjoint, closed, and axis-aligned rectangular labels, where each point pi is a point on the boundary ∂i of its labeli. We say i is anchored at pi. As M is rotated, each labeli in L remains horizontally aligned and anchored at pi. Thus, label intersections form and disappear during rotation of M. We take the following alternative perspective on the rotation of M. Rather than rotating the points, say clockwise, and keeping labels horizontal we may instead rotate each label around its anchor point counterclockwise and keep the set of points fixed. It is easy to see that both rotations are equivalent and yield exactly the same results.

在這一節中,咱們爲擁有軸對齊矩形標籤的旋轉地圖描述了一個通用的模型。設M是一個帶標籤的輸入地圖,在地圖上有平面上點的集合P={p1,.,pn}加上以及一組不相交的、閉的和軸對的矩形標籤的集合L={1,.,`n},其中每一個點pi是其標籤i的邊界∂L上的一個點。咱們說Li被錨定在pi上。當M旋轉時,L中的每一個標籤i保持水平對齊並錨定在pi上。所以,在M的旋轉過程當中標籤會相交併消失。咱們對M的旋轉採起如下替代視角,而不是按順時針方向旋轉點,並保持標籤的水平方向,咱們能夠逆時針方向繞着每一個標籤的錨點旋轉標註,並保持點集不變。很容易看出,這兩個旋轉是等價的,併產生徹底相同的結果。

A rotation of L is defined by a rotation angle α ∈ [0,2π); a rotation labeling of M is a function φ: L×[0,2π) →{0,1}such that φ(,α) = 1 if label is visibleor active in the rotation of L by α, and φ(,α) = 0 otherwise. We call a labeling φ valid if, for any rotation α, the set of labels L(α) = { ∈ L | φ(,α) = 1} consists of pairwise disjoint labels and no label in L(α) contains any point in P (other than its anchor point). We note that a valid labeling is not yet consistent in terms of the definition of Been et al. [2,3]: given fixed anchor points, labels clearly do not jump and the labeling is independent of the rotation history, but labels may still pop during a full rotation from 0 to 2π, i.e., appear and disappear more than once. In order to avoid popping effects, each label may be active only in a single contiguous range of [0,2π), where ranges are circular ranges modulo 2π so that they may span the input rotation α = 0. A valid labeling φ, in which for every label the set Aφ() = {α ∈ [0,2π) | φ(,α) = 1} is a contiguous range modulo 2π, is called a consistent labeling. For a consistent labeling φ the set Aφ() is called the active range of. The length |Aφ()| of an active range Aφ() is defined as the length of the circular arc {(cosα,sinα) | α ∈ Aφ(`)} on the unit circle.

L的旋轉定義爲旋轉角α∈[0,2π);M的旋轉標註是函數φ:l×[0,2π)→{0,1}使φ(l,α)=1,若是標籤l在α的旋轉中可見或活躍,不然的話φ(l,α)=0.。咱們稱一個標註函數φ爲有效的,若是對於任何旋轉α,標記集L(α)={l∈L | (φ(l,α)=1}由兩兩不相交的標記組成,且L(α)中的任何標記都不包含P中的任何點(除了它的錨點以外)。咱們注意到,有效的標記在定義等方面與參考文獻[2,3]還不一致:給定固定的錨點,標籤明顯不跳,標籤獨立於旋轉歷史,但標籤仍然可能在0到2π的全旋轉期間彈出,即出現和消失不止一次。爲了不彈出效果,每一個標籤只能在[0,2π)的單個連續範圍內活動,其中範圍是模2π的圓形範圍,所以它們能夠跨越輸入旋轉α=0。一個有效的標記函數φ稱爲持續性標註,其中對每個標籤 l 集合 Aφ(l)={α∈[0,2π)|φ(,α)=1}是一個連續的模2π.。對於持續性標註函數φ,集合Aφ(l)稱爲標註l的活動範圍。有效範圍Aφ(l)的長度length|Aφ(l)|`定義爲單位圓上的圓弧{(cosα,sinα)|α∈Aφ(l)}的長度。

靜態地圖標註的目標一般是尋找兩兩不相交標籤的最大子集,即儘量多的點。將這一目標推廣到旋轉地圖,意味着在全部旋轉上集成α∈[0,2π],咱們但願顯示儘量多的標籤。這對應於最大化在M的全部持續性標註函數φ的和

咱們稱這個優化問題爲MaxTotal。另外一個目標是在全部持續性標註函數φ上最大化全部活動範圍的最小長度minAφ(l);這個問題稱爲MaxMin。

3 Properties of consistent labelings

這一部分展現持續性標註的基本屬性。兩個標註l和l'在旋轉角度α下相交表示他們在α下有衝突,即在持續性標註下他們之中頂多有一個能夠在α下展現集合 C(l,l') = {α ∈ [0,2π) | l and l' are in conflict at α}成爲l和l'的衝突集合。

咱們在一個更通常的模型中給出了以下引理,其中標註l的錨點p能夠是l中的任意點,而不必定是邊界∂l上的點。

引理1:對於任意兩個帶有錨點p∈l和P0∈l'的標籤l和l',集合C(l,l')至多由四個不相交的連續衝突範圍組成。

證實過程簡單說就是標註都是保持水平對齊的,也就是說橫軸與橫軸平行,豎軸與豎軸平行,因此相交狀況就只有四種: t∩b', b∩t', l ∩r', and r ∩l'。這四種狀況隨着旋轉方向的變化可能出現兩次,因此總共算下來是8種狀況。每一個衝突都定義了一個惟一的旋轉角度,而且很明顯,以這8個旋轉角度做爲端點最多能夠定義4個不相交的衝突範圍。下面八個圖顯示了八種相交方式,錨點使用黑點表示

在下面的文章中,咱們將更仔細地研究邊界交叉事件(也稱爲衝突事件)發生的條件,以及它們的旋轉角度。設ht和hb分別是p到t和b到t的距離。相似地,設w和wb分別是p到l和r的距離(見圖3)。經過H0 t,H0 b,W0 1和W0 r,咱們表示相應的標號`0的值。最後,設d是兩個錨點p和p0的距離。爲了提升下面引理的可讀性,咱們定義了兩個函數fd(X)=arcsin(x/d)和gd(X)=arccos(x/d)。

引理2給出了幾個衝突事件發生的角度範圍。

證實:

若是存在t和b0相交的旋轉角,則有圖4所示的狀況,經過簡單的三角推理,衝突事件發生的兩個旋轉角是2π−弧(ht+h0 b)/d)和π+arcsin(ht+h0 b)/d)。(都是逆時針旋轉)

這一段證實,全部的角度都已經在集合C的範圍內了

兩個標籤的衝突範圍在閉合的圓上用粗體標繪出。

一個有效的標註方法的要求之一是,除了它的錨點之外,任何標籤都不能包含P中的一個點。對於每一個標籤,l這產生了一類特殊的衝突範圍,稱爲硬衝突範圍,在這個範圍中l可能永遠是不被激活的。硬衝突開始或結束的旋轉角度稱爲硬衝突事件。每一個(硬)衝突事件都稱爲標籤事件。顯然,每個硬衝突也是一個常規的衝突。不屬於硬衝突的常規衝突也稱爲軟衝突。咱們注意到,從定義上講,規則衝突是對稱的,即C(0)=C(0,),而硬衝突是不對稱的。下一個引理刻畫了硬衝突範圍。

(never be active 不是很理解,引理2和3一個定義了可能的衝突範圍,一個定義了硬衝突範圍;硬衝突時l就包含了l'的錨點,因此包含l'錨點的這個旋轉範圍叫硬衝突範圍)

證實過程就是假設了一個點,寬高都爲零因此ht' hb' wl' wr' 都是零,也就知足了引理2.因此能得出引理3.

A simple way to visualize conflict ranges and hard conflict ranges is to mark, for each label anchored at p and each of its (hard) conflict ranges, the circular arcs on the circle centered at p and enclosing. Figure 6 shows an example.

In the following we show that the MaxTotal problem can be discretized in the sense that there exists an optimal solution whose active ranges are defined as intervals whose borders are label events. An active range border of a label ` is an angle α that is characterized by the property that the labeling φ is not constant in any ε-neighborhood of α. We call an active range where both borders are label events a regular active range.

在下面的討論中,咱們證實了MaxTOTAL問題能夠離散,即存在一個最優解,其活動範圍被定義爲邊界爲標籤事件的區間。一個標記l的有效範圍邊界是一個角α,其特徵是標準函數φ在α的任何ε-鄰域中都不是常數。咱們將兩個邊框都是標籤事件的活動範圍稱爲常規活動範圍。

Lemma 4. Given a labeled map M there is an optimal rotation labeling of M consisting of only regular active ranges.

給定一個有標記的地圖M,存在一個M的最優旋轉標註方法,它只包含常規的活動範圍。

在本節中,咱們證實了,即便全部標籤都是單位正方形,而且它們的錨點是它們的左下角,但要找到MaxTOTAL(以及Maxmin)的最優解是NP困難的。從NP-徹底問題平面3出發,給出了一個小工具證實.。在構造小工具以前,咱們給出了單位方標籤的一個特殊性質.

5 Approximation Algorithms

In the previous section we have established that MaxTotal is NP-complete. Unless P = NP we cannot hope for an efficient exact algorithm to solve the problem. In the following we devise a 1/4-approximation algorithm for MaxTotal and refine it to an EPTAS. For both algorithms we initially assume that labels are congruent unit-height rectangles with constant width w ≥ 1 and that the anchor points are the lower-left corners of the labels. Let d be the length of the label's diagonal, i.e., d = √w2 + 1.

在上一節中,咱們已經證實了MaxTOTAL是NP-完備的。除非P=NP,不然咱們不能期望有一個有效的精確算法來解決這個問題。在接下來的文章中,咱們設計了MaxTOTAL的1/4近似算法,並將其改進爲EPTAS。對於這兩種算法,咱們最初都假設標籤是等寬的單位高度矩形,寬度爲w≥1,而且錨點是標籤的左下角。設d是標籤對角線的長度,即d=√w2+1。

Before we describe the algorithms we state four important properties that apply even to the more general labeling model, where anchor points are arbitrary points within the label or on its boundary, and where the ratio of the smallest and largest width and height, as well as the aspect ratio are bounded by constants:

在咱們描述算法以前,咱們說明了四個重要的屬性,它們甚至適用於更通常的標記模型,其中錨點是標籤內或其邊界上的任意點,最小和最大的寬度和高度的比率以及縱橫比被常數限制:

(i) the number of anchor points contained in a rectangle is proportional to its area,

(ii) the number of conflicts a label can have with other labels is bounded by a constant,

(iii) any two conflicting labels produce only O(1) conflict regions, and finally,

(iv) there is an optimal MaxTotal solution where the borders of all active ranges are events

(I)矩形內所載的錨點數目與其面積成正比,

(Ii)標籤與其餘標籤的衝突數目以一個常數爲界,

(3)任何兩個相互衝突的標籤只產生O(1)衝突區域,最後,

(Iv)存在一個最佳MaxTOTAL解,其中全部活動範圍的邊界都是事件

The basis for our algorithm is the line stabbing or shifting technique by Hochbaum and Maass [6], which has been applied before to static labeling problems for (non-rotating) unit-height labels [1,8]. Consider a grid G where each grid cell is a square with side length 2d. We can address every grid cell by its row and column index. Now we can partition G into four subsets by deleting every other row and every other column with either even or odd parity. Within each of these subsets we have the property that any two grid cells have a distance of at least 2d. Thus no two labels whose anchor points lie in different cells of the same subset can have a conflict. We say that a grid cell c covers a label l if the anchor point of l lies inside c. By Lemma 9 only O(1) labels are covered by a single grid cell. Combining this with Lemma 10 we see that the number of conflicts of the labels covered by a single grid cell is constant. This implies that the number of events in that cell is also constant.

咱們的算法的基礎是Hochbaum和Maass[6]的直線插移技術,它之前被應用於(非旋轉的)單位高度標籤的靜態標號問題[1,8]。考慮一個網格G,其中每一個網格單元是一個邊長爲2d的正方形。咱們能夠根據每一個網格單元格的行和列索引來對其進行尋址。如今,咱們能夠經過刪除每隔一行和每隔一列奇偶校驗來將G劃分爲四個子集。在每個子集中,咱們都有一個屬性,即任意兩個網格單元至少有2d的距離。所以,錨點位於同一子集的不一樣單元格中的兩個標籤不可能存在衝突。咱們說一個網格單元格c覆蓋一個標籤l,若是l的錨點位於c中。由引理9,只有O(1)標籤被一個單一的網格單元覆蓋。結合引理10,咱們看到由單個網格單元覆蓋的標籤衝突的數量是恆定的。這意味着該單元格中的事件數也是常數。

能夠這麼理解,G中每一個格子C的寬高都是2d(d=Math.sqrt(w*w + 1)),而後將C中的格子劃成四個小格子c00,c10,c01,c11;將全部的c00拿出去成爲一個G00,那麼全部在G00中的格子中標籤都不會有衝突,由於他們距離都是2d。

The four different subsets of grid cells divide a MaxTotal instance into four subinstances, each of which decomposes into independent grid cells. If we solve all subsets optimally, at least one of the solutions is a 1/4-approximation for the initial instance due to the pigeon-hole principle.

網格單元的四個不一樣子集將MaxTOTAL實例劃分爲四個子實例,每一個子實例分解爲獨立的網格單元。若是咱們最優地求解全部子集,因爲鴿洞原理,至少有一個解是初始情形的1/4近似。

Determining an optimal solution for the labels covered by a grid cell c works as follows. We compute, for the set of labels Lc ⊆ L covered by c, the set Ec of label events. Due to Lemma 4 we know that there exists an optimal solution where all borders of active ranges are label events. Thus, to compute an optimal active range assignment for the labels in Lc we need to test all possible combinations of active ranges for all labels l ∈ Lc. For a single cell this requires only constant time.

爲網格單元格c覆蓋的標籤肯定最佳解決方案的工做以下。對於C覆蓋的標籤集LC⊆L,咱們計算標籤事件的集合EC。因爲引理4,咱們知道存在一個最優解,其中活動範圍的全部邊界都是標號事件。所以,爲了計算LC中標籤的最優有效範圍分配,咱們須要測試全部標籤l∈LC的全部可能的有效範圍組合。對於單個單元格,這隻須要恆定的時間。

We can precompute the non-empty grid cells by simple arithmetic operations on the coordinates of the anchor points and store those cells in a binary search tree. Since we have n anchor points there are at most n non-empty grid cells in the tree, and each of the cells holds a list of the covered anchor points. Building this data structure takes O(nlogn) time and then optimally solving the active range assignment problem in the non-empty cells takes O(n) time.

咱們能夠經過對非空網格單元格中錨點座標進行簡單算術運算來做爲預處理,並將這些單元格存儲在二叉樹中。由於咱們有n個錨點,樹中最多有n個非空網格單元格,每一個單元格都有一個覆蓋錨點的列表。創建這種數據結構須要O(Nlogn)時間,而後在非空單元格中最優地解決活動範圍分配問題須要O(N)時間。

存在一種O(Nlogn)時間算法,該算法對於單位高度相同的矩形且以左下角爲錨點,獲得MaxtoTAL的1/4近似。

An Efficient Polynomial-Time Approximation Scheme for MaxTotal

一種高效的MaxTOTAL多項式時間逼近方法

論文中數學上的證實不去管了,主要看下面一段,就是說咱們能夠把原來那個固定高度,固定左下角錨點的假設推廣到通常狀況。

We note that this EPTAS basically relies on properties (i)–(iv) and that there is nothing special about congruent rectangles anchored at their lower-left corners. Hence we can generalize the algorithm to the more general labeling model, in which the ratio of the label heights, the ratio of the label widths, and the aspect ratios of all labels are bounded by constants. Furthermore, the anchor points are not required to be label corners; rather they can be any point on the boundary or in the interior of the labels. Finally, we can even ignore the distinction between hard and soft conflicts, i.e., allow that anchor points of nonactive labels are occluded. Properties (i)–(iv) still hold in this general model. The only change in the EPTAS is to set the width and height of the grid cells to twice the maximum diameter of all labels in L.

咱們注意到這個EPTAS基本上依賴於屬性(I)-(Iv),而且在它們的左下角錨定的同餘矩形沒有什麼特別之處。所以,咱們能夠將該算法推廣到更通常的標號模型,其中標號高度比、標號寬度比和全部標號的縱橫比都是有常數限制的。此外,錨點不須要是標籤角;相反,它們能夠是邊界上或標籤內部的任何一點。最後,咱們甚至能夠忽略硬衝突和軟衝突之間的區別,即容許屏蔽非活動標籤的錨點。性質(一)-(四)仍然保持在這個通常模式。EPTAS中惟一的變化是 將網格單元格的寬度和高度設置爲L中全部標籤的最大直徑的兩倍

相關文章
相關標籤/搜索