Disclosure of Invention
The application aims to provide a logistics transportation scheduling method, a logistics transportation scheduling device and a readable storage medium with a time window, and aims to solve the problem that the traditional logistics transportation scheduling scheme is difficult to achieve the purpose of meeting the specific delivery time requirements of various customer points while reducing the vehicle mileage.
In a first aspect, the present application provides a logistics transportation scheduling method with a time window, including:
the method comprises the steps of obtaining a logistics transportation scheduling model with a time window, wherein the logistics transportation scheduling model with the time window is a model for describing that a plurality of vehicles finish delivery tasks of a plurality of customer points within a preset time range;
aiming at the logistics transportation scheduling model with the time window, executing search operation according to a harmony search algorithm, and determining the optimal harmony sound in the current iteration process according to a target fitness function, wherein the target fitness function is used for measuring the stroke length and the overtime degree of a delivery path corresponding to the harmony sound;
when the current iteration times do not reach the maximum iteration times, generating new harmony according to an electromagnetic mechanism-like algorithm, and entering the next iteration process;
when the current iteration times reach the maximum iteration times, determining the optimal harmony of the target;
and determining the optimal vehicle path corresponding to the optimal target and the sound to be used as a logistics transportation scheduling result of a logistics transportation scheduling model with a time window.
Optionally, the generating a new harmony sound according to an electromagnetic mechanism-like algorithm includes:
determining the charge amount of the charged particles represented by harmonics in the current iteration;
determining, from the amount of charge, a coulomb force experienced by the charged particle;
performing corresponding displacement transformation on the harmony sound according to the coulomb force;
and determining the optimal harmony in the harmony before the displacement transformation and the harmony after the displacement transformation as a new harmony according to the target fitness function.
Optionally, after the generating a new harmony sound according to the electromagnetic-like mechanism algorithm, the method further includes:
and when the harmony memory bank disturbance condition is met, carrying out disturbance updating on the harmony memory bank according to the harmony memory bank disturbance strategy.
Optionally, the harmony memory bank disturbance condition is:
and the current iteration times are smaller than a preset threshold value and are not updated with the continuous preset times of the acoustic memory library.
Optionally, the logistics transportation scheduling model with the time window includes an early arrival penalty coefficient and a late arrival penalty coefficient.
In a second aspect, the present application provides a logistics transportation scheduling device with a time window, comprising:
a model acquisition module: the system comprises a logistics transportation scheduling model with a time window, a plurality of vehicles and a plurality of client points, wherein the logistics transportation scheduling model with the time window is a model for describing that the plurality of vehicles finish delivery tasks of the plurality of client points within a preset time range;
and the harmony search module: the system comprises a time window-carrying logistics transportation scheduling model, a target fitness function and a time-out function, wherein the time window-carrying logistics transportation scheduling model is used for executing search operation according to a harmony search algorithm and determining the optimal harmony sound in the current iteration process according to the target fitness function, and the target fitness function is used for measuring the stroke length and the overtime degree of a delivery path corresponding to the harmony sound;
and a harmony update module: when the current iteration times do not reach the maximum iteration times, generating new harmony according to an electromagnetic mechanism-like algorithm, and entering the next iteration process;
a target optimal harmony determination module: the optimal harmony module is used for determining the optimal harmony of the target when the current iteration times reach the maximum iteration times;
the logistics transportation scheduling result determining module: and the optimal vehicle path corresponding to the target optimal sound is determined to be used as a logistics transportation scheduling result of the logistics transportation scheduling model with the time window.
Optionally, the harmony update module includes:
a charge amount determining unit: for determining the charge amount of the charged particles represented by harmonics in the current iteration;
coulomb force determination unit: for determining, from the amount of charge, a coulomb force experienced by the charged particles;
a displacement conversion unit: the acoustic generator is used for carrying out corresponding displacement transformation on the harmony sound according to the coulomb force;
harmony update unit: and determining the optimal harmony among the harmony before the displacement transformation and the harmony after the displacement transformation as a new harmony according to the target fitness function.
Optionally, the method further includes:
a disturbance update module: and the method is used for carrying out disturbance updating on the harmony memory bank according to the harmony memory bank disturbance strategy when the harmony memory bank disturbance condition is met.
In a third aspect, the present application provides a logistics transportation scheduling device with a time window, including:
a memory: for storing a computer program;
a processor: for executing the computer program to implement the steps of the logistics transportation scheduling method with time window as described above.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, where the computer program is used to implement the steps of the logistics transportation scheduling method with time window as described above when being executed by a processor.
According to the logistics transportation scheduling method, device and equipment with the time window and the readable storage medium, a searching scheme of a logistics transportation scheduling model with the time window is provided, aiming at the logistics transportation scheduling model with the time window, the scheme searches an optimal path by using a harmony searching algorithm optimized based on an electromagnetic-like mechanism algorithm, measures the stroke length and the overtime degree of a distribution path corresponding to harmony according to a target fitness function of the model, and finally determines the optimal harmony of the target to serve as a logistics transportation scheduling result of the logistics transportation scheduling model with the time window. Therefore, the scheme remarkably improves the searching efficiency in the logistics transportation scheduling process, and meets the requirement of customers on delivery time while ensuring short path length.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, the specific requirements of each customer point on the delivery time are often considered in the logistics transportation scheduling process, the difficulty of logistics transportation scheduling is further increased, and the traditional logistics transportation scheduling scheme is difficult to meet the specific requirements of each customer point on the delivery time while ensuring that the delivery path is short. In order to solve the problem, the application provides a logistics transportation scheduling method, a logistics transportation scheduling device with a time window and a readable storage medium, so that the requirement of a customer on delivery time is met while the path length is short, and the searching efficiency is high in the logistics transportation scheduling process.
Referring to fig. 1, a first embodiment of a logistics transportation scheduling method with a time window provided by the present application is described below, where the first embodiment includes:
s101, acquiring a logistics transportation scheduling model with a time window;
in the logistics transportation scheduling, the logistics transportation scheduling model with the time window mainly refers to a model describing that a plurality of vehicles complete delivery tasks of a plurality of customer points within a preset time range. More specifically, the logistics transportation scheduling model with time window can be described as: a yard has a plurality of vehicles, which are delivered to a plurality of customer sites within a predetermined time period (i.e., a time window), and a certain penalty is given if the vehicles arrive early or late. Each vehicle departs from the yard and returns to the original yard after passing through all customer points for which the vehicle is responsible. The purpose of the model is to minimize the total travel and the time penalty. It is understood that the vehicle load is greater than or equal to the total cargo demand of all the customer sites for which the vehicle is responsible, and in this embodiment, all the customer sites can be passed by one vehicle only and can be passed by one time only.
Step S102, aiming at the logistics transportation scheduling model with the time window, executing search operation according to a harmony search algorithm, and determining the optimal harmony in the current iteration process according to a target fitness function;
as described above, the objective of the logistics transportation scheduling model with time window in the present embodiment is to minimize the total travel and the time penalty, and therefore, it can be understood that the above-mentioned target fitness function is used to measure the travel length and the timeout degree of the delivery path corresponding to the sound.
Step S103, when the current iteration times do not reach the maximum iteration times, generating new harmony according to an electromagnetic mechanism-like algorithm, and entering the next iteration process;
step S104, when the current iteration times reach the maximum iteration times, determining the optimal harmony of the target;
and S105, determining the optimal vehicle path corresponding to the optimal target and the optimal sound to serve as a logistics transportation scheduling result of the logistics transportation scheduling model with the time window.
The embodiment provides a logistics transportation scheduling method with a time window, and provides a search scheme of a logistics transportation scheduling model with the time window. Therefore, the scheme remarkably improves the searching efficiency in the logistics transportation scheduling process, and meets the requirement of customers on delivery time while ensuring short path length.
The second embodiment of the logistics transportation scheduling method with a time window provided by the present application is described in detail below, and the second embodiment is implemented based on the first embodiment and is expanded to a certain extent on the basis of the first embodiment.
Referring to fig. 2, the second embodiment specifically includes:
s201, acquiring a logistics transportation scheduling model with a time window;
the logistics transportation scheduling model with the time window is specifically as follows:
where, K (unit:vehicles) represents the total number of transport vehicles, N (unit: one) represents the number of customer spots, dij(i, j ═ 0, 1.., N, unit: km) represents the straight-line distance traveled by the transport vehicle from customer point i to customer point j, EiIndicating the earliest cargo arrival time, L, requested by customer site iiIndicating the latest arrival time of the goods, C, requested by customer Point i1(unit: yuan/min) represents an early penalty factor, C2(unit: yuan/min) represents a late penalty factor, tikRepresenting the actual time, r, at which vehicle k arrives at customer site iijk(i, j ═ 0, 1., N, K ═ 1, 2.., K) is a variable other than 0, i.e., 1, and r is a variable other than 0ijkWhen 1, the vehicle k travels to the customer point j via the customer point i.
S202, initializing control parameters;
specifically, initializing a total number of transport vehicles K, wherein the maximum load of the kth transport vehicle is Wk(unit: ton), number of customer sites N, where the i (i, j ═ 1, 2.., N) th customer site demand load is wi(unit: ton), harmony search algorithm harmony memory bank size HMS, memory bank dereferencing probability HMCR, fine tuning probability PAR, tone fine tuning bandwidth bw and creation times Tmax, and current iteration times gn (initially 0) of the algorithm.
S203, initializing and memorizing the voice;
the harmony memory base includes a plurality of harmony sounds, each of which corresponds to a delivery route of the vehicle, and may be obtained according to a decoding strategy for the harmony sounds according to the present embodiment, which will be described below. The harmony memory bank is initialized randomly in many ways, which can be specifically selected according to actual situations, and this embodiment is not limited specifically. As a specific implementation, the chaos initialization method may be used to initialize the harmony memory bank, and a specific initialization process will be described below and will not be described herein. In this embodiment, the harmony memory library is as follows:
s204, calculating a corresponding function fitness value according to each harmony in the harmony memory library;
specifically, for each harmony sound in the harmony sound memory base, the customer points and the sequence of the corresponding vehicles needing to be serviced are determined according to the harmony sound, and r is determined according to the customer points and the sequenceijk(i, j ═ 0, 1., N, K ═ 1, 2., K); finally, the fitness value of the harmony is calculated according to a fitness function, which is as follows:
s205, determining global optimal harmony and a fitness value thereof according to the fitness value, and determining worst harmony and the fitness value thereof;
s206, generating a new harmony, and adding one to the current iteration number;
as a specific implementation, the process of generating a new harmony includes: generating a first random number; if the first random number is smaller than the memory bank value probability HMRC, randomly selecting a group of harmony from the harmony memory bank, and generating new harmony according to the group of harmony; if the first random number is larger than or equal to the memory bank value probability HMRC, taking the harmony in the harmony memory bank as a point-carrying particle, and generating new harmony according to an electromagnetic mechanism-like algorithm; generating a second random number; if the second random number is smaller than the fine tuning probability PAR, fine tuning the new harmony according to the fine tuning function; if the second random number is less than the fine tuning probability PAR, no processing is performed. Finally outputting a new harmony sound.
S207, calculating a new harmony fitness value, and replacing the worst harmony sound with a new harmony sound when the new harmony fitness value is larger than the worst harmony fitness value;
s208, updating the harmony memory bank according to the harmony memory bank disturbance strategy;
specifically, in this embodiment, a disturbance condition of the harmony memory library is preset, before step S208 is executed, it is first determined whether the current scene meets the preset disturbance condition of the harmony memory library, and if the determination result is that the current scene meets the preset disturbance condition of the harmony memory library, step S208 is continuously executed.
S209, judging whether the current iteration number reaches the maximum iteration number, if so, entering a step S210, otherwise, entering a step S205;
and S210, outputting the optimal harmony sound of the target and the fitness value thereof, and determining a corresponding vehicle path to be used as a logistics transportation scheduling result.
As described above, each of the harmony sounds in the present embodiment corresponds to the travel path of a certain vehicle, that is, the customer point through which the vehicle passes and the passing order. Specifically, in this embodiment, a decoding strategy combining the bisection and the acoustic value range with the maximum position method is adopted to analyze the harmony, and the decoding strategy is defined as follows:
let p-th harmony be Xp=[xp1,xp2,...,xpq,...,xpN]The present embodiment is directed to harmony XpInner grouping to generate K sets, i.e. Cj. Then according to the maximum position method, the elements in each set are xpqThe sizes of the elements are arranged in a descending order, and the second dimension value of each element in each set after the arrangement is finished is the customer point and the order of the corresponding vehicles needing service. CjAs follows:
Cj={(xpq,q)|j-1≤xpq<j} (4)
wherein, p is 0,1,., HMS, q is 0,1,., N, j is 1, 2.
To further illustrate the above decoding strategy, the following is exemplified: assume that 4 transport vehicles are owned, serving 8 customer sites. The resulting set of chords in a certain iteration of the algorithm is X ═ 3.6,2.4,0.7,1.8,2.6,3.2,1.4,3.3]. Internally grouping harmony interior X may result in: c1={(0.7,3)},C2={(1.8,4),(1.4,7)},C3={(2.4,2),(2.6,5)},C4={(3.6,1),(3.2,6),(3.3,8)}。
Sorting each set to obtain: c1={(0.7,3)},C2={(1.8,4),(1.4,7)},C3={(2.6,5),(2.4,2)},C4{ (3.6,1), (3.3,8), (3.2,6) }. Finally, a logistics transportation scheduling scheme corresponding to harmony X can be obtained, namely the path of the vehicle 1 is 0-3-0; vehicle with a steering wheelPath 2 is 0-4-7-0; the path of the vehicle 3 is 0-5-2-0; the vehicle 4 path is 0-1-8-6-0, where 0 represents the yard.
In step S206 of this embodiment, the process of generating a new harmony specifically includes:
in the first step, a random number rand (0,1) between (0,1) is generated, if rand (0,1)<HMCR, then randomly selecting a group of harmony from the harmony memory library, and recording as XnewTurning to the third step as shown in formula (5); otherwise, go to the second step.
Xnew=rand[X1,X2,...,XHMS] (5)
Secondly, taking the harmony sound in the harmony memory library as charged particles, and generating new harmony sound according to an electromagnetic mechanism-like algorithm;
third, generate random number rand (0,1) between (0,1), if rand (0,1)<PAR, according to the formula (6) for XnewFine adjustment is carried out; otherwise XnewAnd is not changed.
Xnew=Xnew±rand()×bw (6)
The second step specifically includes: calculating the charge amount q of the charged particles represented by each harmoniciThe formula is shown in formula (7), wherein XbestFor the optimal charged particles: calculating the Coulomb force F borne by each charged particleiThe calculation formula is shown as formula (8); according to the Coulomb force F to which each charged particle is subjectediIn the size and direction of the particles towards FiIs moved in the direction of (a), the position after the movement is as shown in formula (9), wherein lambda is [0,1 ]]Random values that are upper obeyed to a rectangular distribution; calculating the fitness value of each particle after moving the position, and recording the particle with the largest fitness value as Xnew. The above equations (7), (8) and (9) are as follows:
in the step S208, updating the harmony repository according to the harmony repository perturbation policy, further includes:
step one, judging whether the harmony memory bank disturbance conditions shown in the specification are met at the same time, if yes, jumping to the step two, and if not, jumping to the step S209;
in this embodiment, the disturbance condition of the harmonic memory bank is: the current iteration number satisfies the formula (10) and the harmony memory bank is not updated for t times continuously, and t refers to the formula (11):
secondly, sorting the harmony sounds in the harmony sound memory base according to the fitness value, and randomly selecting and dividing XbestAn outer (HMS/2) group harmony;
thirdly, performing chaotic disturbance on the non-optimal harmony of the selected (HMS/2) group;
fourthly, calculating the fitness value of the generated new harmony, and if the fitness value is superior to the worst harmony in the harmony memory library, replacing the worst harmony with the new harmony, and updating the harmony memory library; otherwise, the third step is executed again.
In step S203, there are many methods for random initialization and acoustic memory library, and as an optional implementation manner, the present embodiment adopts a chaotic initialization method, which includes the following processes:
firstly, randomly generating an initial chaotic vector;
the initial chaotic vector Y0=[y01,y02,...,y0j,...,y0N]Wherein y is0j∈(0,1),j=1,2,...,N。
Secondly, generating HMS chaotic vectors according to the initial chaotic vectors and the target function;
the ith vector in the HMS chaotic vectors is as follows: y isi=[yi1,yi2,...,yij,...,yiN]The objective function is:
y(i+1)j=μyij(1-yij) (12)
HMS, where, in addition, to achieve a completely chaotic state, μ in this example is 4.
Thirdly, mapping the generated HMS chaotic vectors to a value range of a logistics transportation scheduling problem to obtain HMS vectors which accord with the decoding strategy of the embodiment;
the ith vector X in the HMS vectors conforming to the decoding strategy of the embodimenti=[xi1,xi2,...,xij,...,xiN]Wherein i ═ 1, 2., HMS, Xi=Yi*K。
And fourthly, putting the HMS vectors into a harmony memory library HM to obtain an initial value of the harmony memory library.
Therefore, the logistics transportation scheduling method with the time window provided by the embodiment provides a searching scheme for the logistics transportation scheduling model with the time window, so that the searching efficiency in the logistics transportation scheduling process is remarkably improved, and the requirement of a customer on delivery time is met while the path length is ensured to be short.
In order to prove that the logistics transportation scheduling method with the time window in the embodiment is more superior, a conventional harmony search algorithm and the logistics transportation scheduling method with the time window in the embodiment are adopted to carry out multiple simulation experiments aiming at the logistics transportation scheduling problem with the time window, which is provided with 4 transportation vehicles and 14 customer sites. Fig. 3 shows a shortest path graph obtained by the logistics transportation scheduling method with time windows according to this embodiment, and a simulation result pair table 1 shows a simulation result pair.
TABLE 1
Referring to table 1, it is obvious that, compared with the conventional harmony search algorithm, the scheme of the embodiment consumes the shortest time in the process of searching the optimal logistics transportation scheduling scheme, and can meet the special requirement of the customer on the delivery time to a greater extent while ensuring that the average mileage is short, thereby having extremely high superiority.
In the following, a logistics transportation scheduling device with a time window provided by an embodiment of the present application is introduced, and a logistics transportation scheduling device with a time window described below and a logistics transportation scheduling method with a time window described above may be referred to correspondingly.
Referring to fig. 4, the apparatus includes:
the model acquisition module 401: the system comprises a logistics transportation scheduling model with a time window, a plurality of vehicles and a plurality of client points, wherein the logistics transportation scheduling model with the time window is a model for describing that the plurality of vehicles finish delivery tasks of the plurality of client points within a preset time range;
and the acoustic search module 402: the system comprises a time window-carrying logistics transportation scheduling model, a target fitness function and a time-out function, wherein the time window-carrying logistics transportation scheduling model is used for executing search operation according to a harmony search algorithm and determining the optimal harmony sound in the current iteration process according to the target fitness function, and the target fitness function is used for measuring the stroke length and the overtime degree of a delivery path corresponding to the harmony sound;
harmony update module 403: when the current iteration times do not reach the maximum iteration times, generating new harmony according to an electromagnetic mechanism-like algorithm, and entering the next iteration process;
the goal optimal harmony determination module 404: the optimal harmony module is used for determining the optimal harmony of the target when the current iteration times reach the maximum iteration times;
the logistics transportation scheduling result determining module 405: and the optimal vehicle path corresponding to the target optimal sound is determined to be used as a logistics transportation scheduling result of the logistics transportation scheduling model with the time window.
In this embodiment, the harmony update module 403 includes:
a charge amount determining unit: for determining the charge amount of the charged particles represented by harmonics in the current iteration;
coulomb force determination unit: for determining, from the amount of charge, a coulomb force experienced by the charged particles;
a displacement conversion unit: the acoustic generator is used for carrying out corresponding displacement transformation on the harmony sound according to the coulomb force;
harmony update unit: and determining the optimal harmony among the harmony before the displacement transformation and the harmony after the displacement transformation as a new harmony according to the target fitness function.
In this embodiment, the apparatus further comprises:
a disturbance update module: and the method is used for carrying out disturbance updating on the harmony memory bank according to the harmony memory bank disturbance strategy when the harmony memory bank disturbance condition is met.
The logistics transportation scheduling apparatus with a time window of this embodiment is used to implement the aforementioned logistics transportation scheduling method with a time window, and therefore a specific implementation manner in the apparatus can be seen in the foregoing embodiment parts of the logistics transportation scheduling method with a time window, for example, the model obtaining module 401, the sound searching module, the sound updating module 403, the target optimal harmony determining module 404, and the logistics transportation scheduling result determining module 405 are respectively used to implement steps S101, S102, S103, S104, and S105 in the aforementioned logistics transportation scheduling method with a time window. Therefore, specific embodiments thereof may be referred to in the description of the corresponding respective partial embodiments, and will not be described herein.
In addition, since the logistics transportation scheduling apparatus with a time window of this embodiment is used for implementing the aforementioned logistics transportation scheduling method with a time window, the role thereof corresponds to that of the above method, and details are not repeated here.
In addition, this application still provides a logistics transportation scheduling equipment of taking time window, refer to fig. 5, and this equipment includes:
the memory 100: for storing a computer program;
the processor 200: for executing the computer program to implement the steps of:
the method comprises the steps of obtaining a logistics transportation scheduling model with a time window, wherein the logistics transportation scheduling model with the time window is a model for describing that a plurality of vehicles finish delivery tasks of a plurality of customer points within a preset time range; aiming at the logistics transportation scheduling model with the time window, executing search operation according to a harmony search algorithm, and determining the optimal harmony sound in the current iteration process according to a target fitness function, wherein the target fitness function is used for measuring the stroke length and the overtime degree of a delivery path corresponding to the harmony sound; when the current iteration times do not reach the maximum iteration times, generating new harmony according to an electromagnetic mechanism-like algorithm, and entering the next iteration process; when the current iteration times reach the maximum iteration times, determining the optimal harmony of the target; and determining the optimal vehicle path corresponding to the optimal target and the sound to be used as a logistics transportation scheduling result of a logistics transportation scheduling model with a time window.
In some specific embodiments, the processor 200, when executing the computer sub program of the memory 100, may specifically implement the following steps:
determining the charge amount of the charged particles represented by harmonics in the current iteration; determining, from the amount of charge, a coulomb force experienced by the charged particle; performing corresponding displacement transformation on the harmony sound according to the coulomb force; and determining the optimal harmony in the harmony before the displacement transformation and the harmony after the displacement transformation as a new harmony according to the target fitness function.
In some specific embodiments, the processor 200, when executing the computer sub program of the memory 100, may specifically implement the following steps:
and when the harmony memory bank disturbance condition is met, carrying out disturbance updating on the harmony memory bank according to the harmony memory bank disturbance strategy.
In some specific embodiments, the processor 200, when executing the computer sub program of the memory 100, may specifically implement the following steps:
setting the harmony memory bank disturbance condition as: and the current iteration times are smaller than a preset threshold value and are not updated with the continuous preset times of the acoustic memory library.
In some specific embodiments, the processor 200, when executing the computer sub program of the memory 100, may specifically implement the following steps:
and respectively setting an early penalty coefficient and a late penalty coefficient for the logistics transportation scheduling model with the time window.
Finally, the present application provides a readable storage medium having stored thereon a computer program for implementing the steps of the aforementioned logistics transportation scheduling method with time window when being executed by a processor.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above detailed descriptions of the solutions provided in the present application, and the specific examples applied herein are set forth to explain the principles and implementations of the present application, and the above descriptions of the examples are only used to help understand the method and its core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.