Summary of the invention
Technical matters to be solved by this invention is, provides a kind of implementation method that effectively can reduce the time spent by algorithm iteration calculating and promote annotation outcome quality.
For solving the problems of the technologies described above, the invention provides a kind of ant group algorithm based on annotation associated group to an implementation method for key element map name placement, comprising the steps:
Step (1), Clustering; Each parameter needed carries out initialization, and some annotation orientation to be selected generates, and orientation priority value assignment, carries out assignment to the annotation of different azimuth, and with direction, due east for best result, counterclockwise carry out falling point, the generation of annotation associated group, is provided with K annotation associated group;
Step (2), screening single-point annotation associated group; Judge whether each annotation associated group mid point key element number is greater than 1, if be then multiple spot annotation associated group, carries out (3) step subsequently; If not then show that this annotation associated group is single-point annotation associated group, without the need to carrying out ant group algorithm iteration, only according to this annotation orientation priority value, the maximum orientation of priority value need be chosen stored in net result collection FinalResultList;
Step (3), ant group build; Be provided with N (N<=K) individual multiple spot annotation associated group, then have N number of ant group, if having Q in α (α ∈ [1, N]) individual multiple spot annotation associated group
aindividual some key element, has P in corresponding ant group
aindividual ant;
Step (4), Ant Search; Start to search for each ant group, enter first ant group for some annotation associated group, require every ant need by the multiple spot annotation associated group at its place institute have a key element random search one time, search out optimum annotation orientation to be selected in each some key element; If c is (c ∈ [1, P
a]) ant, random chooses a some key element, is designated as i (i ∈ [1, Q
a]);
Step (5), calculating transition probability
point key element annotation priority value to be selected η corresponding to i
ijwith value of information τ
ijtransition probability is calculated by formula (3)
choose annotation orientation, judge conflict situations, upgrade this annotation azimuth information value, and stored in the result TempResultList_ α of α ant group;
Wherein, SumL
dfor the annotation orientation to be selected sum of i point key element, η
ijfor the preferred value in a jth orientation of i point key element, τ
ijfor the value of information in a jth orientation of i point key element, α, β are for reflecting the relative importance of preferred value, the value of information, alpha+beta=1;
Step (6), amendment tabu
c; If tabu
cstore the some key element of c ant process, thus Q
a-tabu
cshow the some key element that next step permission of c ant is selected;
Step (7), annotation fitness evaluation; Fitness function of the present invention, as shown in formula (4); Evaluate a each ant of ant group search for the good and bad degree of the annotation orientation set obtained, choose the annotation as a result that evaluation function end value is large, stored in FinalResultList; Complete after an ant group travels through circulation, enter next ant group circulation, until traveled through all ant groups;
Wherein, E
(c)represent the some key element fitness function that c ant is selected in this multiple spot annotation associated group, E
(ci)represent the fitness function of c ant in i point key element, E
(ci)=w
conflicte
conflict (ci)+ w
positione
position (ci)+ w
the degree of associatione
the degree of association (ci), weight value w
conflict=100, w
position=1, w
the degree of association=10;
η
iMaxfor the annotation priority maximal value to be selected of i point key element, η
iSelectedfor the selected annotation priority value of i point key element, Dis tan ce
(SelectedLabelToFuture)for the selected annotation of i point key element and the distance of i point key element, Dis tan ce
(max)for the annotation to be selected of i point key element and the ultimate range of corresponding i point key element.
Beneficial effect of the present invention is: be applicable to that a scale is large, a point bunch density change difference map greatly, can effectively reduce algorithm iteration calculate spent by time and promote annotation outcome quality.
Embodiment
For solving the problems of the technologies described above, the invention provides a kind of ant group algorithm based on annotation associated group to an implementation method for key element map name placement.
As shown in Figure 1, some annotation azimuth configuration to be selected generates many employing n azimuth configuration schemes, n ∈ N
+, generally, n often gets 4,8,16, and normal be the best orientation to be selected with upper right side, orientation 1 is best orientation.This allocation plan advantage be short and sweet, meet interpreting blueprints person and be accustomed at heart, but deficiency is not provide clear and definite mathematical expression form, and simultaneously when near some key element, the configurable annotation area of some key element surrounding diminishes.Therefore, for satisfied point will have the requirement in orientation enough to be selected, expanded as multistage, during to meet human configuration point key element annotation, annotation orientation is apart from the requirement of some key element distance variable, increases with distance, and around some key element, orientation to be selected increases.Point key element annotation word boundary rectangle is all generally that length and width do not wait, and is that length and width are identical under only having rare occasion.The present invention proposes oval multi-faceted multistage annotation azimuth configuration scheme to be selected mathematical expression form, i-th some key element coordinate position (X
i, Y
i), then it is positioned at a kth orientation of L level
formula:
Wherein, w is annotation mean breadth, and h is annotation average height, and s is the side-play amount of L rank, L
dit is the orientation number to L rank.
As shown in Figure 2, be oval 2 grades of multi-faceted configuration schematic diagram, wherein the 1st grade is 4 orientation, and the 2nd grade is 8 orientation, and original some map name placement scheme has been unified in this design, makes its completion, parametrization.
Point key element is stochastic distribution usually on map, and what show is that on geographical space, geographical element distribution density is uneven, and the most directly performance is a key element bunch, puts key element separately.The density of some key element is uneven, result in the space mutual independence between difference bunch, and therefore between difference bunch, the configuration of annotation position can not affect, and the point bunch set up for the configuration of annotation position is called a key element annotation associated group.If some key element annotation associated group refers to the some elements combination having gland between difference key element annotation orientation to be selected, namely show that the annotation of the difference key element when carrying out azimuth configuration orientation to be selected exists interactional possibility, thus be divided into an annotation associated group.As shown in Figure 3, for building the schematic diagram of annotation associated group according to the annotation orientation of a key element, constraint annotation associated group 1={101,102,103,104,105}, constraint annotation associated group 2={106,107,108}, free annotation associated group is respectively { 109}, { 110}.
Clustering flow process:
(1) put key element and generate annotation orientation undetermined;
(2) scan by annotation object to be selected, judge the distance between each annotation object to be selected and other annotations to be selected, distance discrimination formula is as shown in formula (2), namely judge by carrying out conflict to all annotation orientation undetermined, obtain some key element corresponding to conflicting annotation orientation undetermined to (be called for short conflict point key element to) and free point key element, conflict point key element is to there being <101 as shown in Figure 3, 102>, <101, 103>, <103, 104>, <104, 105>, <106, 107>, <107, 108>, free point key element is 109 and 110,
Wherein, Pi
width, Pj
widththe annotation width of expression i-th, a j point key element, Pi
height, Pj
heightbe i-th, the annotation height of a j point key element.
(3) by conflict point key element to carrying out extreme saturation search, draw the associated group of different scales, thus realize a some key element annotation associated group and build.
As shown in Figure 4, ant group algorithm is the one of Swarm Intelligence Algorithm, is the heuristic Bio-simulated Evolution system based on population.The utilization of ant group algorithm in mapping geography information mainly contains Site Selection, data mining etc.Ant group algorithm is relative to the advantage of other key element map name placement algorithms: positive feedback mechanism, ant are individual simple and to exchange be exchanged by pheromones, are applicable to an annotation space optimization combinatorial problem.
Ant group algorithm specifically comprises the steps:
Step (1), Clustering; Each parameter needed carries out initialization, and some annotation orientation to be selected generates, and orientation priority value assignment, carries out assignment to the annotation of different azimuth, and with direction, due east for best result, counterclockwise carry out falling point, the generation of annotation associated group, is provided with K annotation associated group;
Step (2), screening single-point annotation associated group; Judge whether each annotation associated group mid point key element number is greater than 1, if be then multiple spot annotation associated group, carries out (3) step subsequently; If not then show that this annotation associated group is single-point annotation associated group, without the need to carrying out ant group algorithm iteration, only according to this annotation orientation priority value, the maximum orientation of priority value need be chosen stored in net result collection FinalResultList;
Step (3), ant group build; Be provided with N (N<=K) individual multiple spot annotation associated group, then have N number of ant group, if having Q in α (α ∈ [1, N]) individual multiple spot annotation associated group
aindividual some key element, has P in corresponding ant group
aindividual ant;
Step (4), Ant Search; Start to search for each ant group, enter first ant group for some annotation associated group, require every ant need by the multiple spot annotation associated group at its place institute have a key element random search one time, search out optimum annotation orientation to be selected in each some key element; If c is (c ∈ [1, P
a]) ant, random chooses a some key element, is designated as i (i ∈ [1, Q
a]);
Step (5), calculating transition probability
point key element annotation priority value to be selected η corresponding to i
ijwith value of information τ
ijtransition probability is calculated by formula (3)
choose annotation orientation, judge conflict situations, upgrade this annotation azimuth information value, and stored in the result TempResultList_ α of α ant group;
Wherein, SumL
dfor the annotation orientation to be selected sum of i point key element, η
ijfor the preferred value in a jth orientation of i point key element, τ
ijfor the value of information in a jth orientation of i point key element, α, β are for reflecting the relative importance of preferred value, the value of information, alpha+beta=1;
Step (6), amendment tabu
c; If tabu
cstore the some key element of c ant process, thus Q
a-tabu
cshow the some key element that next step permission of c ant is selected;
Step (7), annotation fitness evaluation; Fitness function of the present invention, as shown in formula (4); Evaluate a each ant of ant group search for the good and bad degree of the annotation orientation set obtained, choose the annotation as a result that evaluation function end value is large, stored in FinalResultList; Complete after an ant group travels through circulation, enter next ant group circulation, until traveled through all ant groups;
Wherein, E
(c)represent the some key element fitness function that c ant is selected in this multiple spot annotation associated group, E
(ci)represent the fitness function of c ant in i point key element, E
(ci)=w
conflicte
conflict (ci)+ w
positione
position (ci)+ w
the degree of associatione
the degree of association (ci), weight value w
conflict=100, w
position=1, w
the degree of association=10;
η
iMaxfor the annotation priority maximal value to be selected of i point key element, η
iSelectedfor the selected annotation priority value of i point key element, Dis tan ce
(SelectedLabelToFuture)for the selected annotation of i point key element and the distance of i point key element, Dis tan ce
(max)for the annotation to be selected of i point key element and the ultimate range of corresponding i point key element.
Writing density refers to all key element area occupied and the ratio with map face, for describing the loading level of writing.Generally, annotation density is Suitable Density 12% time, when annotation density reaches 35%, is limit annotation density, not easily reads.The present invention is by stochastic generation test figure, when annotation density reaches 35%, when point key element scale is 2226, maximum annotation associated group mid point key element number has been 1979, the scale of maximum constrained annotation associated group covers view picture figure substantially, grouping cannot be realized, mark very difficult, without Research Significance simultaneously.Therefore this experiment 1,2 data acquisition is used in stochastic generation point key element in the map sheet of a fixed size.Experiment 1,2 data with engineer's scale be 1:4000 map sheet size for 493*629 rice picture frame scope be sample plot graph region, the width of individual digit is determined according to formula L=0.178*S*F/1000, wherein individual digit composition annotation on the spot width L, select No. 4 with map-making parcel printing proportion chi denominator S, font size and poundage F, wherein font size, digital height is width twice, and the annotation length of each random point key element is three numerals.Test 3 data acquisition Fushun County group support investigation achievements, checking practice effect.Experiment adopts oval multi-faceted multistage annotation azimuth configuration scheme to be selected to adopt 1 grade of 4 orientation pattern, and ant group scale is defined as 1000, i.e. iteration 1000 times.The method that annotation associated group generates first judges annotation orientation to be selected conflict, sets up corresponding conflict point pair, adopts the mode of non-directed graph degree of depth recursive traversal to build annotation associated group afterwards.
Experiment 1: in order to contrast under different annotation density case based on the ant group algorithm of annotation associated group and each parameter of traditional ant group algorithm, to represent the efficiency of the ant group algorithm based on annotation associated group, test figure 1 is 5%, 10%, 15%, 20%, 25%, 30% generation, six groups of random point factor datas by annotation density, corresponding random point number is respectively 318,636,954,1272,1590,1908, as shown in Figure 5.
Table 1: experimental data 1 Comparative result table
Note: A algorithm namely based on the ant group algorithm of annotation associated group, B algorithm and traditional ant group algorithm, ρ and annotation density (%), c and random point key element number (individual), A
1i.e. annotation associated group sum (group), A
2i.e. free annotation number (group), A
3namely annotation associated group number (group) is retrained, A
4i.e. some key element number (group) of the annotation associated group of maximum-norm, T
aDnamely annotation orientation to be selected generates and annotation associated group grouping (second) consuming time, T
aCnamely A algorithm carries out ant group iterative computation (second) consuming time, T
aS(second) always consuming time of i.e. A algorithm, F
anamely the fitness function value of the annotation result after A algorithm is adopted, T
bDnamely annotation orientation to be selected generates (second) consuming time, T
bCnamely B algorithm carries out ant group iterative computation (second) consuming time, T
bS(second) always consuming time of i.e. B algorithm, F
bnamely the fitness function value of the annotation result after B algorithm is adopted.
Test 1 result and show that A algorithm annotation to be selected orientation generates and annotation associated group T consuming time when some key element annotation density increases
aDant group iterative computation T consuming time is carried out with A algorithm
aC, the annotation orientation to be selected of B algorithm generates T consuming time
bDant group iterative computation T consuming time is carried out with B algorithm
bCincrease all thereupon, as shown in Figure 6, therefore corresponding A algorithm and the various total T consuming time of B algorithm
aS, T
bSalso increase, as shown in Figure 7.Show in Fig. 6, Fig. 7, A algorithm annotation to be selected orientation generates and annotation associated group T consuming time
aDannotation orientation to be selected higher than B algorithm generates T consuming time
bD, but A algorithm carries out ant group iterative computation T consuming time
aCbe starkly lower than B algorithm and carry out ant group iterative computation T consuming time
bC.Thus aggregate performance is the total T consuming time of A algorithm
aSbe starkly lower than the total T consuming time of B algorithm
bS.As 0< annotation density p <=10%, the now some key element number A of the annotation associated group of maximum-norm that obtains of A algorithm Clustering
4little, free annotation associated group number A
2many, constraint annotation associated group number A
3few, the annotation orientation to be selected of A algorithm generates and annotation associated group is divided into groups T consuming time
aDant group iterative computation T consuming time is carried out with A algorithm
aCall be less than 1 second.And B algorithm is because needing global search, B algorithm carries out ant group iterative computation T consuming time
bCobviously, according to formula (T
bS-T
aS)/T
bS, show that A algorithm is compared B efficiency of algorithm and promoted 89.3%; In like manner, as 10%< annotation density p <=20%, show that A algorithm is compared B efficiency of algorithm and promoted 80.3%; As 20%< annotation density p <=30%, A algorithm annotation to be selected orientation generates and annotation associated group T consuming time
aDincrease, the some key element number A of the annotation associated group of the maximum-norm that A algorithm Clustering obtains
4progressively increase, free annotation associated group number A
2progressively reduce, constraint annotation associated group number A
3first increase and reduce afterwards, B algorithm carries out ant group iterative computation T consuming time
bCincrease rapidly, namely meet the characteristic of NP-Hard problem, show that A algorithm is compared B efficiency of algorithm and promoted 50%.In general, as 0< annotation density p <=30%, A algorithm is compared B efficiency of algorithm and is on average promoted 73.2%, and improved efficiency is obvious., it is worth mentioning that meanwhile, when different annotation density, adopt the fitness function F of the annotation result after A algorithm
aall be less than the fitness function value F of the annotation result after adopting B algorithm
b, i.e. F
a<F
b, from fitness function computing formula, its value is less, and annotation outcome quality is better, shows that the annotation result that A algorithm obtains is better than B algorithm, improves annotation outcome quality, adopts formula (Σ F
b-Σ F
a)/Σ F
b, calculate annotation outcome quality and promote 8.0%.
Experiment 2: in order to observe the some key element of the different distributions of stochastic generation to the stability of two kinds of algorithm operation results, to prove the rationality of experimental data 1, get rid of instable impact, experimental data 2 is that to choose annotation density be 20%, stochastic generation 6 sets of data, as shown in Figure 8.
Table 2: experimental data 2 results contrast table
Experimental data 2 result effectively describes this some key element in different random distribution, two kinds of arithmetic result there is stability, thus proved the authenticity of the result of experimental data 1.Meanwhile, run by 6 width experimental datas and obtain Average end value, the efficiency comparatively B algorithm of A algorithm, evaluate the fitness function value comparatively B algorithm of the annotation result of raising 74.6%, A algorithm, improve 7.0%, meet the result of experimental data 1.
Experiment 3: practice compliance test result, adopts ownership boundary mark in Fushun County group support investigation achievement storehouse as experimental data 3, as shown in Figure 9.It is 1:10000 that these data build storehouse engineer's scale, and the annotation font size of group support ownership boundary mark is No. 10 Song typefaces.Through statistics, these data have 8390 boundary marks, wherein boundary mark length is 3 digital has 2833, boundary mark number is 2 digital has 4668, boundary mark number is 1 digital has 889, using administrative area, this county territory scope as map face zoning, map face is 1638200616 square metres, and the annotation density calculating the group support ownership boundary mark of this figure is 0.7%.This map feature is that a scale is large, point bunch density difference is large.
Table 3: experimental data 3 Comparative result table
Experimental data 3 result effectively describes the practical value of A algorithm, for Fushun County group support ownership boundary mark data, the optimization efficiency comparatively B algorithm of A algorithm, improve 86.7%, wherein mainly consuming time being of A algorithm, because some key element number is numerous, when annotation associated group builds, needs the scale judging conflict to increase, 240.23 seconds consuming time, and A algorithm iteration calculates T consuming time
aCbe only 7.37 seconds, compare B algorithm iteration and calculate T consuming time
bC1867.71 seconds, efficiency significantly promotes.Meanwhile, the fitness function value comparatively B algorithm of the annotation result of A algorithm, improves 14.6%, and the annotation outcome quality that surface adopts A algorithm to calculate is better, as shown in Figure 10.
Ant group algorithm counting yield based on annotation associated group calculates effect apparently higher than traditional ant group algorithm, based on annotation associated group ant group algorithm to annotation density 5% to 30% some key element map, more traditional ant group algorithm, overall average optimization efficiency consuming time is 73.2%.Meanwhile, the former annotation fitness value, compared with the annotation fitness value lower than the latter, shows its annotation increased quality claimed, annotation increased quality degree is 8.0%.Based on the ant group algorithm of annotation associated group a key element map name placement is particularly useful for a scale is large, a point bunch density change difference map greatly, can effectively reduce algorithm iteration calculate spent by time and promote annotation outcome quality.
Although the present invention illustrates with regard to preferred implementation and describes, only it will be understood by those of skill in the art that otherwise exceed claim limited range of the present invention, variations and modifications can be carried out to the present invention.