Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for path planning and recommendation, which can effectively solve the problem of dynamic path planning, improve the efficiency of path planning, and improve the effect of path planning.
To achieve the above object, according to a first aspect of the present invention, a path planning method is provided.
The path planning method comprises the following steps: planning the order received in the current time slot according to an ant colony algorithm to determine an optimized order access path; wherein the time slot is obtained by dividing the time for order acquisition or delivery; updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot; and the information matrix comprises pheromones of the order connection pairs.
Optionally, the step of planning the order received in the current time slot according to the ant colony algorithm to determine the optimized order access path includes: step 1, initializing an objective function value and initializing pheromones of order connection pairs; step 2, expanding the order access path of the vehicle according to a decision function, and locally updating the pheromone of the order connection pair until the current optimal solution of the order access path is obtained; step 3, carrying out local search on the current optimal solution of the order access path to obtain the local optimal solution of the order access path, and determining an objective function value of the local optimal solution; updating the current optimal solution under the condition that the objective function value of the local optimal solution is superior to that of the current optimal solution; step 4, after determining the current optimal solution of the order access paths of all vehicles according to the step 2 and the step 3, globally updating the pheromone of the order connection pair; and 5, repeatedly executing the steps 2 to 4 until the iteration stop condition is met, and taking the finally obtained current optimal solution as an optimized order access path.
Optionally, the decision function satisfies:
wherein the decision function
Indicating that vehicle a will be after having accessed order i
Taking the order with the largest value as the order of the next visit;
representing the probability that the vehicle a is next to visit the order k after visiting the order i; mu.s
ikRepresenting an attraction index representing a travel distance or travel time between the access points of order i and order k; tau is
ikAn pheromone representing an order connection pair representing how frequently order k was accessed next after all vehicles accessed order i in the past; f
i aRepresenting the next set of orders allowed to be accessed after the vehicle a has accessed the order i;
represents a pair F
i aMu of all orders in
irτ
irThe values are summed.
To achieve the above object, according to a second aspect of the present invention, there is provided a path recommendation method.
The path recommendation method of the invention comprises the following steps: receiving a path recommendation request sent by a client; planning the order received in the current time slot according to an ant colony algorithm to determine an optimized order access path; wherein the time slot is obtained by dividing the time for order acquisition or delivery; updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot; the information matrix comprises pheromones of order connection pairs; and sending the optimized order access path to the client.
To achieve the above object, according to a third aspect of the present invention, a path planning apparatus is provided.
The path planning device of the invention comprises: the planning module is used for planning the order received in the current time slot according to the ant colony algorithm so as to determine an optimized order access path; wherein the time slot is obtained by dividing the time for order acquisition or delivery; the updating module is used for updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot; and the information matrix comprises pheromones of the order connection pairs.
Optionally, the planning module plans the order received in the current time slot according to the ant colony algorithm to determine the optimized order access path includes: the planning module performs step 1: initializing an objective function value and initializing pheromones of order connection pairs; the planning module performs step 2: expanding an order access path of the vehicle according to a decision function, and locally updating pheromones of order connection pairs until a current optimal solution of the order access path is obtained; the planning module performs step 3: performing local search on the current optimal solution of the order access path to obtain a local optimal solution of the order access path, and determining an objective function value of the local optimal solution; updating the current optimal solution under the condition that the objective function value of the local optimal solution is superior to that of the current optimal solution; the planning module performs step 4: after determining the current optimal solution of the order access paths of all vehicles according to the step 2 and the step 3, globally updating the pheromone of the order connection pair; the planning module performs step 5: and (4) repeatedly executing the step 2 to the step 4 until the iteration stop condition is met, and taking the finally obtained current optimal solution as an optimized order access path.
Optionally, the decision function adopted by the planning module satisfies:
wherein the decision function
Indicating that vehicle a will be after having accessed order i
Taking the order with the largest value as the order of the next visit;
representing the probability that the vehicle a is next to visit the order k after visiting the order i; mu.s
ikRepresenting an attraction index representing a travel distance or travel time between the access points of order i and order k; tau is
ikAn pheromone representing an order connection pair representing how frequently order k was accessed next after all vehicles accessed order i in the past; f
i aRepresenting the next set of orders allowed to be accessed after the vehicle a has accessed the order i;
represents a pair F
i aMu of all orders in
irτ
irThe values are summed.
To achieve the above object, according to a fourth aspect of the present invention, there is provided a route recommending apparatus.
The path recommendation device of the present invention includes: the receiving module is used for receiving a path recommendation request sent by a client; the planning module is used for planning the order received in the current time slot according to the ant colony algorithm so as to determine an optimized order access path; wherein the time slot is obtained by dividing the time for order acquisition or delivery; the updating module is used for updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot; the information matrix comprises pheromones of order connection pairs; and the sending module is used for sending the optimized order access path to the client.
To achieve the above object, according to a fifth aspect of the present invention, there is provided an electronic apparatus.
The electronic device of the present invention includes: one or more processors; and storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the path planning method or the path recommendation method of the present invention.
To achieve the above object, according to a sixth aspect of the present invention, there is provided a computer-readable medium.
The computer-readable medium of the invention has stored thereon a computer program which, when being executed by a processor, implements the path planning method or the path recommendation method of the invention.
One embodiment of the above invention has the following advantages or benefits: the time for order collection or distribution is divided into a plurality of time slots, and the order received in the current time slot is planned according to the ant colony algorithm, so that the dynamic path planning problem can be converted into a series of static path planning problems, the path planning efficiency can be improved, and the path planning effect can be improved; the information matrix is updated according to the optimized order access path, so that the updated information matrix is used for planning the order received in the next time slot, and the information of the good solution obtained in one static path planning can be transmitted to the next static path planning, so that the solution obtained in each planning is continuously optimized, the path planning efficiency is further improved, and the path planning effect is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of main steps of a path planning method according to an embodiment of the present invention. As shown in fig. 1, the path planning method according to the embodiment of the present invention includes:
and S101, planning the order received in the current time slot according to an ant colony algorithm to determine an optimized order access path.
Wherein the time slot is obtained by dividing the time for order acquisition or delivery. Taking an order collection scene as an example, assuming that the total order collection time in one day is S, the time S can be divided into N time slots, and the duration M of each time slot is S/N. Further, static path planning may be performed for orders received within each time slot, thereby converting a dynamic path planning problem into a series of static path planning problems.
The order access path may be an order distribution path, and is used to indicate a distribution sequence of each order (or referred to as goods in each order). In addition, the order access path may also be an order acquisition path, which is used to indicate an acquisition sequence of each order (or referred to as goods in each order). In specific implementation, when a plurality of vehicles which can be used for order distribution or collection are available at present, an order access path can be planned for each vehicle according to the ant colony algorithm.
The ant colony algorithm, which may be called as ant algorithm, is a probabilistic algorithm for finding an optimized path. The algorithm has the characteristics of distribution calculation, information positive feedback and heuristic search, and is essentially a heuristic global optimization algorithm in an evolutionary algorithm. The algorithm is based on the ecological habit of ants, namely the method that ants find the shortest path in the process of finding food is the tracking of pheromones. Ants place some pheromones on the way when looking for food, and when a single ant moves randomly, if the pheromone placed by other ants before is found, the ant will follow the trail of the pheromone with high probability, and will place own pheromone to strengthen the trail.
And S102, updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot.
And the information matrix comprises pheromones of the order connection pairs. An order connection pair is understood to be an order pair consisting of two orders. For example, in a collection scene, the order connection pair is (1,3), which means that the order 1 is collected first and then the order 3 is collected; for another example, the order connection pair is (1,4), which means that the order 1 is collected first and then the order 4 is collected. The pheromone of the order connection pair may be understood as how frequently the order connection pair appears in the order access path of all vehicles in the past. That is, the value of the pheromone of the order connection pair that does not appear in the order access paths of all the vehicles in the past is small, the value of the pheromone of the order connection pair that appears in the order access paths of all the vehicles in the past is large, and the value of the pheromone of the order connection pair is large as the number of occurrences is large.
In an alternative embodiment, the information matrix may be updated according to the following formula:
wherein the content of the first and second substances,
the pheromone, tau, representing the order connection pair (i, k) in the order access path after this optimization
i'
kThe pheromone of the order connection pair (i, k) in the updated information matrix is represented, gamma represents the adjustment parameter of the information matrix, and tau
0Representing a constant value.
In the embodiment of the invention, the time for collecting or delivering the order is divided into a plurality of time slots, and the order received in the current time slot is planned according to the ant colony algorithm, so that the dynamic path planning problem can be converted into a series of static path planning problems, the path planning efficiency can be improved, and the path planning effect can be improved; the information matrix is updated according to the optimized order access path, the updated information matrix is used as an initial value in the planning of the order received in the next time slot, and the information of the good solution obtained in the static path planning of one time can be transmitted to the static path planning of the next time, so that the solution obtained in each planning is continuously optimized, the path planning efficiency is further improved, and the path planning effect is improved.
FIG. 2 is a diagram illustrating the main steps for planning an order received during a current time slot, according to one embodiment of the present invention. In an embodiment of the present invention, each of the currently available vehicles is individually and continuously optimized for its order access path according to an ant colony algorithm. As shown in fig. 2, the process of planning the order received in the current time slot according to the embodiment of the present invention mainly includes:
step S201, initializing an objective function value and initializing pheromones of order connection pairs.
In this step, the initial value of the objective function may be set to a large value, for example, 10000.
An order connection pair is understood to be an order pair consisting of two orders. For example, in a collection scene, the order connection pair is (1,3), which means that the order 1 is collected first and then the order 3 is collected; for another example, the order connection pair is (1,4), which means that the order 1 is collected first and then the order 4 is collected. The pheromone of the order connection pair may be understood as how frequently the order connection pair appears in the order access path of all vehicles in the past. That is, the value of the pheromone of the order connection pair that does not appear in the order access paths of all the vehicles in the past is small, the value of the pheromone of the order connection pair that appears in the order access paths of all the vehicles in the past is large, and the value of the pheromone of the order connection pair is large as the number of occurrences is large. In this step, assuming that the current time slot is the first time slot, the pheromone of the order connection pair may be set as a constant; assuming that the current time slot is the second or later time slot, the information matrix determined by the previous path planning can be used as the initial value of the pheromone in the planning.
Step S202, expanding the order access path of the vehicle according to a decision function, and locally updating the pheromone of the order connection pair until the current optimal solution of the order access path is obtained.
In an alternative embodiment, the decision function satisfies:
wherein the decision function
Indicating that vehicle a will be after having accessed order i
Taking the order with the largest value as the order of the next visit;
representing the probability that the vehicle a is next to visit the order k after visiting the order i; mu.s
ikRepresenting an attraction index representing a travel distance or travel time between the access points of order i and order k; tau is
ikAn pheromone representing an order connection pair representing how frequently order k was accessed next after all vehicles accessed order i in the past; f
i aRepresenting the next set of orders allowed to be accessed after the vehicle a has accessed the order i;
represents a pair F
i aMu of all orders in
irτ
irThe values are summedCalculating; mu.s
ikτ
ikRepresenting the value that vehicle a brings with order k as the next order to be visited after order i.
In the embodiment of the present invention, the above
The formula of (2) can well balance attraction index with past experience. Further, through the above
The definition formula of (2) and the decision function can better perform path expansion.
Further, the pheromone of the order connection pair may be locally updated according to the following formula:
τik_local=τ0ρ+tik(1-ρ);
wherein, tauik_localPheromone, τ, representing locally updated order connection pair (i, k)ikExpressing the pheromone of the order connection pair (i, k) before local updating, wherein rho is an adjusting parameter, the value range is that rho is more than or equal to 0 and less than or equal to 1, and tau0Is a constant value.
Step S203, performing local search on the current optimal solution of the order access path to obtain a local optimal solution of the order access path, and determining an objective function value of the local optimal solution.
The local search can be understood as changing the order sequence of the local order in the current optimal solution. In an embodiment of the invention, an objective function may be defined as the path or time required to access all orders, the smaller the value of the objective function is, the better the objective function is.
And step S204, under the condition that the objective function value of the local optimal solution is superior to that of the current optimal solution, updating the current optimal solution.
In this step, when the objective function can be defined as a path or time required for accessing all orders, the objective function value of the local optimal solution that is better than the objective function value of the current optimal solution is specifically: the objective function value of the local optimal solution is smaller than the objective function value of the current optimal solution. In this case, the locally optimal solution may be taken as the updated current optimal solution.
And step S205, judging whether the current optimal solution of the order access paths of all vehicles is obtained. If yes, go to step S206; otherwise, step S202 is executed again.
And step S206, globally updating the pheromone of the order connection pair.
In an alternative embodiment, the pheromone of an order connection pair may be updated globally according to the following formula:
wherein, tauik_globalPheromone, τ, representing globally updated order connection pair (i, k)ik_localAnd (3) expressing the pheromone of the locally updated order connection pair (i, k), wherein rho is an adjusting parameter, the value range is that rho is more than or equal to 0 and less than or equal to 1, and BestCost is the objective function value of the current optimal solution.
And step S207, judging whether an iteration stop condition is met. In the case where the iteration stop condition is satisfied, step S208 is executed; otherwise, step S202 is executed again.
Wherein the iteration stop condition may be: the calculated time reaches the set time max (t).
And step S208, taking the finally obtained current optimal solution as an optimized order access path.
In specific implementation, a certain constraint condition is required to be set in the above static path planning process. For example, in a cable-acquisition scene, the following constraints can be set: 1. each order is accessed only once; 2. the starting point and the end point of the route of each vehicle are warehouses; 3. the number of packages loaded per vehicle must not exceed the capacity of the respective vehicle.
In the embodiment of the invention, the access path of the order in the current time slot can be planned through the steps, so that the optimized order access route can be determined quickly and accurately. In the above process, the path is expanded through the decision function, and the path is optimized through local search, so that the algorithm performance can be further improved, and the path planning effect is improved.
Fig. 3 is a schematic diagram of the main steps of a path recommendation method according to an embodiment of the present invention. As shown in fig. 3, the path recommendation method according to the embodiment of the present invention includes:
and step S301, receiving a path recommendation request sent by the client.
The order access route recommendation request can be an order distribution route recommendation request or an order acquisition route recommendation request. In specific implementation, an order distributor or an order collector can send an order access route recommendation request to a server through a client on a terminal device such as a mobile phone.
Step S302, planning the order received in the current time slot according to the ant colony algorithm to determine an optimized order access path.
Wherein the time slot is obtained by dividing the time for order acquisition or delivery. Taking an order collection scene as an example, assuming that the total order collection time in one day is S, the time S can be divided into N time slots, and the duration M of each time slot is S/N. Further, static path planning may be performed for orders received within each time slot, thereby converting a dynamic path planning problem into a series of static path planning problems.
The order access path may be an order distribution path, and is used to indicate a distribution sequence of each order (or referred to as goods in each order). In addition, the order access path may also be an order acquisition path, which is used to indicate an acquisition sequence of each order (or referred to as goods in each order). In specific implementation, when a plurality of vehicles which can be used for order distribution or collection are available at present, an order access path can be planned for each vehicle according to the ant colony algorithm.
The ant colony algorithm, which may be called as ant algorithm, is a probabilistic algorithm for finding an optimized path. The algorithm has the characteristics of distribution calculation, information positive feedback and heuristic search, and is essentially a heuristic global optimization algorithm in an evolutionary algorithm. The algorithm is based on the ecological habit of ants, namely the method that ants find the shortest path in the process of finding food is the tracking of pheromones. Ants place some pheromones on the way when looking for food, and when a single ant moves randomly, if the pheromone placed by other ants before is found, the ant will follow the trail of the pheromone with high probability, and will place own pheromone to strengthen the trail.
And step S303, updating the updated information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot.
And the information matrix comprises pheromones of the order connection pairs. An order connection pair is understood to be an order pair consisting of two orders. For example, in a collection scene, the order connection pair is (1,3), which means that the order 1 is collected first and then the order 3 is collected; for another example, the order connection pair is (1,4), which means that the order 1 is collected first and then the order 4 is collected. The pheromone of the order connection pair may be understood as how frequently the order connection pair appears in the order access path of all vehicles in the past. That is, the value of the pheromone of the order connection pair that does not appear in the order access paths of all the vehicles in the past is small, the value of the pheromone of the order connection pair that appears in the order access paths of all the vehicles in the past is large, and the value of the pheromone of the order connection pair is large as the number of occurrences is large.
In an alternative embodiment, the information matrix may be updated according to the following formula:
wherein the content of the first and second substances,
the pheromone, tau, representing the order connection pair (i, k) in the order access path after this optimization
i'
kThe pheromone of the order connection pair (i, k) in the updated information matrix is represented, gamma represents the adjustment parameter of the information matrix, and tau
0Representing a constant value.
And step S304, sending the optimized order access path to the client.
In the embodiment of the invention, the path recommendation requirements under the delivery or collection scene can be met through the steps. Specifically, the time for order collection or delivery is divided into a plurality of time slots, and the order received in the current time slot is planned according to the ant colony algorithm, so that the dynamic path planning problem can be converted into a series of static path planning problems, the path planning and recommendation efficiency can be improved, and the path planning and recommendation effect can be improved; the information matrix is updated according to the optimized order access path, the updated information matrix is used as an initial value in the planning of the order received in the next time slot, and the information of the good solution obtained in the static path planning of one time can be transmitted to the static path planning of the next time, so that the solution obtained in each planning is continuously optimized, the path planning and recommending efficiency is further improved, and the path planning and recommending effect is improved.
Fig. 4 is a schematic diagram of main modules of a path planning apparatus according to an embodiment of the present invention. As shown in fig. 4, a path planning apparatus 400 according to an embodiment of the present invention includes: a planning module 401 and an updating module 402.
The planning module 401 is configured to plan the order received in the current time slot according to the ant colony algorithm, so as to determine an optimized order access path.
Wherein the time slot is obtained by dividing the time for order acquisition or delivery. Taking an order collection scene as an example, assuming that the total order collection time in one day is S, the time S can be divided into N time slots, and the duration M of each time slot is S/N. Further, static path planning may be performed for orders received within each time slot, thereby converting a dynamic path planning problem into a series of static path planning problems.
The order access path may be an order distribution path, and is used to indicate a distribution sequence of each order (or referred to as goods in each order). In addition, the order access path may also be an order acquisition path, which is used to indicate an acquisition sequence of each order (or referred to as goods in each order). In specific implementation, when a plurality of vehicles which can be used for order distribution or collection are available at present, an order access path can be planned for each vehicle according to the ant colony algorithm.
The ant colony algorithm, which may be called as ant algorithm, is a probabilistic algorithm for finding an optimized path. The algorithm has the characteristics of distribution calculation, information positive feedback and heuristic search, and is essentially a heuristic global optimization algorithm in an evolutionary algorithm. The algorithm is based on the ecological habit of ants, namely the method that ants find the shortest path in the process of finding food is the tracking of pheromones. Ants place some pheromones on the way when looking for food, and when a single ant moves randomly, if the pheromone placed by other ants before is found, the ant will follow the trail of the pheromone with high probability, and will place own pheromone to strengthen the trail.
In an optional embodiment, the planning module 401 plans the order received in the current time slot according to the ant colony algorithm, so as to determine the optimized order access path includes:
the planning module 401 performs step 1: initializing the objective function value and initializing the pheromone of the order connection pair.
The planning module 401 performs step 2: and expanding the order access path of the vehicle according to a decision function, and locally updating the pheromone of the order connection pair until the current optimal solution of the order access path is obtained.
The decision function adopted by the planning module 401 can satisfy the following conditions:
wherein the decision function
Indicating that vehicle a is accessing order iThen, will
Taking the order with the largest value as the order of the next visit;
representing the probability that the vehicle a is next to visit the order k after visiting the order i; mu.s
ikRepresenting an attraction index representing a travel distance or travel time between the access points of order i and order k; tau is
ikAn pheromone representing an order connection pair representing how frequently order k was accessed next after all vehicles accessed order i in the past; f
i aRepresenting the next set of orders allowed to be accessed after the vehicle a has accessed the order i;
represents a pair F
i aMu of all orders in
irτ
irThe values are summed.
The planning module 401 performs step 3: performing local search on the current optimal solution of the order access path to obtain a local optimal solution of the order access path, and determining an objective function value of the local optimal solution; and under the condition that the objective function value of the local optimal solution is superior to that of the current optimal solution, updating the current optimal solution.
The planning module 401 performs step 4: after determining the current optimal solution of the order access paths of all vehicles according to step 2 and step 3, the pheromone of the order connection pair is globally updated.
The planning module 401 performs step 5: and (4) repeatedly executing the step 2 to the step 4 until the iteration stop condition is met, and taking the finally obtained current optimal solution as an optimized order access path.
Wherein the iteration stop condition may be: the calculated time reaches the set time max (t).
An updating module 402, configured to update the information matrix according to the optimized order access path, so that the updated information matrix is used for planning the order received in the next time slot.
And the information matrix comprises pheromones of the order connection pairs. An order connection pair is understood to be an order pair consisting of two orders. For example, in a collection scene, the order connection pair is (1,3), which means that the order 1 is collected first and then the order 3 is collected; for another example, the order connection pair is (1,4), which means that the order 1 is collected first and then the order 4 is collected. The pheromone of the order connection pair may be understood as how frequently the order connection pair appears in the order access path of all vehicles in the past. That is, the value of the pheromone of the order connection pair that does not appear in the order access paths of all the vehicles in the past is small, the value of the pheromone of the order connection pair that appears in the order access paths of all the vehicles in the past is large, and the value of the pheromone of the order connection pair is large as the number of occurrences is large.
In an alternative embodiment, the update module 402 may update the information matrix according to the following formula:
wherein the content of the first and second substances,
the pheromone, tau, representing the order connection pair (i, k) in the order access path after this optimization
i'
kThe pheromone of the order connection pair (i, k) in the updated information matrix is represented, gamma represents the adjustment parameter of the information matrix, and tau
0Representing an initial constant value of the pheromone.
In this step, the updated information matrix can be used as an initial value of the pheromone for planning an order received in the next time slot, so that a good path planning solution can be transmitted, thereby facilitating the improvement of algorithm performance and improving the path planning effect.
In the device provided by the embodiment of the invention, the time for collecting or delivering the order is divided into a plurality of time slots, and the order received in the current time slot is planned according to the ant colony algorithm, so that the dynamic path planning problem can be converted into a series of static path planning problems, the path planning efficiency can be improved, and the path planning effect can be improved; the information matrix is updated according to the optimized order access path, the updated information matrix is used as an initial value in the planning of the order received in the next time slot, and the information of the good solution obtained in the static path planning of one time can be transmitted to the static path planning of the next time, so that the solution obtained in each planning is continuously optimized, the path planning efficiency is further improved, and the path planning effect is improved.
Fig. 5 is a schematic diagram of main blocks of a path recommending apparatus according to an embodiment of the present invention. As shown in fig. 5, a route recommendation apparatus 500 according to an embodiment of the present invention includes: a receiving module 501, a planning module 502, an updating module 503, and a sending module 504.
The receiving module 501 is configured to receive a path recommendation request sent by a client.
The order access route recommendation request can be an order distribution route recommendation request or an order acquisition route recommendation request. In specific implementation, an order distributor or an order collector can send an order access route recommendation request to a server through a client on a terminal device such as a mobile phone.
The planning module 502 is configured to plan the order received in the current time slot according to the ant colony algorithm to determine an optimized order access path.
Wherein the time slot is obtained by dividing the time for order acquisition or delivery. Taking an order collection scene as an example, assuming that the total order collection time in one day is S, the time S can be divided into N time slots, and the duration M of each time slot is S/N. Further, static path planning may be performed for orders received within each time slot, thereby converting a dynamic path planning problem into a series of static path planning problems.
The order access path may be an order distribution path, and is used to indicate a distribution sequence of each order (or referred to as goods in each order). In addition, the order access path may also be an order acquisition path, which is used to indicate an acquisition sequence of each order (or referred to as goods in each order). In specific implementation, when a plurality of vehicles which can be used for order distribution or collection are available at present, an order access path can be planned for each vehicle according to the ant colony algorithm.
An updating module 503, configured to update the updated information matrix according to the optimized order access path, so that the updated information matrix is used for planning the order received in the next time slot.
And the information matrix comprises pheromones of the order connection pairs. An order connection pair is understood to be an order pair consisting of two orders. For example, in a collection scene, the order connection pair is (1,3), which means that the order 1 is collected first and then the order 3 is collected; for another example, the order connection pair is (1,4), which means that the order 1 is collected first and then the order 4 is collected. The pheromone of the order connection pair may be understood as how frequently the order connection pair appears in the order access path of all vehicles in the past. That is, the value of the pheromone of the order connection pair that does not appear in the order access paths of all the vehicles in the past is small, the value of the pheromone of the order connection pair that appears in the order access paths of all the vehicles in the past is large, and the value of the pheromone of the order connection pair is large as the number of occurrences is large.
In an alternative embodiment, the update module 503 may update the information matrix according to the following formula:
wherein the content of the first and second substances,
the pheromone, tau, representing the order connection pair (i, k) in the order access path after this optimization
i'
kThe pheromone of the order connection pair (i, k) in the updated information matrix is represented, gamma represents the adjustment parameter of the information matrix, and tau
0Representing a constant value.
A sending module 504, configured to send the optimized order access path to the client.
In the embodiment of the invention, the path recommendation requirement under the delivery or collection scene can be met through the device. Specifically, the time for order collection or delivery is divided into a plurality of time slots, and the order received in the current time slot is planned through the planning module according to the ant colony algorithm, so that the dynamic path planning problem can be converted into a series of static path planning problems, the path planning and recommendation efficiency can be improved, and the path planning and recommendation effect can be improved; the information matrix is updated through the updating module according to the optimized order access path, the updated information matrix is used as an initial value in the planning of the order received in the next time slot, and the information of the good solution obtained in the static path planning of one time can be transmitted to the static path planning of the next time, so that the solution obtained in each planning is continuously optimized, the path planning and recommending efficiency is further improved, and the path planning and recommending effect is improved.
Fig. 6 is one of exemplary system architecture diagrams in which embodiments of the present invention may be employed. As shown in fig. 6, an exemplary system architecture includes: business layer 601, service layer 602, data layer 603.
The service layer 601 is configured to obtain an order access path recommendation request sent by various terminal devices (such as a PDA, a PC, and the like), invoke a path recommendation service in the service layer 602 to obtain an order access path (such as an order acquisition path), and return the obtained order access path to the terminal device.
The service layer 602 mainly includes a path recommendation service. The service layer 602 may perform the path planning method once in each time slot and return the resulting order access path to the business layer 601.
And a data layer 603 for providing data support for the system architecture. For example, in a package scene, the following data may be provided: order data, such as the time of the order and the acquisition address of the order (e.g., GIS of the order, i.e., latitude and longitude coordinates); vehicle data such as a GIS (i.e., longitude and latitude coordinates) of the vehicle and a remaining capacity of the vehicle, etc.; and information matrices, etc.
Fig. 7 shows an exemplary system architecture 700 to which the path planning method or the path recommendation method or the path planning apparatus or the path recommendation apparatus according to the embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various client applications may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server providing support for client applications browsed by users using the terminal devices 701, 702, 703. The background management server may analyze and perform other processing on the received order access route recommendation request, and feed back a processing result (e.g., a recommended order access route) to the terminal device.
It should be noted that the path planning method or the path recommendation method provided in the embodiment of the present invention is generally executed by the server 705, and accordingly, the path planning apparatus or the path recommendation apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use in implementing an electronic device of an embodiment of the present invention. The computer system illustrated in FIG. 8 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a planning module and an update module. The names of these modules do not in some cases form a limitation on the module itself, and for example, an update module may also be described as a "module that updates an information matrix".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform the following: planning the order received in the current time slot according to an ant colony algorithm to determine an optimized order access path; wherein the time slot is obtained by dividing the time for order acquisition or delivery; updating the information matrix according to the optimized order access path so as to use the updated information matrix in the planning of the order received in the next time slot; and the information matrix comprises pheromones of the order connection pairs.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.