Method and apparatus for outputting information
By selecting the initial center point in large-scale vehicle path planning, the conflict between calculation speed and driver familiarity is solved, and efficient distribution area division and balanced delivery is achieved.
Patent Information
- Application Number
- CN201910699465.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-31
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2039-07-31
AI Technical Summary
In the problem of large-scale vehicle path planning, the prior art is difficult to meet the algorithm calculation speed and drivers' familiarity with the delivery area at the same time, resulting in inefficient delivery.
By selecting a preset number of initial center points from the coordinate point set for clustering, updating the cluster cluster, and adjusting the number of coordinate points in the cluster based on the distance attenuation function, and finally re-clustering to output the target cluster cluster to ensure geographical aggregation and the distance balance between the center point and the target location.
It has achieved the goal of improving computing speed and driver familiarity in large-scale distribution areas, achieving the goal of balancing the delivery workload, and improving the delivery efficiency.
Smart Images

Figure CN110400020B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and more particularly to a method and apparatus for outputting information. Background Art
[0002] In real-world large-scale vehicle routing problems, to meet the dual requirements of algorithm computational speed and driver familiarity with the delivery area, it is necessary to partition the large delivery area. This allows a large-scale problem to be divided into smaller-scale problems that can be solved concurrently, accelerating planning. Furthermore, because the partitioned areas are relatively geographically clustered, the same driver can be assigned to each delivery, increasing their familiarity with the area and ultimately reducing delivery time. Summary of the Invention
[0003] The embodiments of the present application provide a method and apparatus for outputting information.
[0004] In a first aspect, an embodiment of the present application provides a method for outputting information, comprising: selecting a preset number of coordinate points in a preset coordinate point set as a first initial center point, clustering the coordinate points in the coordinate point set with the first initial center point as the cluster center to obtain a preset number of first initial cluster clusters; updating the preset number of first initial cluster clusters to obtain a preset number of updated cluster clusters; based on a preset distance decay function, re-determining the number of coordinate points contained in each updated cluster cluster in the preset number of updated cluster clusters; based on the number of coordinate points contained in each updated cluster cluster, re-clustering the coordinate points in the coordinate point set to obtain a preset number of target cluster clusters, and outputting cluster information of the preset number of target cluster clusters.
[0005] In some embodiments, the coordinate points in the coordinate point set are clustered with the first initial center point as the cluster center to obtain a preset number of first initial clustering clusters, including: for each first coordinate point to be assigned in at least one first coordinate point to be assigned, based on the distance between the first coordinate point to be assigned and each first initial center point, determining the gain of the first coordinate point to be assigned, wherein at least one first coordinate point to be assigned includes other coordinate points in the coordinate point set except the first initial center point; based on the gain of each first coordinate point to be assigned in at least one first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point, clustering at least one first coordinate point to be assigned to obtain a preset number of first initial clustering clusters, wherein the number of coordinate points in each first initial clustering cluster is a value obtained by rounding off the ratio of the number of coordinate points in the coordinate point set to the preset number.
[0006] In some embodiments, based on the distance between the first coordinate point to be assigned and each first initial center point, the gain of the first coordinate point to be assigned is determined, including: determining each distance between the first coordinate point to be assigned and each first initial center point, and determining the difference between the maximum distance and the minimum distance among each distance as the gain of the first coordinate point to be assigned.
[0007] In some embodiments, at least one first coordinate point to be allocated is clustered based on the gain of each first coordinate point to be allocated and the distance between each first coordinate point to be allocated and each first initial center point, including: allocating each first coordinate point to be allocated to a corresponding cluster cluster in descending order of the gain of at least one first coordinate point to be allocated, wherein, for each first coordinate point to be allocated among at least one first coordinate point to be allocated, the cluster cluster corresponding to the first coordinate point to be allocated is a cluster cluster in which the number of coordinate points currently included is less than the first target value and the corresponding first initial center point is closest to the first coordinate point to be allocated.
[0008] In some embodiments, a preset number of first initial clusters are updated to obtain a preset number of updated clusters, including: performing the following update steps: re-determining the center point of each first initial cluster in the preset number of first initial clusters as the updated center point; for each second coordinate point to be assigned in at least one second coordinate point to be assigned, based on each distance between the second coordinate point to be assigned and each updated center point, re-determining the cluster to which the second coordinate point to be assigned belongs, wherein at least one second coordinate point to be assigned includes other coordinate points in the coordinate point set except the updated center point.
[0009] In some embodiments, based on the distances between the second coordinate point to be assigned and the updated center points, the cluster to which the second coordinate point to be assigned belongs is re-determined, including: determining the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a first distance, determining the minimum distance among the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as a second distance, and determining the difference between the first distance and the second distance as the cost value corresponding to the second coordinate point to be assigned; for a preset number of first initial clusters, For each first initial cluster in the cluster, based on the cost value corresponding to each second coordinate point to be assigned in the first initial cluster, generate a set of coordinate points to be exchanged corresponding to the first initial cluster; in the order of the cost value corresponding to each second coordinate point to be assigned in the set of second coordinate points to be assigned from small to large, based on the distances between the second coordinate point to be assigned and each updated center point and the set of coordinate points to be exchanged corresponding to each first initial cluster, determine whether to move the second coordinate point to be assigned to other first initial clusters, wherein the cost value of the second coordinate point to be assigned in the set of second coordinate points to be assigned is non-negative.
[0010] In some embodiments, based on the distances between the second coordinate point to be assigned and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial clustering cluster, determining whether to move the second coordinate point to be assigned to other first initial clustering clusters includes: sorting the other first initial clustering clusters in order from near to far according to the distances between the second coordinate point to be assigned and the updated center points of the other first initial clustering clusters, and performing the following transfer steps according to the sorting results: determining the distance between the second coordinate point to be assigned and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs as a third distance, determining the distance between the second coordinate point to be assigned and the updated center point of the other first initial clustering clusters as a fourth distance, and determining the difference between the third distance and the fourth distance as a first exchange gain; determining the distances between the other first initial clustering clusters whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged; in response to determining that there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters, determining the distance between the existing coordinate point to be exchanged and the updated center point of the other first initial clustering clusters as the fifth distance, determining the distance between the existing coordinate point to be exchanged and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs as the sixth distance, and determining the difference between the fifth distance and the sixth distance as the second exchange gain; determining whether the sum of the first exchange gain and the second exchange gain is greater than the preset first value; in response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, transferring the second coordinate point to be assigned to the other first initial clustering clusters, and transferring the existing coordinate point to be exchanged to the first initial clustering cluster to which the second coordinate point to be assigned belongs.
[0011] In some embodiments, there are at least two coordinate points to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters; and in response to determining that the sum of the first exchange gain and the second exchange gain is greater than a preset first value, the second coordinate point to be allocated is transferred to the other first initial clustering cluster, and the existing coordinate point to be exchanged is transferred to the first initial clustering cluster to which the second coordinate point to be allocated belongs, including: in response to determining that there are at least two sums of the first exchange gain and the respective second exchange gains corresponding to at least two coordinate points to be exchanged that are greater than the preset first value, the second coordinate point to be allocated is transferred to the other first initial clustering cluster, and the coordinate point to be exchanged corresponding to the maximum cost value among the at least two existing coordinate points to be exchanged is transferred to the first initial clustering cluster to which the second coordinate point to be allocated belongs.
[0012] In some embodiments, the transfer step also includes: in response to determining that there is no coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters or determining that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, determining whether the first exchange gain is greater than the preset second value, and determining whether the number of coordinate points included in the other first initial clustering clusters is less than the first target value; in response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in the other first initial clustering clusters is less than the first target value, transferring the second coordinate point to be assigned to the other first initial clustering clusters.
[0013] In some embodiments, the transfer step also includes: in response to determining that the first exchange gain is greater than a preset second value and the number of coordinate points contained in other first initial clusters is equal to the first target value, adding the second coordinate point to be assigned to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be assigned belongs.
[0014] In some embodiments, the transfer step further includes: in response to determining that there are no second coordinate points to be allocated in the second set of coordinate points to be allocated that have not been subjected to the transfer step, clearing the set of coordinate points to be exchanged corresponding to each first initial clustering cluster in a preset number of first initial clustering clusters.
[0015] In some embodiments, after determining whether to move the second coordinate point to be assigned to another first initial cluster, the method further includes: in response to determining to move the second coordinate point to be assigned to another first initial cluster, re-performing the updating step.
[0016] In some embodiments, based on a preset distance decay function, the number of coordinate points contained in each updated cluster of a preset number of updated clusters is re-determined, including: determining the distance between the cluster center of each updated cluster in the preset number of updated clusters and the target location point; generating a sorting number from small to large corresponding to each updated cluster in order of distance from far to near; determining the median of the sorting number; for each updated cluster in the preset number of updated clusters, based on the sorting number and median of the updated cluster, determining the attenuation value corresponding to the number of coordinate points contained in the updated cluster, and determining the number of coordinate points contained in the updated cluster based on the attenuation value.
[0017] In some embodiments, based on the sorting number and median of the updated cluster cluster, the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster is determined, including: determining the absolute value of the difference between the sorting number and the median of the updated cluster cluster, taking the logarithm of the sum of the absolute value and a preset third value, determining the product of the preset coefficient and the logarithm, and determining the ratio of the product to a preset fourth value as the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster.
[0018] In some embodiments, based on the attenuation value, the number of coordinate points included in the updated cluster is determined, including: based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster, determining the minimum value of the number of coordinate points included in the updated cluster, wherein the second target value is a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to a preset number; and determining the sum of the minimum value and the preset fifth value as the maximum value of the number of coordinate points included in the updated cluster.
[0019] In some embodiments, based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster, the minimum number of coordinate points included in the updated cluster cluster is determined, including: in response to determining that the sorting number of the updated cluster cluster is less than the median, determining the difference between the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0020] In some embodiments, based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster, the minimum number of coordinate points included in the updated cluster cluster is determined, including: in response to determining that the sorting number of the updated cluster cluster is greater than the median, determining the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0021] In some embodiments, based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster, the minimum number of coordinate points included in the updated cluster cluster is determined, including: in response to determining that the sorting number of the updated cluster cluster is equal to the median, the second target value is determined as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0022] In some embodiments, based on the number of coordinate points contained in each updated cluster, the coordinate points in the coordinate point set are re-clustered to obtain a preset number of target clusters, and cluster information of the preset number of target clusters is output, including: re-selecting a preset number of coordinate points in the coordinate point set as second initial center points, using the second initial center points as cluster centers, and re-clustering the coordinate points in the coordinate point set to obtain a preset number of second initial clusters, wherein the number of coordinate points contained in each second initial cluster is the number of coordinate points contained in the corresponding updated cluster; updating the preset number of second initial clusters to obtain a preset number of updated second clusters as target clusters.
[0023] In the second aspect, an embodiment of the present application provides a device for outputting information, including: a clustering unit, configured to select a preset number of coordinate points in a preset coordinate point set as a first initial center point, cluster the coordinate points in the coordinate point set with the first initial center point as the clustering center, and obtain a preset number of first initial cluster clusters; an updating unit, configured to update the preset number of first initial cluster clusters, and obtain a preset number of updated cluster clusters; a determination unit, configured to re-determine the number of coordinate points contained in each updated cluster cluster in the preset number of updated cluster clusters based on a preset distance decay function; an output unit, configured to re-cluster the coordinate points in the coordinate point set based on the number of coordinate points contained in each updated cluster cluster, and obtain a preset number of target cluster clusters, and output cluster information of the preset number of target cluster clusters.
[0024] In some embodiments, the clustering unit is further configured to cluster the coordinate points in the coordinate point set with the first initial center point as the cluster center in the following manner to obtain a preset number of first initial clustering clusters: for each first coordinate point to be assigned in at least one first coordinate point to be assigned, determine the gain of the first coordinate point to be assigned based on the distance between the first coordinate point to be assigned and each first initial center point, wherein at least one first coordinate point to be assigned includes other coordinate points in the coordinate point set except the first initial center point; based on the gain of each first coordinate point to be assigned in at least one first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point, cluster at least one first coordinate point to be assigned to obtain a preset number of first initial clustering clusters, wherein the number of coordinate points in each first initial clustering cluster is a value obtained by rounding off the ratio of the number of coordinate points in the coordinate point set to the preset number.
[0025] In some embodiments, the clustering unit is further configured to determine the gain of the first coordinate point to be assigned based on the distance between the first coordinate point to be assigned and each first initial center point in the following manner: determine each distance between the first coordinate point to be assigned and each first initial center point, and determine the difference between the maximum distance and the minimum distance among each distance as the gain of the first coordinate point to be assigned.
[0026] In some embodiments, the clustering unit is further configured to cluster at least one first coordinate point to be assigned based on the gain of each first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point in the following manner: assign each first coordinate point to be assigned to a corresponding cluster cluster in order of the gain of at least one first coordinate point to be assigned from large to small, wherein, for each first coordinate point to be assigned among at least one first coordinate point to be assigned, the cluster cluster corresponding to the first coordinate point to be assigned is a cluster cluster in which the number of coordinate points currently included is less than the first target value and the corresponding first initial center point is closest to the first coordinate point to be assigned.
[0027] In some embodiments, the update unit is further configured to update a preset number of first initial clusters in the following manner to obtain a preset number of updated clusters: perform the following update steps: re-determine the center point of each first initial cluster in the preset number of first initial clusters as the updated center point; for each second coordinate point to be assigned in at least one second coordinate point to be assigned, based on the respective distances between the second coordinate point to be assigned and the respective updated center points, re-determine the cluster to which the second coordinate point to be assigned belongs, wherein at least one second coordinate point to be assigned includes other coordinate points in the coordinate point set except the updated center point.
[0028] In some embodiments, the updating unit is further configured to re-determine the cluster to which the second coordinate point to be assigned belongs based on the respective distances between the second coordinate point to be assigned and the respective updated center points in the following manner: determining the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as the first distance, determining the minimum distance among the respective distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as the second distance, and determining the difference between the first distance and the second distance as the cost value corresponding to the second coordinate point to be assigned; for a preset number of For each first initial clustering cluster in the first initial clustering cluster, based on the cost value corresponding to each second coordinate point to be assigned in the first initial clustering cluster, a set of coordinate points to be exchanged corresponding to the first initial clustering cluster is generated; in the order of the cost value corresponding to each second coordinate point to be assigned in the set of second coordinate points to be assigned from small to large, based on the distances between the second coordinate point to be assigned and each updated center point and the set of coordinate points to be exchanged corresponding to each first initial clustering cluster, it is determined whether to move the second coordinate point to be assigned to other first initial clustering clusters, wherein the cost value of the second coordinate point to be assigned in the set of second coordinate points to be assigned is non-negative.
[0029] In some embodiments, the updating unit is further configured to determine whether to move the second coordinate point to be assigned to other first initial clusters based on the distances between the second coordinate point to be assigned and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster in the following manner: sort the other first initial clusters in order from near to far according to the distances between the second coordinate point to be assigned and the updated center points of the other first initial clusters, and according to the sorting results, perform the following transfer steps: determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as the third distance, determine the distance between the second coordinate point to be assigned and the updated center point of the other first initial cluster as the fourth distance, and determine the difference between the third distance and the fourth distance as the first exchange gain; determine the other first Whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to the initial clustering cluster; in response to determining that there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters, determining the distance between the existing coordinate point to be exchanged and the updated center point of the other first initial clustering cluster as the fifth distance, determining the distance between the existing coordinate point to be exchanged and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs as the sixth distance, and determining the difference between the fifth distance and the sixth distance as the second exchange gain; determining whether the sum of the first exchange gain and the second exchange gain is greater than the preset first value; in response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, transferring the second coordinate point to be assigned to the other first initial clustering cluster, and transferring the existing coordinate point to be exchanged to the first initial clustering cluster to which the second coordinate point to be assigned belongs.
[0030] In some embodiments, there are at least two coordinate points to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters; and the update unit is further configured to transfer the second coordinate point to be assigned to other first initial clustering clusters in response to determining that the sum of the first exchange gain and the second exchange gain is greater than a preset first value, and transfer the existing coordinate point to be exchanged to the first initial clustering cluster to which the second coordinate point to be assigned belongs in the following manner: in response to determining that there are at least two sums of the first exchange gain and the respective second exchange gains corresponding to at least two coordinate points to be exchanged that are greater than the preset first value, transfer the second coordinate point to be assigned to other first initial clustering clusters, and transfer the coordinate point to be exchanged corresponding to the maximum cost value among the at least two existing coordinate points to be exchanged to the first initial clustering cluster to which the second coordinate point to be assigned belongs.
[0031] In some embodiments, the transfer step also includes: in response to determining that there is no coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters or determining that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, determining whether the first exchange gain is greater than the preset second value, and determining whether the number of coordinate points included in the other first initial clustering clusters is less than the first target value; in response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in the other first initial clustering clusters is less than the first target value, transferring the second coordinate point to be assigned to the other first initial clustering clusters.
[0032] In some embodiments, the transfer step also includes: in response to determining that the first exchange gain is greater than a preset second value and the number of coordinate points contained in other first initial clusters is equal to the first target value, adding the second coordinate point to be assigned to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be assigned belongs.
[0033] In some embodiments, the transfer step further includes: in response to determining that there are no second coordinate points to be allocated in the second set of coordinate points to be allocated that have not been subjected to the transfer step, clearing the set of coordinate points to be exchanged corresponding to each first initial clustering cluster in a preset number of first initial clustering clusters.
[0034] In some embodiments, the apparatus further includes: an execution unit configured to re-execute the updating step in response to determining that the second coordinate point to be assigned is moved to another first initial cluster.
[0035] In some embodiments, the determination unit is further configured to re-determine the number of coordinate points contained in each of the preset number of updated cluster clusters based on a preset distance decay function in the following manner: determine the distance between the cluster center of each of the preset number of updated cluster clusters and the target location point; generate sorting numbers from small to large corresponding to each updated cluster cluster in order of distance from far to near; determine the median of the sorting numbers; for each updated cluster cluster in the preset number of updated cluster clusters, determine the attenuation value corresponding to the number of coordinate points contained in the updated cluster cluster based on the sorting number and median of the updated cluster cluster, and determine the number of coordinate points contained in the updated cluster cluster based on the attenuation value.
[0036] In some embodiments, the determination unit is further configured to determine the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster based on the sorting number and median of the updated cluster cluster in the following manner: determine the absolute value of the difference between the sorting number and the median of the updated cluster cluster, calculate the logarithm of the sum of the absolute value and a preset third value, determine the product of the preset coefficient and the logarithm, and determine the ratio of the product to the preset fourth value as the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster.
[0037] In some embodiments, the determination unit is further configured to determine the number of coordinate points included in the updated cluster cluster based on the attenuation value in the following manner: based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster, determine the minimum value of the number of coordinate points included in the updated cluster cluster, wherein the second target value is a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to a preset number; and determine the sum of the minimum value and the preset fifth value as the maximum value of the number of coordinate points included in the updated cluster cluster.
[0038] In some embodiments, the determination unit is further configured to determine the minimum number of coordinate points included in the updated cluster cluster based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster in the following manner: in response to determining that the sorting number of the updated cluster cluster is less than the median, the difference between the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster is determined as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0039] In some embodiments, the determination unit is further configured to determine the minimum number of coordinate points included in the updated cluster cluster based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster in the following manner: in response to determining that the sorting number of the updated cluster cluster is greater than the median, the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster is determined as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0040] In some embodiments, the determination unit is further configured to determine the minimum number of coordinate points included in the updated cluster cluster based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster in the following manner: in response to determining that the sorting number of the updated cluster cluster is equal to the median, the second target value is determined as the minimum value of the number of coordinate points included in the updated cluster cluster.
[0041] In some embodiments, the output unit is further configured to re-cluster the coordinate points in the coordinate point set based on the number of coordinate points contained in each updated cluster cluster in the following manner to obtain a preset number of target cluster clusters, and output cluster information of the preset number of target cluster clusters: re-select a preset number of coordinate points in the coordinate point set as second initial center points, and re-cluster the coordinate points in the coordinate point set with the second initial center points as cluster centers to obtain a preset number of second initial cluster clusters, wherein the number of coordinate points contained in each second initial cluster cluster is the number of coordinate points contained in the corresponding updated cluster cluster; update the preset number of second initial cluster clusters to obtain a preset number of updated second cluster clusters as target cluster clusters.
[0042] In a third aspect, an embodiment of the present application provides an electronic device comprising: one or more processors; a storage device storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in any implementation manner in the first aspect.
[0044] The above-mentioned embodiments of the present application provide a method and apparatus for outputting information. The method and apparatus select a preset number of coordinate points from a preset set of coordinate points as first initial center points, cluster the coordinate points in the above set of coordinate points with the selected first initial center points as cluster centers, and obtain the above-mentioned preset number of first initial cluster clusters. Then, the above-mentioned preset number of first initial cluster clusters are updated to obtain the above-mentioned preset number of updated cluster clusters. Then, based on a preset distance decay function, the number of coordinate points contained in each updated cluster cluster in the above-mentioned preset number of updated cluster clusters is re-determined. Finally, based on the number of coordinate points contained in each updated cluster cluster, the coordinate points in the above set of coordinate points are re-clustered to obtain the above-mentioned preset number of target cluster clusters, and cluster information of the above-mentioned preset number of target cluster clusters is output. This method not only ensures the geographical clustering between the distribution points, but also takes into account the distance between the center point of the distribution area and the target location point. Therefore, the number of coordinate points contained in the cluster cluster can be adjusted according to the distance between the cluster cluster and the target location point, thereby achieving the purpose of balancing the distribution workload. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0046] Figure 1 is an exemplary system architecture diagram to which various embodiments of the present application may be applied;
[0047] Figure 2 is a flowchart of an embodiment of a method for outputting information according to the present application;
[0048] Figure 3 is a flow chart of updating a cluster in a method for outputting information according to the present application;
[0049] Figure 4 is a flow chart of re-determining the number of coordinate points included in each updated cluster in the method for outputting information according to the present application;
[0050] Figure 5 is a flow chart of re-clustering coordinate points in a coordinate point set in the method for outputting information according to the present application;
[0051] Figure 6 is a structural diagram of an embodiment of a device for outputting information according to the present application;
[0052] Figure 7 It is a structural diagram of a computer system suitable for implementing the electronic device of the embodiment of the present application. DETAILED DESCRIPTION
[0053] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0054] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0055] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the method for outputting information of the present application may be applied.
[0056] like Figure 1 As shown, system architecture 100 may include terminal devices 1011, 1012, and 1013, a network 102, and a server 103. Network 102 is used as a medium for providing communication links between terminal devices 1011, 1012, and 1013 and server 103. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0057] Users can use terminal devices 1011, 1012, and 1013 to interact with server 103 via network 102 to send or receive messages. For example, terminal devices 1011, 1012, and 1013 can send a set of coordinate points and a preset number to server 103. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as speech synthesis applications, search applications, and translation applications.
[0058] Terminal devices 1011, 1012, and 1013 can be hardware or software. When terminal devices 1011, 1012, and 1013 are hardware, they can be various electronic devices with speakers and supporting information interaction, including but not limited to smart phones, tablet computers, laptop computers, etc. When terminal devices 1011, 1012, and 1013 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or they can be implemented as a single software or software module. No specific limitation is made here.
[0059] The server 103 may be a server that provides various services, for example, a server that analyzes the coordinate point sets and preset numbers sent by the terminal devices 1011 , 1012 , and 1013 . The server 103 can first obtain a set of coordinate points and a preset number from the terminal devices 1011, 1012, and 1013, select the preset number of coordinate points in the above coordinate point set as the first initial center point, cluster the coordinate points in the above coordinate point set with the first initial center point as the cluster center, and obtain the preset number of first initial cluster clusters; then, the preset number of first initial cluster clusters can be updated to obtain the preset number of updated cluster clusters; then, based on the preset distance decay function, the number of coordinate points contained in each updated cluster cluster in the preset number of updated cluster clusters can be re-determined; finally, based on the number of coordinate points contained in each updated cluster cluster, the coordinate points in the above coordinate point set can be re-clustered to obtain the preset number of target cluster clusters, and cluster information of the preset number of target cluster clusters can be output. For example, the cluster information of the preset number of target cluster clusters can be output to the terminal devices 1011, 1012, and 1013.
[0060] It should be noted that the server 103 can be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0061] It should be noted that the method for outputting information provided in the embodiment of the present application is usually executed by the server 103.
[0062] It should also be noted that the server 103 may also store the coordinate point set and the preset number locally, and the server 103 may obtain the coordinate point set and the preset number locally. In this case, the exemplary system architecture 100 may not have the network 102 and the terminal devices 1011, 1012, 1013.
[0063] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0064] Continue to refer Figure 2 , shows a process 200 of an embodiment of a method for outputting information according to the present application. The method for outputting information includes the following steps:
[0065] Step 201 : Select a preset number of coordinate points from a preset coordinate point set as first initial center points, cluster the coordinate points in the coordinate point set with the first initial center points as cluster centers, and obtain a preset number of first initial clusters.
[0066] In this embodiment, the execution subject of the method for outputting information (eg Figure 1 The server shown in FIG. 1 may select a preset number of coordinate points from a preset set of coordinate points as the first initial center points. The set of coordinate points may be a set of coordinate points within a specified area, or a set of coordinate points including preset points of interest. Here, the execution entity may randomly select a preset number of coordinate points from the set of coordinate points as the first initial center points; the execution entity may also select a preset number of coordinate points from the set of coordinate points as the first initial center points using the Kmeans++ algorithm. The Kmeans++ algorithm is a k-means clustering algorithm. The initial cluster centers selected using the Kmeans++ algorithm are generally as far apart as possible.
[0067] Afterwards, the execution entity may cluster the coordinate points in the coordinate point set using the first initial center point as the cluster center to obtain the preset number of first initial clusters. Clustering is the process of dividing a collection of physical or abstract objects into multiple classes consisting of similar objects. A cluster generated by clustering is a collection of data objects that are similar to objects in the same cluster and different from objects in other clusters. Here, for each cluster center, the execution entity may cluster the coordinate points in the coordinate point set whose distance from the cluster center is less than a preset first distance threshold into a single cluster.
[0068] Step 202 : updating a preset number of first initial clusters to obtain a preset number of updated clusters.
[0069] In this embodiment, the execution entity can update the preset number of first initial clusters to obtain the preset number of updated clusters. Specifically, the execution entity can re-determine the center point of each updated cluster in the preset number of updated clusters. For each coordinate point in the coordinate point set, the execution entity can determine the distance between the coordinate point and the updated center point of the first initial cluster to which the coordinate point belongs; then, determine the distance between the coordinate point and the updated center points of other first initial clusters; then, determine whether the distance between the coordinate point and the updated center point of the first initial cluster to which the coordinate point belongs is greater than the distance between the coordinate point and the updated center points of other first initial clusters; if so, the coordinate point can be transferred to the other first initial clusters with a closer distance.
[0070] Step 203 : re-determine the number of coordinate points contained in each of the preset number of updated clusters based on a preset distance decay function.
[0071] In this embodiment, the execution entity may re-determine the number of coordinate points contained in each of the preset number of updated clusters based on a preset distance decay function. The distance decay function is generally related to the distance between the cluster center of the updated cluster and the target location point. The target location point is generally the location point where the warehouse is located. Specifically, the execution entity may first determine the distance between each updated cluster and the target location point. Thereafter, the ratio of the sum of the distances to the number of updated clusters is determined as the average distance. Thereafter, the ratio of the number of coordinate points in the coordinate point set to the preset number is rounded down to obtain the average number of coordinate points. Thereafter, for each updated cluster in the preset number of updated clusters, the distance between the cluster center of the updated cluster and the target location point is subtracted from the distance average to obtain a distance difference, and the product of the distance difference and a preset coefficient is determined. Finally, the sum of the above product and the average value of the number of coordinate points is determined as the number of coordinate points included in the updated cluster.
[0072] Step 204 : re-clustering the coordinate points in the coordinate point set based on the number of coordinate points included in each updated cluster to obtain a preset number of target clusters, and outputting cluster information of the preset number of target clusters.
[0073] In this embodiment, the execution entity may re-cluster the coordinate points in the coordinate point set based on the number of coordinate points contained in each updated cluster to obtain the preset number of target clusters. Specifically, for each updated cluster, the execution entity may cluster the coordinate points in the coordinate point set whose distance from the cluster center of the updated cluster is equal to a preset second distance threshold into one cluster. It should be noted that the second distance threshold is determined by the number of coordinate points contained in the updated cluster, so that the number of coordinate points contained in each updated cluster can be the number determined in step 203.
[0074] In this embodiment, the execution entity may output cluster information of the preset number of target clusters. The cluster information may include, but is not limited to, at least one of the following: coordinate information of coordinate points included in each target cluster, the number of coordinate points included in each target cluster, and the distance between each target cluster and the target location point.
[0075] In some optional implementations of this embodiment, the execution entity may cluster the coordinate points in the coordinate point set with the first initial center point as the cluster center to obtain the preset number of first initial clusters in the following manner: for each first coordinate point to be assigned in the at least one first coordinate point to be assigned, the execution entity may first determine the gain of the first coordinate point to be assigned based on the distance between the first coordinate point to be assigned and each first initial center point. The at least one first coordinate point to be assigned may include other coordinate points in the coordinate point set other than the first initial center point. Thereafter, the execution entity may cluster the at least one first coordinate point to be assigned based on the gain of each first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point to obtain the preset number of first initial clusters. It should be noted that the number of coordinate points in each first initial cluster may be a value obtained by rounding the ratio of the number of coordinate points in the coordinate point set to the preset number. The number of coordinate points in each first initial cluster may be a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to the preset number, or a value obtained by rounding up the ratio of the number of coordinate points in the coordinate point set to the preset number. For example, if the number of coordinate points in the coordinate point set is 100 and the preset number is 7, the number of coordinate points in each first initial cluster may be 14 (rounded down) or 15 (rounded up).
[0076] In some optional implementations of this embodiment, the execution entity may determine the gain of the first coordinate point to be allocated based on the distances between the first coordinate point to be allocated and each of the first initial center points in the following manner: the execution entity may determine each distance between the first coordinate point to be allocated and each of the first initial center points, and may determine the difference between the maximum distance and the minimum distance among the above distances as the gain of the first coordinate point to be allocated. As an example, if the distances between the first coordinate point to be allocated and the five first initial center points are 120 meters, 140 meters, 115 meters, 80 meters, and 150 meters, respectively, then the difference of 70 meters between the maximum distance of 150 meters and the minimum distance of 80 meters may be determined as the gain of the first coordinate point to be allocated.
[0077] In some optional implementations of this embodiment, the execution entity may cluster the at least one first coordinate point to be allocated based on the gain of each first coordinate point to be allocated and the distance between each first coordinate point to be allocated and each first initial center point in the at least one first coordinate point to be allocated in the following manner: the execution entity may allocate each first coordinate point to be allocated to a corresponding cluster in descending order of the gain of the at least one first coordinate point to be allocated. For each first coordinate point to be allocated in the at least one first coordinate point to be allocated, the cluster corresponding to the first coordinate point to be allocated may be a cluster in which the number of coordinate points currently included is less than the first target value and the distance between the corresponding first initial center point and the first coordinate point to be allocated is the closest. The first target value is the value obtained by rounding up the ratio of the number of coordinate points in the set of coordinate points to the preset number.
[0078] In some optional implementations of this embodiment, the execution entity may perform the following update steps: First, the center point of each of the preset number of first initial clusters may be re-determined as the updated center point. Here, for each first initial cluster, the execution entity may use the average of the horizontal coordinate values of all coordinate points included in the first initial cluster in the preset coordinate system as the updated horizontal coordinate value of the center point, and use the average of the vertical coordinate values of all coordinate points included in the first initial cluster in the above coordinate system as the updated vertical coordinate value of the center point. Then, for each of the at least one second coordinate point to be assigned, the execution entity may re-determine the cluster to which the second coordinate point belongs based on the distances between the second coordinate point to be assigned and each of the updated center points. Specifically, the execution entity may determine whether the updated center point closest to the second coordinate point to be assigned is the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs; if not, the second coordinate point to be assigned may be transferred to the first initial cluster to which the updated center point closest to the second coordinate point belongs. It should be noted that the at least one second coordinate point to be allocated may include other coordinate points in the coordinate point set except the updated center point.
[0079] The method provided in the above-mentioned embodiment of the present application re-clusters the coordinate points in the coordinate point set based on the number of coordinate points contained in each updated cluster. This method not only ensures the geographical clustering between the distribution points, but also takes into account the distance between the center point of the distribution area and the target location point. Therefore, the number of coordinate points contained in the cluster can be adjusted according to the distance between the cluster and the target location point, thereby achieving the purpose of balancing the distribution workload.
[0080] Continue to see Figure 3 , Figure 3 This is a process 300 of updating the cluster in the method for outputting information according to the present application. Figure 3 As shown, in this embodiment, the updating steps for updating the clusters include:
[0081] Step 301 : re-determine the center point of each of the preset number of first initial clusters as the updated center point.
[0082] In this embodiment, the execution subject of the method for outputting information (eg Figure 1 The server shown in FIG. 1 may re-determine the center point of each of the preset number of first initial clusters as the updated center point. Here, for each first initial cluster, the execution entity may use the average of the horizontal coordinate values of all coordinate points included in the first initial cluster in the preset coordinate system as the horizontal coordinate value of the updated center point, and use the average of the vertical coordinate values of all coordinate points included in the first initial cluster in the above coordinate system as the vertical coordinate value of the updated center point.
[0083] Step 302: For each second coordinate point to be assigned in at least one second coordinate point to be assigned, the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs is determined as a first distance, the minimum distance among the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters is determined as a second distance, and the difference between the first distance and the second distance is determined as a cost value corresponding to the second coordinate point to be assigned.
[0084] In this embodiment, for each of the at least one second coordinate point to be assigned, the execution entity may determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a first distance, determine the minimum distance between the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as a second distance, and determine the difference between the first distance and the second distance as the cost value corresponding to the second coordinate point to be assigned. Here, the other first initial clusters are the other initial clusters in the preset number of first initial clusters other than the first initial cluster to which the second coordinate point to be assigned belongs. It should be noted that the at least one second coordinate point to be assigned includes the other coordinate points in the set of coordinate points other than the updated center point. The cost value corresponding to the coordinate point can be understood as the cost of moving the coordinate point out of the initial cluster to which the coordinate point belongs and into another initial cluster.
[0085] Step 303 : For each of the preset number of first initial clusters, based on the cost values corresponding to the second coordinate points to be allocated in the first initial cluster, generate a set of coordinate points to be exchanged corresponding to the first initial cluster.
[0086] In this embodiment, for each of the preset number of first initial clustering clusters, the execution entity can generate a set of coordinate points to be exchanged corresponding to the first initial clustering cluster based on the cost values corresponding to the second coordinate points to be allocated in the first initial clustering cluster. Specifically, the execution entity can add the second coordinate points to be allocated whose corresponding cost values are positive numbers to the set of coordinate points to be exchanged corresponding to the first initial clustering cluster. The execution entity can select a preset first number (for example, three) of second coordinate points to be allocated in descending order of the corresponding cost values and add them to the set of coordinate points to be exchanged corresponding to the first initial clustering cluster.
[0087] Step 304: Determine whether to move the second coordinate point to be assigned to another first initial cluster based on the distances between the second coordinate point to be assigned and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster, in ascending order of the cost values corresponding to the second coordinate points to be assigned in the set of coordinate points to be assigned, based on the distances between the second coordinate point to be assigned and the updated center points.
[0088] In this embodiment, the execution subject can determine whether to move the second coordinate point to be allocated to other first initial clusters based on the distances between the second coordinate point to be allocated and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster in the order of the cost values corresponding to the second coordinate points to be allocated in the second set of coordinate points to be allocated from small to large. Specifically, the execution subject can determine whether the updated center point closest to the second coordinate point to be allocated is the updated center point of the first initial cluster to which the second coordinate point to be allocated belongs; if not, it can be determined whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to the first initial cluster to which the updated center point closest to the second coordinate point to be allocated belongs; if so, the second coordinate point to be allocated is transferred to the first initial cluster to which the updated center point closest to the second coordinate point to be allocated belongs, and the existing coordinate point to be exchanged is transferred to the first initial cluster to which the second coordinate point to be allocated belongs. It should be noted that the cost value of the second coordinate point to be allocated in the second set of coordinate points to be allocated is a non-negative number.
[0089] In some optional implementations of this embodiment, the execution entity may determine whether to move the second coordinate point to be assigned to another first initial cluster in the following manner: the execution entity may sort the other first initial clusters in order of distance from the second coordinate point to be assigned to the updated center point of each other first initial cluster, and perform the following transfer steps according to the sorting result:
[0090] Step 3041: Determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as the third distance, determine the distance between the second coordinate point to be assigned and the updated center point of the other first initial cluster as the fourth distance, and determine the difference between the third distance and the fourth distance as the first exchange gain.
[0091] Here, the execution entity may determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as the third distance, determine the distance between the second coordinate point to be assigned and the updated center point of another first initial cluster as the fourth distance, and determine the difference between the third distance and the fourth distance as the first exchange gain. For example, if the third distance is 5 and the fourth distance is 3, the first exchange gain is 2.
[0092] Step 3042: Determine whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clusters.
[0093] Here, the execution entity may determine whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clusters. If there is a coordinate point to be exchanged, the execution entity may execute step 3043.
[0094] Step 3043, in response to determining that there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters, the distance between the existing coordinate point to be exchanged and the updated center point of the other first initial clustering cluster is determined as the fifth distance, the distance between the existing coordinate point to be exchanged and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs is determined as the sixth distance, and the difference between the fifth distance and the sixth distance is determined as the second exchange gain.
[0095] Here, if it is determined in step 3042 that there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to the other first initial clustering clusters, the execution entity may determine the distance between the existing coordinate point to be exchanged and the updated center point of the other first initial clustering cluster as the fifth distance, determine the distance between the existing coordinate point to be exchanged and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs as the sixth distance, and determine the difference between the fifth distance and the sixth distance as the second exchange gain. Here, the execution entity may traverse the coordinate points to be exchanged in the set of coordinate points to be exchanged, for example, in descending order of corresponding cost values.
[0096] Step 3044: Determine whether the sum of the first exchange gain and the second exchange gain is greater than a preset first value.
[0097] Here, the execution entity may determine whether the sum of the first exchange gain and the second exchange gain is greater than a preset first value. Here, the first value may be 0. If the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the execution entity may execute step 3045.
[0098] Step 3045: In response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the second coordinate point to be assigned is transferred to another first initial cluster, and the existing coordinate point to be exchanged is transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
[0099] Here, if it is determined in step 3044 that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the above-mentioned execution entity can transfer the second coordinate point to be assigned to other first initial cluster clusters, and transfer the existing coordinate point to be exchanged to the first initial cluster cluster to which the second coordinate point to be assigned belongs.
[0100] In some optional implementations of this embodiment, at least two coordinate points to be exchanged may exist in the set of coordinate points to be exchanged corresponding to other first initial clusters. The execution entity may determine whether at least two sums of the first exchange gain and the second exchange gains corresponding to the at least two coordinate points to be exchanged are greater than the preset first value. If so, the second coordinate point to be assigned may be transferred to another first initial cluster, and the coordinate point to be exchanged corresponding to the maximum cost value among the at least two coordinate points to be exchanged may be transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
[0101] In some optional implementations of this embodiment, the transfer step may further include:
[0102] Step 3046: In response to determining that there are no coordinate points to be exchanged in the coordinate point sets to be exchanged corresponding to other first initial clusters or determining that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, determine whether the first exchange gain is greater than the preset second value.
[0103] Here, if it is determined in step 3042 that there are no coordinate points to be exchanged in the set of coordinate points to be exchanged corresponding to the other first initial clusters, or if it is determined in step 3044 that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, the execution entity may determine whether the first exchange gain is greater than a preset second value, which may be 0. If it is determined that the first exchange gain is greater than the second value, the execution entity may execute step 3047.
[0104] Step 3047 : In response to determining that the first exchange gain is greater than the preset second value, determine whether the number of coordinate points included in other first initial clusters is less than the first target value.
[0105] If, in step 3046, it is determined that the first exchange gain is greater than the preset second value, the execution entity may determine whether the number of coordinate points included in the other first initial clusters is less than a first target value. The first target value is typically the value obtained by rounding up the ratio of the number of coordinate points in the coordinate point set to the preset number, i.e., the upper limit of the coordinate points that can be included in the other first initial clusters.
[0106] Step 3048: In response to determining that the number of coordinate points included in the other first initial clusters is less than the first target value, the second coordinate point to be allocated is transferred to the other first initial clusters.
[0107] Here, if it is determined in step 3046 that the first exchange gain is greater than the above-mentioned second value and it is determined in step 3047 that the number of coordinate points contained in other first initial clusters is less than the above-mentioned first target value, the above-mentioned execution entity can transfer the second coordinate point to be allocated to other first initial clusters.
[0108] In some optional implementations of this embodiment, the transfer step may further include:
[0109] Step 3049: In response to determining that the first exchange gain is greater than the preset second value, determine whether the number of coordinate points included in other first initial clusters is equal to the first target value.
[0110] Here, if it is determined in step 3046 that the first exchange gain is greater than the above-mentioned second value, the above-mentioned execution entity can determine whether the number of coordinate points contained in other first initial clustering clusters is equal to the first target value, that is, determine whether the number of coordinate points contained in other first initial clustering clusters reaches the upper limit value.
[0111] Step 3050: In response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points contained in other first initial clusters is equal to the first target value, the second coordinate point to be allocated is added to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be allocated belongs.
[0112] Here, if it is determined in step 3046 that the first exchange gain is greater than the above-mentioned second value and it is determined in step 3049 that the number of coordinate points contained in other first initial clusters is equal to the above-mentioned first target value, the above-mentioned execution entity can add the second coordinate point to be allocated to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be allocated belongs.
[0113] In some optional implementations of this embodiment, the transfer step may further include determining whether the second set of coordinate points to be allocated does not contain any second coordinate points for which the transfer step has not been executed. If it is determined that the second set of coordinate points to be allocated does not contain any second coordinate points for which the transfer step has not been executed, the execution entity may clear the set of coordinate points to be exchanged corresponding to each of the preset number of first initial clusters.
[0114] In some optional implementations of this embodiment, after determining whether to move the second coordinate point to be assigned to another first initial cluster, the execution entity may re-execute the updating step if it is determined that the second coordinate point to be assigned is to be moved to another first initial cluster. If it is determined that the second coordinate point to be assigned is not to be moved to another first initial cluster, then all currently updated clusters have converged.
[0115] The above-mentioned embodiment of the present application provides a method for updating cluster clusters, which determines the cost value of the coordinate point and transfers the coordinate points that meet the preset conditions in the order of the cost value from small to large, or exchanges them with the coordinate points to be exchanged in other cluster clusters, so that each updated cluster cluster reaches convergence.
[0116] Further references Figure 4 , Figure 4 This is a process 400 of re-determining the number of coordinate points contained in each updated cluster in the method for outputting information according to the present application. Figure 4As shown, in this embodiment, the step of re-determining the number of coordinate points included in each updated cluster includes:
[0117] Step 401 : Determine the distance between the cluster center of each of a preset number of updated clusters and a target location point.
[0118] In this embodiment, the execution subject of the method for outputting information (eg Figure 1 The server shown in FIG2 may determine the distance between the cluster center of each of the preset number of updated clusters and the target location point. In the logistics and transportation scenario, the target location point may be the location point where the warehouse is located.
[0119] Step 402 : Generate ascending order numbers corresponding to the updated clusters in order of distance from far to near.
[0120] In this embodiment, the execution entity may generate a sorting number from small to large corresponding to each updated cluster according to the order of distance from far to near determined in step 401. As an example, if there are five updated clusters, the distances between the cluster center of the first cluster, the cluster center of the second cluster, the cluster center of the third cluster, the cluster center of the fourth cluster, and the cluster center of the fifth cluster and the target location point are 100 meters, 58 meters, 39 meters, 125 meters, and 68 meters, respectively. Then, in order of distance from far to near, the sorting number of the generated first cluster is 2, the sorting number of the generated second cluster is 4, the sorting number of the generated third cluster is 5, the sorting number of the generated fourth cluster is 1, and the sorting number of the generated fifth cluster is 3.
[0121] Step 403: Determine the median of the sorted numbers.
[0122] In this embodiment, the execution entity can determine the median of the sorted numbers. The median represents a value in a sample, population, or probability distribution that divides a set of values into two equal parts. For a finite set of numbers, all observations can be sorted by ranking them and then finding the one in the middle as the median. Here, the sorted numbers can be sorted from small to large, and the one in the middle can be found as the median. As an example, for sorted numbers 1, 2, 3, 4, and 5, the middle 3 is the median.
[0123] Step 404: for each updated cluster in a preset number of updated clusters, determine the attenuation value corresponding to the number of coordinate points included in the updated cluster based on the sorting number and median of the updated cluster, and determine the number of coordinate points included in the updated cluster based on the attenuation value.
[0124] In this embodiment, for each of the preset number of updated cluster clusters, the execution entity can determine the attenuation value corresponding to the number of coordinate points contained in the updated cluster cluster based on the sorting number and median of the updated cluster cluster, and determine the number of coordinate points contained in the updated cluster cluster based on the attenuation value. As an example, the execution entity can determine the difference between the sorting number of the updated cluster cluster and the median, and multiply the difference between the sorting number of the updated cluster cluster and the median by a preset coefficient to determine the attenuation value corresponding to the number of coordinate points contained in the updated cluster cluster. Afterwards, the ratio of the number of coordinate points in the above-mentioned coordinate point set to the above-mentioned preset number can be rounded to obtain the average value of the number of coordinate points, and the sum of the above-mentioned attenuation value and the above-mentioned average value of the number of coordinate points can be determined as the number of coordinate points contained in the updated cluster cluster.
[0125] In some optional implementations of this embodiment, the execution entity may determine the attenuation value and the number of coordinate points included in the updated cluster through the following steps:
[0126] Step 4041: determine the absolute value of the difference between the sorting number and the median of the updated cluster, calculate the logarithm of the sum of the absolute value and a preset third value, determine the product of the preset coefficient and the logarithm, and determine the ratio of the product to a preset fourth value as the attenuation value corresponding to the number of coordinate points contained in the updated cluster.
[0127] Here, the above-mentioned execution entity may first determine the absolute value of the difference between the sorting number and the median of the updated cluster cluster. Afterwards, the logarithm of the sum of the above-mentioned absolute value and the preset third value may be obtained. The above-mentioned third value may be 1. Then, the product of the preset coefficient and the logarithm may be determined. The above-mentioned coefficient may be used to adjust the number of decreased coordinate points of the updated cluster cluster farthest from the above-mentioned target location point compared to the updated cluster cluster with the sorting number being the above-mentioned median. Finally, the above-mentioned execution entity may determine the ratio of the above-mentioned product to the preset fourth value as the attenuation value corresponding to the number of coordinate points contained in the updated cluster cluster. The above-mentioned fourth value may be 10. As an example, the above-mentioned execution entity may determine the attenuation value corresponding to the number of coordinate points contained in the updated cluster cluster with the sorting number i according to the following formula (1):
[0128]
[0129] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sorting number i, x iis the difference between the sorting number i and the median, and α is a coefficient used to adjust the number of coordinate points of the updated cluster farthest from the target location point compared to the updated cluster with the sorting number of the median.
[0130] Step 4042: Determine the minimum value of the number of coordinate points included in the updated cluster based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster.
[0131] Here, the execution entity may determine the minimum number of coordinate points included in the updated cluster based on the second target value and the attenuation value corresponding to the number of coordinate points included in the updated cluster. The second target value may be a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to the preset number. For example, if the number of coordinate points in the coordinate point set is 120 and the preset number is 7, the second target value may be 17.
[0132] In some optional implementations of this embodiment, the execution entity may determine the minimum number of coordinate points included in the updated cluster cluster in the following manner: the execution entity may determine whether the sorting number of the updated cluster cluster is less than the median. If it is determined that the sorting number of the updated cluster cluster is less than the median, the difference between the second target value and the attenuation value corresponding to the coordinate point included in the updated cluster cluster may be determined as the minimum number of coordinate points included in the updated cluster cluster. If the sorting number of the updated cluster cluster is less than the median, the minimum value of the sorting number is 0. The execution entity may determine the minimum number of coordinate points included in the updated cluster cluster according to the following formula (2):
[0133]
[0134] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sort number i, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0135] In some optional implementations of this embodiment, the execution entity may also determine the minimum number of coordinate points included in the updated cluster cluster in the following manner: the execution entity may determine whether the sorting number of the updated cluster cluster is greater than the median. If it is determined that the sorting number of the updated cluster cluster is greater than the median, the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster may be determined as the minimum number of coordinate points included in the updated cluster cluster. If the sorting number of the updated cluster cluster is greater than the median, the minimum value of the sorting number is 0. The execution entity may determine the minimum number of coordinate points included in the updated cluster cluster according to the following formula (3):
[0136]
[0137] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sort number i, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0138] In some optional implementations of this embodiment, the execution entity may determine the minimum number of coordinate points included in the updated cluster cluster in the following manner: the execution entity may determine whether the sorting number of the updated cluster cluster is equal to the median. If it is determined that the sorting number of the updated cluster cluster is equal to the median, the second target value may be determined as the minimum number of coordinate points included in the updated cluster cluster. If the sorting number of the updated cluster cluster is equal to the median, the execution entity may determine the minimum number of coordinate points included in the updated cluster cluster according to the following formula (4):
[0139]
[0140] Among them, i is the updated clustering cluster sort number, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0141] Step 4043: Determine the sum of the minimum value and the preset fifth value as the maximum value of the number of coordinate points included in the updated cluster.
[0142] Here, the execution entity may determine the sum of the minimum value determined in step 4042 and the preset fifth value as the maximum number of coordinate points included in the updated cluster. Here, the fifth value may be 1. The execution entity may determine the maximum number of coordinate points included in the updated cluster according to the following formula (5):
[0143] ClusterSize i max =ClusterSize i min +1, (i∈[0, N-1]) (5)
[0144] Among them, i is the updated clustering cluster sort number, N is the number of coordinate points in the above coordinate point set, ClusterSize i max ClusterSize is the maximum number of coordinate points contained in the updated cluster with sort number i. i min The minimum number of coordinate points contained in the updated cluster with sorting number i.
[0145] The above-mentioned embodiment of the present application provides a method for re-determining the number of coordinate points contained in each updated cluster, which can adjust the number of coordinate points contained in the cluster according to the distance, thereby determining the number of coordinate points to be delivered in each distribution area that is more in line with the logistics distribution scenario.
[0146] Further references Figure 5 , Figure 5 This is a process 500 of re-clustering the coordinate points in the coordinate point set in the method for outputting information according to the present application. Figure 5 As shown, in this embodiment, the step of re-clustering the coordinate points in the coordinate point set includes:
[0147] Step 501 : reselect a preset number of coordinate points from the coordinate point set as second initial center points, re-cluster the coordinate points in the coordinate point set with the second initial center points as cluster centers, and obtain a preset number of second initial clusters.
[0148] In this embodiment, the execution subject of the method for outputting information (eg Figure 1The server shown) can reselect the preset number of coordinate points in the above-mentioned coordinate point set as the second initial center point. Here, the above-mentioned execution entity can determine the updated center point determined in the above-mentioned step 301 as the second initial center point. Afterwards, the coordinate points in the coordinate point set can be re-clustered with the above-mentioned second initial center point as the cluster center to obtain a preset number of second initial cluster clusters. Specifically, for each third coordinate point to be allocated in the at least one third coordinate point to be allocated, the above-mentioned execution entity can first determine the gain of the third coordinate point to be allocated based on the distance between the third coordinate point to be allocated and each second initial center point. The at least one third coordinate point to be allocated can include other coordinate points in the above-mentioned coordinate point set except the second initial center point. Afterwards, the above-mentioned execution entity can cluster the at least one third coordinate point to be allocated based on the gain of each third coordinate point to be allocated in the at least one third coordinate point to be allocated and the distance between each third coordinate point to be allocated and each second initial center point to obtain the preset number of second initial cluster clusters. It should be noted that the number of coordinate points included in each second initial cluster is the number of coordinate points included in the corresponding updated cluster.
[0149] Step 502 : Update a preset number of second initial clusters to obtain a preset number of updated second clusters as target clusters.
[0150] In this embodiment, the execution entity may update the preset number of second initial clusters to obtain the preset number of updated second clusters as target clusters. Specifically, the execution entity may update the preset number of second initial clusters using a cluster update method similar to steps 301 to 304. The execution entity may also transfer the coordinate points in each second initial cluster using a coordinate point transfer method similar to steps 3041 to 3050. At the same time, the cluster size is limited using the number of coordinate points contained in each updated cluster to obtain a preset number of target clusters.
[0151] The method for re-clustering the coordinate points in the coordinate point set provided in the above-mentioned embodiment of the present application can determine a preset number of target clusters, and the number of coordinate points in each target cluster is the determined number, thereby achieving the purpose of balancing the distribution workload.
[0152] Further references Figure 6 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a device for outputting information. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0153] like Figure 6 As shown, the apparatus 600 for outputting information in this embodiment includes: a clustering unit 601, an updating unit 602, a determining unit 603, and an output unit 604. The clustering unit 601 is configured to select a preset number of coordinate points from a preset set of coordinate points as first initial center points, cluster the coordinate points in the set of coordinate points with the first initial center points as cluster centers, and obtain a preset number of first initial cluster clusters; the updating unit 602 is configured to update the preset number of first initial cluster clusters to obtain a preset number of updated cluster clusters; the determining unit 603 is configured to re-determine the number of coordinate points included in each of the preset number of updated cluster clusters based on a preset distance decay function; and the output unit 604 is configured to re-cluster the coordinate points in the set of coordinate points based on the number of coordinate points included in each updated cluster cluster to obtain a preset number of target cluster clusters, and output cluster information of the preset number of target cluster clusters.
[0154] In this embodiment, the specific processing of the clustering unit 601, the updating unit 602, the determining unit 603 and the output unit 604 of the apparatus for outputting information 600 can be referred to. Figure 2 This corresponds to step 201, step 202, step 203 and step 204 in the embodiment.
[0155] In some optional implementations of this embodiment, the clustering unit 601 may cluster the coordinate points in the coordinate point set with the first initial center point as the cluster center to obtain the preset number of first initial clusters in the following manner: for each first coordinate point to be assigned in the at least one first coordinate point to be assigned, the clustering unit 601 may first determine the gain of the first coordinate point to be assigned based on the distance between the first coordinate point to be assigned and each first initial center point. The at least one first coordinate point to be assigned may include other coordinate points in the coordinate point set other than the first initial center point. Thereafter, the clustering unit 601 may cluster the at least one first coordinate point to be assigned based on the gain of each first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point to obtain the preset number of first initial clusters. It should be noted that the number of coordinate points in each first initial cluster may be a value obtained by rounding the ratio of the number of coordinate points in the coordinate point set to the preset number. The number of coordinate points in each first initial cluster can be a value obtained by rounding down the ratio of the number of coordinate points in the above coordinate point set to the above preset number, or it can be a value obtained by rounding up the ratio of the number of coordinate points in the above coordinate point set to the above preset number.
[0156] In some optional implementations of this embodiment, the clustering unit 601 may determine the gain of the first coordinate point to be assigned based on the distances between the first coordinate point to be assigned and the first initial center points in the following manner: the clustering unit 601 may determine the distances between the first coordinate point to be assigned and the first initial center points, and may determine the difference between the maximum distance and the minimum distance among the distances as the gain of the first coordinate point to be assigned. For example, if the distances between the first coordinate point to be assigned and the five first initial center points are 120 meters, 140 meters, 115 meters, 80 meters, and 150 meters, respectively, the difference of 70 meters between the maximum distance of 150 meters and the minimum distance of 80 meters may be determined as the gain of the first coordinate point to be assigned.
[0157] In some optional implementations of this embodiment, the clustering unit 601 may cluster the at least one first coordinate point to be allocated based on the gain of each first coordinate point to be allocated and the distance between each first coordinate point to be allocated and each first initial center point in the at least one first coordinate point to be allocated in the following manner: the clustering unit 601 may allocate each first coordinate point to be allocated to a corresponding cluster in descending order of the gain of the at least one first coordinate point to be allocated. For each first coordinate point to be allocated in the at least one first coordinate point to be allocated, the cluster corresponding to the first coordinate point to be allocated may be a cluster whose number of coordinate points currently included is less than a first target value and whose corresponding first initial center point is closest to the first coordinate point to be allocated. The first target value is a value obtained by rounding up the ratio of the number of coordinate points in the coordinate point set to the preset number.
[0158] In some optional implementations of this embodiment, the updating unit 602 may perform the following updating steps: first, the center point of each of the preset number of first initial clusters may be re-determined as the updated center point. Here, for each first initial cluster, the updating unit 602 may use the average of the horizontal coordinate values of all coordinate points included in the first initial cluster in the preset coordinate system as the horizontal coordinate value of the updated center point, and use the average of the vertical coordinate values of all coordinate points included in the first initial cluster in the above coordinate system as the vertical coordinate value of the updated center point. Thereafter, for each of the at least one second coordinate point to be assigned, the updating unit 602 may re-determine the cluster to which the second coordinate point to be assigned belongs based on the distances between the second coordinate point to be assigned and the updated center points. Specifically, the updating unit 602 may determine whether the updated center point closest to the second coordinate point to be assigned is the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs; if not, the second coordinate point to be assigned may be transferred to the first initial cluster to which the updated center point closest to the second coordinate point to be assigned belongs. It should be noted that the at least one second coordinate point to be assigned may include other coordinate points in the coordinate point set other than the updated center point.
[0159] In some optional implementations of this embodiment, for each of the at least one second coordinate point to be assigned, the updating unit 602 may determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a first distance, determine the minimum distance between the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as a second distance, and determine the difference between the first distance and the second distance as the cost value corresponding to the second coordinate point to be assigned. Here, the other first initial clusters are the other initial clusters in the preset number of first initial clusters other than the first initial cluster to which the second coordinate point to be assigned belongs. It should be noted that the at least one second coordinate point to be assigned includes the other coordinate points in the set of coordinate points other than the updated center point. The cost value corresponding to the coordinate point can be understood as the cost of moving the coordinate point out of the initial cluster to which the coordinate point belongs and into another initial cluster.
[0160] Afterwards, for each of the preset number of first initial clustering clusters, the updating unit 602 may generate a set of coordinate points to be exchanged corresponding to the first initial clustering cluster based on the cost values corresponding to the second coordinate points to be assigned in the first initial clustering cluster. Specifically, the updating unit 602 may add the second coordinate points to be assigned whose corresponding cost values are positive numbers to the set of coordinate points to be exchanged corresponding to the first initial clustering cluster. The updating unit 602 may select a preset first number (for example, three) of the second coordinate points to be assigned in descending order of the corresponding cost values and add them to the set of coordinate points to be exchanged corresponding to the first initial clustering cluster.
[0161] Finally, the updating unit 602 can determine whether to move the second coordinate point to be allocated to another first initial clustering cluster based on the distances between the second coordinate point to be allocated and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial clustering cluster in the order of the cost values corresponding to the second coordinate points to be allocated in the second set of coordinate points to be allocated from small to large. Specifically, the updating unit 602 can determine whether the updated center point closest to the second coordinate point to be allocated is the updated center point of the first initial clustering cluster to which the second coordinate point to be allocated belongs; if not, it can be determined whether there is a point to be exchanged in the set of coordinate points to be exchanged corresponding to the first initial clustering cluster to which the updated center point closest to the second coordinate point to be allocated belongs; if so, the second coordinate point to be allocated is transferred to the first initial clustering cluster to which the updated center point closest to the second coordinate point to be allocated belongs, and the existing point to be exchanged is transferred to the first initial clustering cluster to which the second coordinate point to be allocated belongs. It should be noted that the cost value of the second coordinate point to be allocated in the second set of coordinate points to be allocated is a non-negative number.
[0162] In some optional implementations of this embodiment, the updating unit 602 may determine whether to move the second coordinate point to be assigned to another first initial cluster in the following manner: the updating unit 602 may sort the other first initial clusters in order of distance from the second coordinate point to be assigned to the updated center point of each other first initial cluster, and perform the following transfer steps according to the sorting result:
[0163] In step 1, the updating unit 602 may determine the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a third distance, determine the distance between the second coordinate point to be assigned and the updated center point of the other first initial cluster as a fourth distance, and determine the difference between the third distance and the fourth distance as a first exchange gain. For example, if the third distance is 5 and the fourth distance is 3, the first exchange gain is 2.
[0164] In step 2, the updating unit 602 may determine whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clusters.
[0165] In step 3, if it is determined in step 2 that a coordinate point to be exchanged exists in the set of coordinate points to be exchanged corresponding to another first initial cluster, the updating unit 602 may determine the distance between the coordinate point to be exchanged and the updated center point of the other first initial cluster as a fifth distance, the distance between the coordinate point to be exchanged and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a sixth distance, and the difference between the fifth and sixth distances as a second exchange gain. Here, the updating unit 602 may traverse the coordinate points to be exchanged in the set of coordinate points to be exchanged, for example, in descending order of their corresponding cost values.
[0166] In step 4, the updating unit 602 may determine whether the sum of the first exchange gain and the second exchange gain is greater than a preset first value. Here, the first value may be 0. If the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the updating unit 602 may execute step 5.
[0167] Step five, if it is determined in step four that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the above-mentioned update unit 602 can transfer the second coordinate point to be assigned to other first initial clustering clusters, and transfer the existing coordinate point to be exchanged to the first initial clustering cluster to which the second coordinate point to be assigned belongs.
[0168] In some optional implementations of this embodiment, at least two coordinate points to be exchanged may exist in the set of coordinate points to be exchanged corresponding to the other first initial clusters. The updating unit 602 may determine whether at least two sums of the first exchange gain and the second exchange gains corresponding to the at least two coordinate points to be exchanged are greater than the preset first value. If so, the second coordinate point to be assigned may be transferred to the other first initial clusters, and the coordinate point to be exchanged corresponding to the maximum cost value among the at least two coordinate points to be exchanged may be transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
[0169] In some optional implementations of this embodiment, the transfer step may further include: if it is determined that the coordinate point to be exchanged does not exist in the coordinate point set to be exchanged corresponding to the other first initial cluster, or if it is determined that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, the updating unit 602 may determine whether the first exchange gain is greater than a preset second value, which may be 0. If it is determined that the first exchange gain is greater than the preset second value, the updating unit 602 may determine whether the number of coordinate points included in the other first initial cluster is less than a first target value. Here, the first target value is typically a value obtained by rounding up the ratio of the number of coordinate points in the coordinate point set to the preset number, i.e., an upper limit of the coordinate points that the other first initial cluster can include. If it is determined that the first exchange gain is greater than the second value and the number of coordinate points included in the other first initial cluster is less than the first target value, the updating unit 602 may transfer the second coordinate point to be allocated to the other first initial cluster.
[0170] In some optional implementations of this embodiment, the transfer step may further include: if it is determined that the first exchange gain is greater than the second value, the updating unit 602 may determine whether the number of coordinate points included in the other first initial clusters is equal to the first target value, that is, whether the number of coordinate points included in the other first initial clusters reaches the upper limit. If it is determined that the first exchange gain is greater than the second value and the number of coordinate points included in the other first initial clusters is equal to the first target value, the updating unit 602 may add the second coordinate point to be allocated to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be allocated belongs.
[0171] In some optional implementations of this embodiment, the transferring step may further include determining whether the second set of coordinate points to be allocated does not contain any second coordinate points for which the transferring step has not been executed. If it is determined that the second set of coordinate points to be allocated does not contain any second coordinate points for which the transferring step has not been executed, the updating unit 602 may clear the set of coordinate points to be exchanged corresponding to each of the preset number of first initial clusters.
[0172] In some optional implementations of this embodiment, the apparatus 600 for outputting information may further include an execution unit (not shown). The execution unit may further re-execute the updating step if it is determined that the second coordinate point to be assigned needs to be moved to another first initial cluster. If it is determined that the second coordinate point to be assigned does not need to be moved to another first initial cluster, then all currently updated clusters have converged.
[0173] In some optional implementations of this embodiment, the determining unit 603 may first determine the distance between the cluster center of each of the preset number of updated clusters and a target location. In a logistics and transportation scenario, the target location may be the location of a warehouse. The determining unit 603 may then generate ascending order numbers corresponding to the updated clusters according to the determined distances, in descending order. As an example, if there are five updated clusters, the distances between the cluster centers of the first cluster, the second cluster, the third cluster, the fourth cluster, and the fifth cluster and the target location are 100 meters, 58 meters, 39 meters, 125 meters, and 68 meters, respectively. Then, in order of distance from far to near, the generated first cluster is ranked 2, the second cluster is ranked 4, the third cluster is ranked 5, the fourth cluster is ranked 1, and the fifth cluster is ranked 3. Then, the determination unit 603 can determine the median of the ranked numbers. The median represents a value in a sample, population, or probability distribution that divides a set of values into two equal parts. For a finite set of numbers, the median can be found by sorting all the observations from high to low and then finding the one in the middle. Here, the ranked numbers can be sorted from small to large, and the one in the middle can be found as the median. As an example, for sorting numbers 1, 2, 3, 4, and 5, the middle number 3 is the median. Finally, for each of the preset number of updated clusters, the determination unit 603 may determine, based on the sorting number and median of the updated cluster, an attenuation value corresponding to the number of coordinate points included in the updated cluster, and, based on the attenuation value, determine the number of coordinate points included in the updated cluster. As an example, the determination unit 603 may determine the difference between the sorting number of the updated cluster and the median, and multiply the difference between the sorting number of the updated cluster and the median by a preset coefficient to determine the attenuation value corresponding to the number of coordinate points included in the updated cluster. Thereafter, the ratio of the number of coordinate points in the set of coordinate points to the preset number may be rounded to obtain an average value of the number of coordinate points, and the sum of the attenuation value and the average value of the number of coordinate points may be determined as the number of coordinate points included in the updated cluster.
[0174] In some optional implementations of this embodiment, the determination unit 603 may first determine the absolute value of the difference between the sorting number and the median of the updated cluster. Afterwards, the logarithm of the sum of the absolute value and the preset third value may be calculated. The third value may be 1. Then, the product of the preset coefficient and the logarithm may be determined. The coefficient may be used to adjust the number of coordinate points of the updated cluster farthest from the target location point compared to the updated cluster with the sorting number being the median. Finally, the determination unit 603 may determine the ratio of the product to the preset fourth value as the attenuation value corresponding to the number of coordinate points contained in the updated cluster. The fourth value may be 10. As an example, the determination unit 603 may determine the attenuation value corresponding to the number of coordinate points contained in the updated cluster with the sorting number i according to the following formula (1):
[0175]
[0176] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sorting number i, x i is the difference between the sorting number i and the median, and α is a coefficient used to adjust the number of coordinate points of the updated cluster farthest from the target location point compared to the updated cluster with the sorting number of the median.
[0177] In some optional implementations of this embodiment, the determination unit 603 may determine the minimum value of the number of coordinate points contained in the updated cluster based on the second target value and the attenuation value corresponding to the number of coordinate points contained in the updated cluster. The second target value may be a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to the preset number. As an example, if the number of coordinate points in the coordinate point set is 120 and the preset number is 7, the second target value may be 17. Afterwards, the determination unit 603 may determine the sum of the determined minimum value and the preset fifth value as the maximum value of the number of coordinate points contained in the updated cluster. Here, the fifth value may be 1. The determination unit 603 may determine the maximum value of the number of coordinate points contained in the updated cluster according to the following formula (5):
[0178] ClusterSize i max =ClusterSize i min +1, (i∈[0, N-1]) (5)
[0179] Among them, i is the updated clustering cluster sort number, N is the number of coordinate points in the above coordinate point set, ClusterSize i max ClusterSize is the maximum number of coordinate points contained in the updated cluster with sort number i. i min The minimum number of coordinate points contained in the updated cluster with sorting number i.
[0180] In some optional implementations of this embodiment, the determination unit 603 may determine the minimum number of coordinate points included in the updated cluster cluster in the following manner: the determination unit 603 may determine whether the sorting number of the updated cluster cluster is less than the median. If it is determined that the sorting number of the updated cluster cluster is less than the median, the difference between the second target value and the attenuation value corresponding to the coordinate point included in the updated cluster cluster may be determined as the minimum number of coordinate points included in the updated cluster cluster. If the sorting number of the updated cluster cluster is less than the median, the minimum value of the sorting number is 0. The determination unit 603 may determine the minimum number of coordinate points included in the updated cluster cluster according to the following formula (2):
[0181]
[0182] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sort number i, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0183] In some optional implementations of this embodiment, the determination unit 603 may also determine the minimum number of coordinate points included in the updated cluster cluster in the following manner: the determination unit 603 may determine whether the sorting number of the updated cluster cluster is greater than the median. If it is determined that the sorting number of the updated cluster cluster is greater than the median, the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster may be determined as the minimum number of coordinate points included in the updated cluster cluster. If the sorting number of the updated cluster cluster is greater than the median, the minimum value of the sorting number is 0, and the determination unit 603 may determine the minimum number of coordinate points included in the updated cluster cluster according to the following formula (3):
[0184]
[0185] Among them, i is the sorting number of the updated cluster, reduce i is the decay value corresponding to the number of coordinate points contained in the updated cluster with sort number i, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0186] In some optional implementations of this embodiment, the determination unit 603 may determine the minimum number of coordinate points included in the updated cluster in the following manner: the determination unit 603 may determine whether the sorting number of the updated cluster is equal to the median. If it is determined that the sorting number of the updated cluster is equal to the median, the second target value may be determined as the minimum number of coordinate points included in the updated cluster. If the sorting number of the updated cluster is equal to the median, the determination unit 603 may determine the minimum number of coordinate points included in the updated cluster according to the following formula (4):
[0187]
[0188] Among them, i is the updated clustering cluster sort number, N is the number of coordinate points in the above coordinate point set, K is the above preset number, ClusterSize i min is the minimum number of coordinate points contained in the updated cluster with sorting number i, and m is the median.
[0189] In some optional implementations of this embodiment, the output unit 604 may reselect the preset number of coordinate points from the coordinate point set as the second initial center point. Here, the output unit 604 may determine the updated center point as the second initial center point. The coordinate points in the coordinate point set may then be re-clustered using the second initial center point as the cluster center to obtain a preset number of second initial clusters. Specifically, for each of the at least one third coordinate point to be assigned, the output unit 604 may first determine a gain for the third coordinate point based on the distance between the third coordinate point and each of the second initial center points. The at least one third coordinate point to be assigned may include other coordinate points in the coordinate point set other than the second initial center point. The output unit 604 may then cluster the at least one third coordinate point to be assigned based on the gain of each of the at least one third coordinate point to be assigned and the distance between each of the third coordinate point to be assigned and each of the second initial center points to obtain the preset number of second initial clusters. It should be noted that the number of coordinate points included in each second initial cluster is the number of coordinate points included in the corresponding updated cluster. Afterwards, the output unit 604 can update the preset number of second initial clusters to obtain the preset number of updated second clusters as target clusters.
[0190] Reference below Figure 7 , which shows an electronic device (eg, Figure 1 A schematic diagram of the structure of the server in (700). Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0191] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the electronic device 700 are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0192] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead. Figure 7 Each block shown in the figure may represent one device, or may represent multiple devices as needed.
[0193] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, an electromagnetic signal, an optical signal, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wire, optical cable, RF (radio frequency), etc., or any suitable combination thereof.
[0194] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: selects a preset number of coordinate points from a preset set of coordinate points as first initial center points, clusters the coordinate points in the coordinate point set with the first initial center points as cluster centers, and obtains a preset number of first initial cluster clusters; updates the preset number of first initial cluster clusters to obtain a preset number of updated cluster clusters; based on a preset distance decay function, re-determines the number of coordinate points contained in each updated cluster cluster in the preset number of updated cluster clusters; based on the number of coordinate points contained in each updated cluster cluster, re-clusters the coordinate points in the coordinate point set to obtain a preset number of target cluster clusters, and outputs cluster information of the preset number of target cluster clusters.
[0195] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0196] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0197] The units involved in the embodiments described in the present disclosure may be implemented in software or in hardware. The described units may also be provided in a processor, for example, may be described as: a processor including a clustering unit, an update unit, a determination unit, and an output unit. The names of these units do not, in some cases, constitute a limitation on the units themselves. For example, the update unit may also be described as a "unit that updates a preset number of first initial clustering clusters to obtain a preset number of updated clustering clusters."
[0198] The above description is merely a preferred embodiment of the present disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also encompass other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned inventive concept. For example, a technical solution formed by mutually replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure.
Claims
1. A method for outputting information, comprising: Selecting a preset number of coordinate points from a preset set of coordinate points as first initial center points, clustering the coordinate points in the set of coordinate points with the first initial center points as cluster centers to obtain the preset number of first initial cluster clusters, wherein the coordinate points are coordinate points to be delivered; Updating the preset number of first initial clusters to obtain the preset number of updated clusters; Based on a preset distance decay function, the number of coordinate points contained in each updated cluster in the preset number of updated clusters is re-determined, including: determining the distance between the cluster center of each updated cluster in the preset number of updated clusters and the target location point representing the location of the warehouse; generating a sorting number corresponding to each updated cluster from small to large in the order of the distance from far to near and determining the median of the sorting number; for each updated cluster in the preset number of updated clusters, determining the absolute value of the difference between the sorting number of the updated cluster and the median, calculating the logarithm of the sum of the absolute value and a preset third value, and determining the product of a preset coefficient and the logarithm, wherein the preset coefficient is used to adjust the coordinate of the updated cluster farthest from the above-mentioned target location point compared to the updated cluster with the sorting number being the above-mentioned median. a coefficient of the number of punctuation points decreasing; determining the ratio of the product to a preset fourth value as the attenuation value corresponding to the number of coordinate points included in the updated cluster cluster, and in response to the sorting number of the updated cluster cluster being less than the median, determining the difference between the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster as the minimum number of coordinate points included in the updated cluster cluster, wherein the second target value is a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to the preset number; in response to the sorting number of the updated cluster cluster being greater than the median, determining the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster cluster as the minimum number of coordinate points included in the updated cluster cluster; and determining the sum of the minimum value and a preset fifth value as the maximum number of coordinate points included in the updated cluster cluster; Based on the number of coordinate points included in each updated cluster, the coordinate points in the coordinate point set are re-clustered to obtain the preset number of target clusters, and cluster information of the preset number of target clusters is output.
2. The method according to claim 1, wherein The clustering of the coordinate points in the coordinate point set using the first initial center point as the cluster center to obtain the preset number of first initial cluster clusters includes: For each first coordinate point to be allocated in at least one first coordinate point to be allocated, determining a gain of the first coordinate point to be allocated based on a distance between the first coordinate point to be allocated and each first initial center point, wherein the at least one first coordinate point to be allocated includes other coordinate points in the coordinate point set except the first initial center point; Based on the gain of each first coordinate point to be assigned in the at least one first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point, the at least one first coordinate point to be assigned is clustered to obtain the preset number of first initial clustering clusters, wherein the number of coordinate points in each first initial clustering cluster is a value obtained by rounding off the ratio of the number of coordinate points in the coordinate point set to the preset number.
3. The method according to claim 2, wherein: The step of determining the gain of the first coordinate point to be allocated based on the distance between the first coordinate point to be allocated and each first initial center point includes: The distances between the first coordinate point to be assigned and the first initial center points are determined, and the difference between the maximum distance and the minimum distance among the distances is determined as the gain of the first coordinate point to be assigned.
4. The method according to claim 2 or 3, wherein: The clustering of the at least one first coordinate point to be allocated based on the gain of each first coordinate point to be allocated and the distance between each first coordinate point to be allocated and each first initial center point includes: According to the order of the gain of the at least one first coordinate point to be allocated from large to small, each first coordinate point to be allocated is allocated to a corresponding cluster, wherein, for each first coordinate point to be allocated in the at least one first coordinate point to be allocated, the cluster corresponding to the first coordinate point to be allocated is a cluster whose number of coordinate points currently included is less than the first target value and whose corresponding first initial center point is closest to the first coordinate point to be allocated.
5. The method according to claim 1, wherein The updating of the preset number of first initial clusters to obtain the preset number of updated clusters includes: Perform the following updating steps: re-determine the center point of each first initial cluster in the preset number of first initial clusters as the updated center point; for each second coordinate point to be assigned in at least one second coordinate point to be assigned, based on the respective distances between the second coordinate point to be assigned and the respective updated center points, re-determine the cluster to which the second coordinate point to be assigned belongs, wherein the at least one second coordinate point to be assigned includes other coordinate points in the coordinate point set except the updated center point.
6. The method according to claim 5, wherein: The re-determining the cluster to which the second coordinate point to be assigned belongs based on the distances between the second coordinate point to be assigned and the updated center points includes: Determining the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a first distance, determining the minimum distance among the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as a second distance, and determining the difference between the first distance and the second distance as a cost value corresponding to the second coordinate point to be assigned; For each of the preset number of first initial clusters, generating a set of coordinate points to be exchanged corresponding to the first initial cluster based on the cost values corresponding to the second coordinate points to be assigned in the first initial cluster; According to the order of the cost values corresponding to the second coordinate points to be allocated in the second set of coordinate points to be allocated from small to large, based on the distances between the second coordinate points to be allocated and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster, determine whether to move the second coordinate point to be allocated to other first initial clusters, wherein the cost values of the second coordinate points to be allocated in the second set of coordinate points to be allocated are non-negative numbers.
7. The method according to claim 6, wherein: The determining whether to move the second coordinate point to be assigned to another first initial cluster based on the distances between the second coordinate point to be assigned and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster includes: According to the distance between the second coordinate point to be assigned and the updated center point of each other first initial clustering cluster, the other first initial clustering clusters are sorted in order from near to far, and according to the sorting result, the following transfer steps are performed: the distance between the second coordinate point to be assigned and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs is determined as the third distance, the distance between the second coordinate point to be assigned and the updated center point of the other first initial clustering cluster is determined as the fourth distance, and the difference between the third distance and the fourth distance is determined as the first exchange gain; determining whether there is a coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to the other first initial clustering clusters; in response to determining the coordinate point to be exchanged corresponding to the other first initial clustering clusters There is a coordinate point to be exchanged in the set, the distance between the existing coordinate point to be exchanged and the updated center point of the other first initial clustering cluster is determined as the fifth distance, the distance between the existing coordinate point to be exchanged and the updated center point of the first initial clustering cluster to which the second coordinate point to be assigned belongs is determined as the sixth distance, and the difference between the fifth distance and the sixth distance is determined as the second exchange gain; it is determined whether the sum of the first exchange gain and the second exchange gain is greater than the preset first value; in response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the second coordinate point to be assigned is transferred to the other first initial clustering cluster, and the existing coordinate point to be exchanged is transferred to the first initial clustering cluster to which the second coordinate point to be assigned belongs.
8. The method according to claim 7, wherein: There are at least two coordinate points to be exchanged in the set of coordinate points to be exchanged corresponding to the other first initial clusters; and In response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, transferring the second coordinate point to be assigned to another first initial cluster, and transferring the existing coordinate point to be exchanged to the first initial cluster to which the second coordinate point to be assigned belongs, comprising: In response to determining that at least two sums of the first exchange gain and the second exchange gains corresponding to the at least two coordinate points to be exchanged are greater than the preset first value, the second coordinate point to be assigned is transferred to another first initial cluster, and the coordinate point to be exchanged corresponding to the maximum cost value among the at least two coordinate points to be exchanged is transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
9. The method according to claim 7, wherein: The transferring step further comprises: In response to determining that there is no coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters or determining that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, determine whether the first exchange gain is greater than the preset second value, and determine whether the number of coordinate points included in the other first initial clustering clusters is less than the first target value; in response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in the other first initial clustering clusters is less than the first target value, transfer the second coordinate point to be allocated to the other first initial clustering clusters.
10. The method according to claim 7, wherein: The transferring step further comprises: In response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in other first initial clusters is equal to the first target value, the second coordinate point to be allocated is added to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be allocated belongs.
11. The method according to any one of claims 7 to 10, wherein: The transferring step further comprises: In response to determining that there is no second coordinate point to be allocated in the second coordinate point set to be allocated that has not been subjected to the transfer step, the coordinate point set to be exchanged corresponding to each first initial cluster in the preset number of first initial clusters is cleared.
12. The method according to claim 6, wherein: After determining whether to move the second coordinate point to be assigned to another first initial cluster, the method further includes: In response to determining that the second coordinate point to be assigned is moved to another first initial cluster, the updating step is re-executed.
13. The method according to claim 1, further comprising: In response to determining that the ranking number of the updated cluster is equal to the median, the second target value is determined to be the minimum value of the number of coordinate points included in the updated cluster.
14. The method according to claim 1, wherein The re-clustering of the coordinate points in the coordinate point set based on the number of coordinate points included in each updated cluster to obtain the preset number of target clusters, and outputting cluster information of the preset number of target clusters includes: Reselecting the preset number of coordinate points from the coordinate point set as second initial center points, re-clustering the coordinate points in the coordinate point set with the second initial center points as cluster centers to obtain the preset number of second initial clusters, wherein the number of coordinate points included in each second initial cluster is the same as the number of coordinate points included in the corresponding updated cluster; The preset number of second initial clusters are updated to obtain the preset number of updated second clusters as target clusters.
15. A device for outputting information, comprising: a clustering unit configured to select a preset number of coordinate points from a preset set of coordinate points as first initial center points, cluster the coordinate points in the set of coordinate points with the first initial center points as cluster centers, and obtain the preset number of first initial cluster clusters, wherein the coordinate points are coordinate points to be delivered; an updating unit, configured to update the preset number of first initial clusters to obtain the preset number of updated clusters; The determination unit is configured to re-determine the number of coordinate points contained in each updated cluster in the preset number of updated clusters based on a preset distance decay function, including: determining the distance between the cluster center of each updated cluster in the preset number of updated clusters and the target location point representing the location of the warehouse; generating a sorting number corresponding to each updated cluster from small to large in the order of the distance from far to near and determining the median of the sorting number; for each updated cluster in the preset number of updated clusters, determining the absolute value of the difference between the sorting number of the updated cluster and the median, calculating the logarithm of the sum of the absolute value and a preset third value, and determining the product of a preset coefficient and the logarithm, wherein the preset coefficient is used to adjust the updated cluster farthest from the above-mentioned target location point compared to the updated cluster with the sorting number of the median. a coefficient for decreasing the number of coordinate points of the cluster; determining the ratio of the product to a preset fourth value as the attenuation value corresponding to the number of coordinate points included in the updated cluster, and in response to the sorting number of the updated cluster being less than the median, determining the difference between the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster as the minimum number of coordinate points included in the updated cluster, wherein the second target value is a value obtained by rounding down the ratio of the number of coordinate points in the coordinate point set to the preset number; in response to the sorting number of the updated cluster being greater than the median, determining the sum of the second target value and the attenuation value corresponding to the coordinate points included in the updated cluster as the minimum number of coordinate points included in the updated cluster; and determining the sum of the minimum value and a preset fifth value as the maximum number of coordinate points included in the updated cluster; The output unit is configured to re-cluster the coordinate points in the coordinate point set based on the number of coordinate points included in each updated cluster, obtain the preset number of target clusters, and output cluster information of the preset number of target clusters.
16. The device according to claim 15, wherein The clustering unit is further configured to cluster the coordinate points in the coordinate point set with the first initial center point as the cluster center in the following manner to obtain the preset number of first initial clusters: For each first coordinate point to be allocated in at least one first coordinate point to be allocated, determining a gain of the first coordinate point to be allocated based on a distance between the first coordinate point to be allocated and each first initial center point, wherein the at least one first coordinate point to be allocated includes other coordinate points in the coordinate point set except the first initial center point; Based on the gain of each first coordinate point to be assigned in the at least one first coordinate point to be assigned and the distance between each first coordinate point to be assigned and each first initial center point, the at least one first coordinate point to be assigned is clustered to obtain the preset number of first initial clustering clusters, wherein the number of coordinate points in each first initial clustering cluster is a value obtained by rounding off the ratio of the number of coordinate points in the coordinate point set to the preset number.
17. The device according to claim 16, wherein The clustering unit is further configured to determine the gain of the first coordinate point to be assigned based on the distance between the first coordinate point to be assigned and each first initial center point in the following manner: The distances between the first coordinate point to be assigned and the first initial center points are determined, and the difference between the maximum distance and the minimum distance among the distances is determined as the gain of the first coordinate point to be assigned.
18. The device according to claim 16 or 17, wherein The clustering unit is further configured to cluster the at least one first coordinate point to be allocated based on a gain of each first coordinate point to be allocated and a distance between each first coordinate point to be allocated and each first initial center point in the at least one first coordinate point to be allocated in the following manner: According to the order of the gain of the at least one first coordinate point to be allocated from large to small, each first coordinate point to be allocated is allocated to a corresponding cluster, wherein, for each first coordinate point to be allocated in the at least one first coordinate point to be allocated, the cluster corresponding to the first coordinate point to be allocated is a cluster whose number of coordinate points currently included is less than the first target value and whose corresponding first initial center point is closest to the first coordinate point to be allocated.
19. The device according to claim 15, wherein The updating unit is further configured to update the preset number of first initial clusters in the following manner to obtain the preset number of updated clusters: Perform the following updating steps: re-determine the center point of each first initial cluster in the preset number of first initial clusters as the updated center point; for each second coordinate point to be assigned in at least one second coordinate point to be assigned, based on the respective distances between the second coordinate point to be assigned and the respective updated center points, re-determine the cluster to which the second coordinate point to be assigned belongs, wherein the at least one second coordinate point to be assigned includes other coordinate points in the coordinate point set except the updated center point.
20. The device according to claim 19, wherein The updating unit is further configured to re-determine the cluster to which the second coordinate point to be assigned belongs based on the distances between the second coordinate point to be assigned and the updated center points in the following manner: Determining the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs as a first distance, determining the minimum distance among the distances between the second coordinate point to be assigned and the updated center points of other first initial clusters as a second distance, and determining the difference between the first distance and the second distance as a cost value corresponding to the second coordinate point to be assigned; For each of the preset number of first initial clusters, generating a set of coordinate points to be exchanged corresponding to the first initial cluster based on the cost values corresponding to the second coordinate points to be assigned in the first initial cluster; According to the order of the cost values corresponding to the second coordinate points to be allocated in the second set of coordinate points to be allocated from small to large, based on the distances between the second coordinate points to be allocated and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster, determine whether to move the second coordinate point to be allocated to other first initial clusters, wherein the cost values of the second coordinate points to be allocated in the second set of coordinate points to be allocated are non-negative numbers.
21. The device according to claim 20, wherein The updating unit is further configured to determine whether to move the second coordinate point to be assigned to another first initial cluster based on the distances between the second coordinate point to be assigned and the updated center points and the set of coordinate points to be exchanged corresponding to each first initial cluster in the following manner: The other first initial clusters are sorted in order from near to far according to the distance between the second coordinate point to be assigned and the updated center point of each other first initial cluster, and according to the sorting result, the following transfer step is performed: the distance between the second coordinate point to be assigned and the updated center point of the first initial cluster to which the second coordinate point to be assigned belongs is determined as the third distance, the distance between the second coordinate point to be assigned and the updated center point of the other first initial cluster is determined as the fourth distance, and the difference between the third distance and the fourth distance is determined as the first exchange gain; the corresponding values of the other first initial clusters are determined. whether there is a to-be-exchanged coordinate point in the to-be-exchanged coordinate point set; in response to determining that there is a to-be-exchanged coordinate point in the to-be-exchanged coordinate point set corresponding to the other first initial clustering clusters, determining the distance between the existing to-be-exchanged coordinate point and the updated center point of the other first initial clustering cluster as a fifth distance, determining the distance between the existing to-be-exchanged coordinate point and the updated center point of the first initial clustering cluster to which the second to-be-assigned coordinate point belongs as a sixth distance, and determining the difference between the fifth distance and the sixth distance as a second exchange gain; determining whether the sum of the first exchange gain and the second exchange gain is greater than a preset first value; In response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, the second coordinate point to be assigned is transferred to another first initial cluster, and the existing coordinate point to be exchanged is transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
22. The device according to claim 21, wherein There are at least two coordinate points to be exchanged in the set of coordinate points to be exchanged corresponding to the other first initial clusters; and The updating unit is further configured to, in response to determining that the sum of the first exchange gain and the second exchange gain is greater than the preset first value, transfer the second coordinate point to be assigned to another first initial cluster and transfer the existing coordinate point to be exchanged to the first initial cluster to which the second coordinate point to be assigned belongs, in the following manner: In response to determining that at least two sums of the first exchange gain and the second exchange gains corresponding to the at least two coordinate points to be exchanged are greater than the preset first value, the second coordinate point to be assigned is transferred to another first initial cluster, and the coordinate point to be exchanged corresponding to the maximum cost value among the at least two coordinate points to be exchanged is transferred to the first initial cluster to which the second coordinate point to be assigned belongs.
23. The device according to claim 21, wherein The transferring step further comprises: In response to determining that there is no coordinate point to be exchanged in the set of coordinate points to be exchanged corresponding to other first initial clustering clusters or determining that the sum of the first exchange gain and the second exchange gain is less than or equal to the preset first value, determine whether the first exchange gain is greater than the preset second value, and determine whether the number of coordinate points included in the other first initial clustering clusters is less than the first target value; in response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in the other first initial clustering clusters is less than the first target value, transfer the second coordinate point to be allocated to the other first initial clustering clusters.
24. The apparatus according to claim 21, wherein The transferring step further comprises: In response to determining that the first exchange gain is greater than the preset second value and the number of coordinate points included in other first initial clusters is equal to the first target value, the second coordinate point to be allocated is added to the set of coordinate points to be exchanged corresponding to the first initial cluster to which the second coordinate point to be allocated belongs.
25. The device according to any one of claims 21 to 24, wherein The transferring step further comprises: In response to determining that there is no second coordinate point to be allocated in the second coordinate point set to be allocated that has not been subjected to the transfer step, the coordinate point set to be exchanged corresponding to each first initial cluster in the preset number of first initial clusters is cleared.
26. The apparatus according to claim 20, wherein The device further comprises: The execution unit is configured to re-execute the updating step in response to determining that the second coordinate point to be assigned is moved to another first initial cluster.
27. The apparatus according to claim 15, wherein The determining unit is further configured to: in response to determining that the sorting number of the updated cluster is equal to the median, determine the second target value as the minimum value of the number of coordinate points included in the updated cluster.
28. The apparatus according to claim 15, wherein The output unit is further configured to re-cluster the coordinate points in the coordinate point set based on the number of coordinate points included in each updated cluster to obtain the preset number of target clusters, and output cluster information of the preset number of target clusters in the following manner: Reselecting the preset number of coordinate points from the coordinate point set as second initial center points, re-clustering the coordinate points in the coordinate point set with the second initial center points as cluster centers to obtain the preset number of second initial clusters, wherein the number of coordinate points included in each second initial cluster is the same as the number of coordinate points included in the corresponding updated cluster; The preset number of second initial clusters are updated to obtain the preset number of updated second clusters as target clusters.
29. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 14.
30. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.
Citation Information
Patent Citations
Automatic white balance method and device
CN105430367A
Method of determining location of mobile terminal in wireless information network
RU2360378C1