CN112329968A - Resource allocation method, device and storage medium - Google Patents

Resource allocation method, device and storage medium Download PDF

Info

Publication number
CN112329968A
CN112329968A CN201911087625.5A CN201911087625A CN112329968A CN 112329968 A CN112329968 A CN 112329968A CN 201911087625 A CN201911087625 A CN 201911087625A CN 112329968 A CN112329968 A CN 112329968A
Authority
CN
China
Prior art keywords
resources
places
specified
place
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911087625.5A
Other languages
Chinese (zh)
Inventor
董红宇
蔡爽
郭震
宋晓昕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201911087625.5A priority Critical patent/CN112329968A/en
Publication of CN112329968A publication Critical patent/CN112329968A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource planning, allocation, distributing or scheduling for enterprises or organisations
    • G06Q10/06311Scheduling, planning or task assignment for a person or group
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/083Shipping

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Human Resources & Organizations (AREA)
  • Economics (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Marketing (AREA)
  • Development Economics (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Game Theory and Decision Science (AREA)
  • Educational Administration (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a method, a device and a storage medium for resource allocation, which specifically comprise the following steps: comparing the specified quantity of the resources to be selected with the total quantity of the resources placed in all the places, wherein each place is used for placing the same type of resources; if the specified quantity does not exceed the total quantity, selecting the specified quantity of resources from the places according to a principle that the minimum selection times preferentially empty the places, and determining a selection result; the distribution is carried out according to the selected result to generate a distribution scheme, based on the scheme, the distribution scheme of the optimal solution can be generated, the speed of solving the knapsack problem is optimized, the distribution efficiency is improved, and the requirement of online real-time distribution can be met.

Description

Resource allocation method, device and storage medium
Technical Field
The present application relates to the field of computing technologies, and in particular, to a method, an apparatus, and a storage medium for resource allocation.
Background
In many application scenarios in the logistics industry, a decision method for knapsack problems, such as commodity distribution problems and personnel scheduling problems of a warehouse management system, is used. In order to solve the distribution problem, the actual problem is converted into a mathematical problem, a distribution model is established, the distribution problem such as the commodity distribution problem and the personnel scheduling problem in the logistics industry is converted into a knapsack problem to be solved, the knapsack problem is solved by means of algorithms such as a dynamic programming algorithm and a meta-heuristic algorithm, and an optimal resource distribution scheme can be obtained.
However, in the prior art, the knapsack problem is solved by methods such as dynamic programming and meta-heuristic methods, the solving time is long, the time for determining the optimal resource allocation scheme is probably more than the second level, and the requirement of online real-time resource allocation cannot be met.
Disclosure of Invention
In view of the prior art, an embodiment of the present invention discloses a resource allocation method, which can quickly take out required resources from multiple places by a principle that a minimum selection number preferentially empties the places, generate a corresponding allocation scheme, optimize the speed of solving a knapsack problem, improve allocation efficiency, and meet the demand of online real-time allocation, and the method includes:
comparing the specified quantity of the resources to be selected with the total quantity of the resources placed in all the places, wherein each place is used for placing the same type of resources;
if the specified number does not exceed the total number, executing the selection operation of preferentially emptying the places by the minimum selection times, selecting the resources with the specified number from the places, and determining the selection result;
and distributing according to the selection result to generate a distribution scheme.
Optionally, the performing a selection operation that preferentially empties a site for a minimum number of selections includes:
ranking the number of the resources placed by all sites;
determining whether the specified quantity exceeds a maximum value of a quantity of the resources placed in the site;
when the specified quantity does not exceed the maximum value, selecting the specified quantity of the resources from a corresponding place;
when the specified quantity exceeds the maximum value, selecting the resources meeting the specified quantity from a plurality of places according to a method for solving a knapsack problem;
optionally, when the specified number does not exceed the maximum value, the step of selecting the specified number of the resources from the corresponding one of the sites includes:
determining whether the specified quantity is equal to the quantity of the resources placed in one place by adopting a dichotomy, and if so, selecting the specified quantity of the resources;
if not, the resources selected from the placement places with the maximum number of the resources are placed according to the specified number, and the specified number is subtracted from the maximum value.
Optionally, the step of selecting the specified number of the resources from a plurality of places according to the method for solving the knapsack problem includes:
obtaining all available distribution schemes of the quantity of the resources selected from the places by adopting a heuristic algorithm, and calculating to obtain an adaptive value corresponding to each distribution scheme;
and selecting the quantity of the resources in the allocation scheme with the minimum adaptive value.
Optionally, the adaptive value is calculated according to a principle that a minimum selection number of times preferentially empties the place.
Optionally, the adaptive value is represented by a weighted sum of the number of times of selecting the resource and the number of places where the resource is placed, where the sum of the weight of the number of times of selecting the resource and the weight of the number of places is 1.
Optionally, the weight of the operation times is greater than the weight of the placement location number.
Optionally, after the step of comparing the specified quantity of resources to the total quantity of all premises on which the resource is placed, the method further comprises: terminating if the specified quantity value exceeds the total quantity.
The embodiment of the invention provides a device for allocating resources, which comprises:
the comparison module is used for comparing the specified quantity of the resources required to be selected with the total quantity of the resources placed in all the places, wherein each place is used for placing the same kind of resources;
a determining module, configured to execute a selection operation that a minimum selection number preferentially empties places if the specified number does not exceed the total number, select the specified number of resources from the places, and determine a selection result;
and the generating module is used for distributing according to the selection result to generate a distribution scheme.
In another embodiment of the present invention, a computer-readable storage medium is provided, on which computer instructions are stored, which when executed by a processor, implement the method of resource allocation described above.
In another embodiment of the present invention, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the method of resource allocation described above.
In summary, according to the technical scheme provided by the embodiment of the invention, based on the principle that the minimum selection times preferentially empty the places, the specified number of resources meeting the requirements are selected from the places where the resources are placed for distribution, so that the distribution scheme of the optimal solution can be quickly determined, the algorithm is simpler and more flexible than the existing algorithm for solving the knapsack problem, the solution speed of the knapsack problem is optimized, and the resource distribution efficiency is improved, thereby the time requirement of internet online distribution can be met, and the resource distribution has better real-time performance.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 illustrates a flow diagram of a resource allocation method 100 in accordance with some embodiments of the invention;
FIG. 2 illustrates a flow diagram of a method 200 of some embodiments of the inventions;
FIG. 3 illustrates a flow diagram of a resource allocation method 300 in accordance with some embodiments of the invention;
FIG. 4 is a schematic diagram of an apparatus 400 for resource allocation in some embodiments of the invention;
fig. 5 illustrates a schematic diagram of an electronic device 500 in some embodiments of the invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the 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.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail with specific examples. Several of the following embodiments may be combined with each other and some details of the same or similar concepts or processes may not be repeated in some embodiments.
In order to solve the problems in the prior art, the invention provides a resource allocation method, which can be applied to the condition that the same type of resources are respectively placed in a plurality of places, and the quantity of the resources placed in each place is different, and the resources with the specified quantity are selected. Wherein the resource may be goods, people, vehicles, or the like. According to the method, the solution speed of the knapsack problem is optimized according to the principle that the minimum selection times preferentially empty the places, and the resource allocation efficiency is improved, so that the time requirement of internet online allocation can be met, and the resource allocation has better instantaneity.
As shown in fig. 1, fig. 1 shows a flowchart of a method 100 for resource allocation according to some embodiments of the present application, and in an embodiment of the present invention, the method 100 for resource allocation may include the following steps:
step S101: comparing the specified quantity of resources to be selected with the total quantity of the resources placed in all the places.
Here, the related information of the resource to be selected and the related information of the place where the resource is placed may be obtained in advance, where each place is used for placing the same type of resource, the related information of the resource to be selected includes the specified number of the resource to be selected, and the related information of the place where the resource is placed includes a place identifier of the place, the number of the resource placed in the place, and the like. The number of placed resources in each site may be different. It can be understood that, in the actual application scenario of the logistics industry, the resources may be goods, commodities, people, vehicles, etc., and the types of the resources are not limited according to the actual application.
Step S102: and if the specified number does not exceed the total number, executing the selection operation of preferentially emptying the places by the minimum selection times, selecting the resources meeting the specified number from the places, and determining the selection result.
Here, the specified quantity of the resource to be selected does not exceed the total quantity of the resources placed in all the sites, that is, the quantity of the supply of the resource can meet the quantity of the demand for the resource, and at this time, according to the principle that the sites are preferentially emptied by the minimum number of selection times, the specified quantity of the resource is selected from the sites by performing the selection operation that the sites are preferentially emptied by the minimum number of selection times, and a selection result is determined, wherein the selection result can be how many quantities of the resource are taken from which sites or how many quantities of the resource are taken from which sites respectively.
Step S103: and distributing according to the selection result to generate a distribution scheme.
Here, the selection result may be a place from which the resource is taken out in a certain amount, or a place from which the resource is taken out in a certain amount, and the resource is allocated according to the selection result, that is, the component recipe is generated and the allocation recipe is output.
In summary, in the embodiment of the present invention, the resource allocation method selects a specified number of resources satisfying a requirement from the places where the resources are placed to allocate based on the principle that the minimum selection times preferentially empty the places, so as to quickly determine an allocation scheme, which is simpler and more flexible than the existing algorithm for solving the knapsack problem, optimize the solution speed of the knapsack problem, and improve the resource allocation efficiency, thereby satisfying the time requirement for internet online allocation and enabling the resource allocation to have better real-time performance.
As shown in fig. 2, fig. 2 shows a flowchart of a method 200 according to some embodiments of the present application, in which step S102 may be implemented as the method 200, and the method 200 includes the following steps:
step S201: ranking the number of the resources placed by all the sites.
Here, the number of resources placed by all sites is sorted, and sorting may include performing ascending sorting or descending sorting, and it may be determined which site has the largest number of resources placed, i.e., the largest value. Step S202 is performed according to the determined maximum value.
Step S202: determining whether the specified number exceeds a maximum number of places of the resource in the site.
Step S203: and when the specified quantity does not exceed the maximum value, selecting the specified quantity of the resources from a corresponding place according to a principle that the minimum selection times preferentially empty the places.
Here, when the specified number does not exceed the maximum value, because the number of resources placed in each place is different, there may be one or more places that can meet the specified number of demands, then, according to the principle that the minimum number of selection times preferentially empties places, the specified number of resources can be directly selected from a corresponding place that meets the specified number of demands, the method has a small number of operations and can quickly determine the selected place, the calculation selection method is simpler and faster.
Because the quantity of resources placed in each place is different, one or more places which can meet the requirement of the specified quantity may exist, and further, the quantity of the resources placed in one or more places may be equal to the specified quantity to be selected, so that a dichotomy method may be adopted to determine whether the specified quantity to be selected is equal to the quantity of the resources placed in one place, and if so, the quantity of the resources is selected, that is, all the resources in the place are selected. For example, when the resources are commodities, the designated number to be selected is 20, the number of the commodities placed in the place A in all the places is found to be 20 through the dichotomy, the commodities are taken out of the place A by 20, the commodities in the place A are emptied, and the places where the commodities are placed are reduced. Here, once selection operation is performed and resources of one place are emptied, selectable places are reduced, that is, possible query or comparison objects are reduced, so that the speed of selection execution can be increased, and the solution time can be reduced.
If not, the quantity of the resources placed in all the places is not equal to the specified quantity to be selected, selecting the resources from the place where the quantity of the placed resources is the maximum according to the specified quantity, and subtracting the specified quantity from the maximum. Specifically, when the number of place placements consistent with the specified number to be selected is not found, the resource meeting the specified number is directly selected from the places where the resource with the maximum value is placed, and the specified number is subtracted from the maximum value, namely, the number of the place placement resources is updated. For example, when the resource is a commodity, the designated number to be selected is 20, the number of commodities placed in the site B in all the sites is 25 at most, 20 commodities are taken out from the site B, and finally 5 commodities remain. Here, since the number of place placement resources is ranked, the place where the resource with the largest value is placed can be determined, and the maximum value is determined, and the specified number does not exceed the maximum value, so that it is fastest and most convenient to directly select the specified number of resources from the place.
It can be understood that the number of resources placed in the place is determined to be equal to the designated number by using the dichotomy, and other existing searching methods, such as a linear searching method, may also be used, and the specific method may be selected according to actual requirements, and is not described herein again.
Step S204: and when the specified quantity exceeds the maximum value, selecting the specified quantity of resources from a plurality of places according to a method for solving a knapsack problem.
Specifically, when the specified number exceeds the maximum value of resources placed in all the sites, the resources need to be selected from a plurality of sites, and at this time, the resources can be selected from the plurality of sites according to a method for solving a knapsack problem, so as to meet the requirement of the specified number.
Here, according to the principle that the minimum selection times preferentially empty the places, the operation times need to be minimized, the number of the places to be placed in the empty places is maximized, and a mixed integer nonlinear programming model is established as follows:
Figure BDA0002265908030000071
wherein i isResource, j is the place number where resource i is placed, cijThe number of resources i on site j,
α1,α2priority weights alpha of the number of operations and the number of places where the resource is placed12=1,α12
Decision variables: x is the number ofijTo remove the number of resources i from site j, yijWhether to take resource i from site j, if yes, yij1 is ═ 1; otherwise, yij=0。
The constraint conditions include:
constraint (1):
Figure BDA0002265908030000072
representing the number of resources of all sites whose number is to meet the demand, DiThe amount of resources that are required;
constraint (2):
Figure BDA0002265908030000073
indicating that the number of removals of resource i from site j cannot exceed its maximum number;
constraint (3):
Figure BDA0002265908030000074
this represents a case where the number of operations counted without removing resource i from site j is avoided, and there are three cases:
①xij0 and yij0, indicating that the product i is not removed from the place j;
②xij∈N*and y isij1, indicating that a certain number of goods i are taken away from the place j;
③xij∈N*and y isijWhen the number of the product i is 0, the number of the product i is counted. This is not practical, but does not affect the objective function and other constraints;
constraint (4): x is the number ofij∈N*The number of the commodity resources i taken from the place j is a natural number;
constraint (5): y isijE {0,1}, indicating whether the commodity resource i has been removed from the place j, if so, yij1 is ═ 1; otherwise, yij=0。
Here, a heuristic algorithm may be used to obtain all available allocation schemes for selecting a specified number of the resources from the site, calculate an adaptive value corresponding to each allocation scheme, select the number of the selected resources from the allocation schemes with the smallest adaptive value, and determine the selection result. The fitness value may be used to evaluate the allocation scheme, with smaller fitness values yielding better allocation schemes.
Further, according to the principle that the minimum selection times are prior to the emptying of the place, the algorithm aims at minimizing the operation times and maximizing the number of the emptying places, the adaptive value is used for evaluating the distribution scheme, the smaller the adaptive value is, the better the obtained distribution scheme is, the specific calculation method of the adaptive value can be expressed as the weighted sum of the operation times of selecting resources and the number of the resource placing places, and the calculation formula of the adaptive value is expressed as:
Figure BDA0002265908030000081
wherein the weight of the number of operations is alpha1Weight α with the number of placement sites2The sum of which is 1, the weight of the number of operations alpha1Weight α greater than the number of resource placement sites2In particular, the weight α of the number of operations10.99, weight of number of resource placement sites alpha2Is 0.01. The weights can be set according to experience, and it can be understood that the setting of the weights is determined according to actual scenes, so that a better effect can be achieved, the adaptive values have a better evaluation effect, and the determined distribution scheme is more reasonable.
It should be understood that, other existing algorithms for solving the knapsack problem may be adopted without limitation to the heuristic algorithm, and the specific manner is not described herein again.
In summary, when the total amount of resources placed in all the places can satisfy the specified amount to be selected, in order to quickly determine the result of selecting resources, resource selection can be performed in two selection scenarios, one is a selection scenario satisfying the specified amount of resources to be selected from one place, and the other is a selection scenario satisfying the specified amount of resources to be selected from multiple places, the first selection scenario can determine the selection result by a simple search method, while the second selection scenario can use the existing algorithm for solving the knapsack problem to find the optimal solution of the distribution scheme and determine the selection result, based on the above method, the distribution scheme is determined according to different selection scenarios, and only the second selection scenario uses a more complex algorithm for solving, so that the distribution scheme can be quickly determined, and the solution speed of the knapsack problem is optimized, the resource allocation efficiency is improved, so that the time requirement of internet online allocation can be met, and the resource allocation has better real-time performance.
As shown in fig. 3, fig. 3 shows a flowchart of a method 300 for resource allocation according to some embodiments of the present application, and in the embodiment of the present invention, the method 300 includes the following steps:
step S301: and judging whether the specified quantity of the resources to be selected exceeds the total quantity of the resources placed in all the places.
Here, it is determined whether the specified number of the resources to be selected exceeds the total number of the resources placed in all the places, that is, the specified number of the resources to be selected is compared with the total number of the resources placed in all the places, and the related information of the resources to be selected and the related information of the places where the resources are placed may be obtained in advance, where each place is used for placing the same type of resources, the related information of the resources to be selected includes the specified number of the resources to be selected, the related information of the places where the resources are placed includes the place identifier of the place, the number of the resources placed in the place, and the like. The number of placed resources in each site may be different. It can be understood that, in the actual application scenario of the logistics industry, the resources may be goods, commodities, people, vehicles, etc., and the types of the resources are not limited according to the actual application.
Step S302: ranking the number of resources placed by all venues if the specified number does not exceed the total number.
Here, the specified quantity of the resources to be selected does not exceed the total quantity of the resources placed in all the sites, that is, the quantity of the resources supplied can meet the quantity required for the resources, and at this time, the specified quantity of the resources is selected from the sites according to the principle that the minimum number of selection times preferentially empties the sites, and a selection result is determined, wherein the selection result can be how many quantities of the resources are taken from which sites or how many quantities of the resources are taken from which sites respectively. The amount of resources placed by all sites is sorted, the sorting comprises ascending sorting or descending sorting, and it can be determined which site has the largest amount of resources placed, i.e. the largest value. Step S304 is performed according to the determined maximum value.
Step S303: terminating if the specified number exceeds the total number.
Here, if the specified number of resources to be selected exceeds the total number of resources placed in all the sites, that is, the number of supplies of the resources cannot satisfy the number of demands for the resources and cannot be allocated, the execution of the program is terminated.
Step S304: determining whether the specified number exceeds a maximum number of places of the resource in the site.
Here, the number of resources placed by all sites is sorted, and the sorting includes ascending sorting or descending sorting, and it can be determined which site has the largest number of resources placed, i.e., the largest value.
Step S305: and when the specified quantity does not exceed the maximum value, selecting the specified quantity of the resources from a corresponding place according to a principle that the minimum selection times preferentially empty the places, and determining a selection result.
Step S3051: determining whether the specified quantity is equal to the quantity of the resources placed in one place by adopting a dichotomy, and if so, selecting the specified quantity of the resources;
step S3052: if not, the resources selected from the placement places with the maximum number of the resources are placed according to the specified number, and the specified number is subtracted from the maximum value.
Here, when the specified number does not exceed the maximum value, because the number of resources placed in each place is different, there may be one or more places that can meet the specified number of demands, then, according to the principle that the minimum number of selection times preferentially empties places, the specified number of resources can be directly selected from a corresponding place that meets the specified number of demands, the method has a small number of operations and can quickly determine the selected place, the calculation selection method is simpler and faster.
Because the quantity of resources placed in each place is different, one or more places which can meet the requirement of the specified quantity may exist, and further, the quantity of the resources placed in one or more places may be equal to the specified quantity to be selected, so that a dichotomy method may be adopted to determine whether the specified quantity to be selected is equal to the quantity of the resources placed in one place, and if so, the quantity of the resources is selected, that is, all the resources in the place are selected. For example, when the resources are commodities, the designated number to be selected is 20, the number of the commodities placed in the place A in all the places is found to be 20 through the dichotomy, the commodities are taken out of the place A by 20, the commodities in the place A are emptied, and the places where the commodities are placed are reduced. Here, once selection operation is performed and resources of one place are emptied, selectable places are reduced, that is, possible query or comparison objects are reduced, so that the speed of selection execution can be increased, and the solution time can be reduced.
If not, the quantity of the resources placed in all the places is not equal to the specified quantity to be selected, selecting the resources from the place where the quantity of the placed resources is the maximum according to the specified quantity, and subtracting the specified quantity from the maximum. Specifically, when the number of place placements consistent with the specified number to be selected is not found, the resource meeting the specified number is directly selected from the places where the resource with the maximum value is placed, and the specified number is subtracted from the maximum value, namely, the number of the place placement resources is updated. For example, when the resource is a commodity, the designated number to be selected is 20, the number of commodities placed in the site B in all the sites is 25 at most, 20 commodities are taken out from the site B, and finally 5 commodities remain. Here, since the number of place placement resources is ranked, the place where the resource with the largest value is placed can be determined, and the maximum value is determined, and the specified number does not exceed the maximum value, so that it is fastest and most convenient to directly select the specified number of resources from the place.
The selection scene is a specified number of resources selected from a place, and a selection result is determined, namely the specified number of resources are taken out from which place. Obviously, the method is simple and quick, and can accelerate the selection execution speed so as to reduce the solving time.
Step S306: and when the specified quantity exceeds the maximum value, selecting the specified quantity of resources from a plurality of places according to a method for solving the knapsack problem, and determining a selection result.
Step S3061: obtaining all available distribution schemes of the quantity of the resources selected from the places by adopting a heuristic algorithm, and calculating to obtain an adaptive value corresponding to each distribution scheme;
step S3062: and selecting the quantity of the resources in the distribution scheme with the minimum adaptive value, and determining a selection result.
Here, when the specified number exceeds the maximum value of resources placed in all the sites, the resources need to be selected from a plurality of sites, and at this time, the resources can be selected from a plurality of sites according to a method for solving a knapsack problem so as to meet the requirement of the specified number.
Here, according to the principle that the minimum selection times preferentially empty the places, the operation times need to be minimized, the number of the places to be placed in the empty places is maximized, and a mixed integer nonlinear programming model is established as follows:
Figure BDA0002265908030000121
wherein i is a resource, j is a place number for placing the resource i, cijThe number of resources i on site j,
α1,α2are respectively provided withPriority weighting alpha of operation times and emptying place times12=1,α12
Decision variables: x is the number ofijTo remove the number of resources i from site j, yijWhether to take resource i from site j, if yes, yij1 is ═ 1; otherwise, yij=0。
The constraint conditions include:
constraint (1):
Figure BDA0002265908030000122
representing the number of resources of all sites whose number is to meet the demand, DiThe amount of resources that are required;
constraint (2):
Figure BDA0002265908030000123
indicating that the number of removals of resource i from site j cannot exceed its maximum number;
constraint (3):
Figure BDA0002265908030000124
this represents a case where the number of operations counted without removing resource i from site j is avoided, and there are three cases:
①xij0 and yij0, indicating that the product i is not removed from the place j;
②xij∈N*and y isij1, indicating that a certain number of goods i are taken away from the place j;
③xij∈N*and y isijWhen the number of the product i is 0, the number of the product i is counted. This is not practical, but does not affect the objective function and other constraints;
constraint (4): x is the number ofij∈N*The number of the commodity resources i taken from the place j is a natural number;
constraint (5): y isijE {0,1}, indicating whether the commodity resource i has been removed from the place j, if so, yij1 is ═ 1; otherwise, yij=0。
Here, a heuristic algorithm may be used to obtain all available allocation schemes for selecting a specified number of the resources from the site, calculate an adaptive value corresponding to each allocation scheme, select the number of the selected resources from the allocation schemes with the smallest adaptive value, and determine the selection result.
Further, according to the principle that the minimum selection times are prior to the emptying of the place, the algorithm aims at minimizing the operation times and maximizing the number of the emptying places, the adaptive value is used for evaluating the distribution scheme, the smaller the adaptive value is, the better the obtained distribution scheme is, the specific calculation method of the adaptive value can be expressed as the weighted sum of the operation times of selecting resources and the number of the resource placing places, and the calculation formula of the adaptive value is expressed as:
Figure BDA0002265908030000131
wherein the weight of the number of operations is alpha1Weight α with the number of placement sites2The sum of which is 1, the weight of the number of operations alpha1Weight α greater than the number of resource placement sites2In particular, the weight α of the number of operations10.99, weight of number of resource placement sites alpha2Is 0.01. The above weights may be set empirically.
Further, when the designated number exceeds the maximum value of the resources placed in all the sites, resource selection needs to be performed from a plurality of sites, and after the number of resources is selected according to the allocation scheme with the minimum adaptive value, the number of the resources to be taken out needs to be subtracted from each selected site, and the number of the remaining resources is recorded.
Step S307: and distributing according to the selection result to generate a distribution scheme.
Here, the selection result may be a number of resources taken from which location, or a number of resources taken from which locations, respectively, and the allocation may be performed according to the selection result, that is, a component recipe may be generated, and finally, the allocation recipe may be output.
In summary, in the embodiment of the present invention, the method for resource allocation selects a specified number of resources satisfying a requirement from places where the resources are placed for allocation based on a principle that a minimum number of selection times preferentially empty the places, so as to quickly determine an allocation scheme, and specifically, the method may be divided into two selection scenarios, one is a selection scenario in which a specified number of resources to be selected can be selected from one place, and the other is a selection scenario in which a specified number of resources to be selected can be selected from multiple places, where a first selection scenario may determine a selection result by a simple search method, and if a condition of the first selection scenario is satisfied, a simpler search method may be directly used to determine a selection result to generate an allocation scheme, thereby speeding up solution; based on the method, the distribution scheme is determined according to different selected scenes, and only the second selected scene is solved by using a more complex algorithm, so that the distribution scheme can be determined quickly, the solution speed of the knapsack problem is optimized, the resource distribution efficiency is improved, the time requirement of internet online distribution can be met, and the resource distribution has better real-time performance.
An apparatus for resource allocation is further provided in an embodiment of the present invention, as shown in fig. 4, a schematic structural diagram of an apparatus 400 for resource allocation in some embodiments of the present invention is shown in fig. 4, where the apparatus 400 includes:
a comparing module 401, configured to compare the specified number of resources that need to be selected with the total number of the resources placed in all the places, where each place is used to place the same resource;
a determining module 402, configured to execute a selecting operation that a minimum selecting number preferentially empties places if the specified number does not exceed the total number, select the resource meeting the specified number from the places, and determine a selecting result;
and a generating module 403, configured to perform allocation according to the selection result to generate an allocation scheme.
In summary, in the embodiment of the present invention, the resource allocation apparatus 400 may execute the method for resource allocation in the above embodiment, and the method may quickly take out the required resources from multiple places through the selection operation that the minimum selection times preferentially empty the places, generate the corresponding allocation scheme, optimize the speed of solving the knapsack problem, improve the allocation efficiency, and meet the requirement of online real-time allocation.
Embodiments of the present invention also provide a computer-readable storage medium, which stores instructions that, when executed by a processor, cause the processor to perform the steps in the method for resource allocation according to the above embodiments. In practical applications, the computer readable medium may be included in the apparatus/device/system described in the above embodiments, or may exist alone without being assembled into the apparatus/device/system. The computer readable storage medium carries one or more programs which, when executed, implement the method for resource allocation according to the resource allocation apparatus described with reference to fig. 4.
According to embodiments disclosed herein, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example and without limitation: 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), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing, without limiting the scope of the present disclosure. In the embodiments disclosed herein, 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.
Fig. 5 is a schematic structural diagram of an electronic device 500 according to some embodiments of the invention, as shown in fig. 5. An electronic device is further provided in an embodiment of the present application, where the electronic device includes the above-mentioned computer-readable medium 501, and further includes a processor 502 capable of executing the computer-readable storage medium. In practice, the electronic device may be one or more computers, so long as the computer-readable medium and the processor are included.
In addition, the method steps described in this application may be implemented by hardware, for example, logic gates, switches, Application Specific Integrated Circuits (ASICs), programmable logic controllers, embedded microcontrollers, and the like, in addition to data processing programs. Such hardware capable of implementing the methods described herein may also constitute the present application.
The flowchart and block diagrams in the figures of the present application illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments disclosed herein. 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.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not explicitly recited in the present application. In particular, the features recited in the various embodiments and/or claims of the present application may be combined and/or coupled in various ways, all of which fall within the scope of the present disclosure, without departing from the spirit and teachings of the present application.
The principles and embodiments of the present invention are explained herein using specific examples, which are provided only to help understanding the method and the core idea of the present invention, and are not intended to limit the present application. It will be appreciated by those skilled in the art that changes may be made in this embodiment and its broader aspects and without departing from the principles, spirit and scope of the invention, and that all such modifications, equivalents, improvements and equivalents as may be included within the scope of the invention are intended to be protected by the claims.

Claims (10)

1. A method of resource allocation, the method comprising:
comparing the specified quantity of the resources to be selected with the total quantity of the resources placed in all the places, wherein each place is used for placing the same type of resources;
if the specified number does not exceed the total number, executing the selection operation of preferentially emptying the places by the minimum selection times, selecting the resources with the specified number from the places, and determining the selection result;
and distributing according to the selection result to generate a distribution scheme.
2. The method of claim 1, wherein said performing a minimum number of picks that preferentially empties a site, said step of picking said specified number of said resources from a site comprises:
ranking the number of the resources placed by all sites;
determining whether the specified quantity exceeds a maximum value of a quantity of the resources placed in the site;
when the specified quantity does not exceed the maximum value, selecting the specified quantity of the resources from a corresponding place;
when the specified number exceeds the maximum value, selecting the resources meeting the specified number from a plurality of places according to a method for solving a knapsack problem.
3. The method of claim 2, wherein the step of selecting the specified number of the resources from a corresponding one of the sites when the specified number does not exceed the maximum value comprises:
determining whether the specified quantity is equal to the quantity of the resources placed in one place by adopting a dichotomy, and if so, selecting the specified quantity of the resources;
if not, the resources selected from the placement places with the maximum number of the resources are placed according to the specified number, and the specified number is subtracted from the maximum value.
4. The method of claim 2, wherein said step of selecting said specified number of said resources from a plurality of locations according to a method of solving a knapsack problem comprises:
obtaining all available distribution schemes for selecting the quantity of the resources from the places by adopting a heuristic algorithm, and calculating to obtain an adaptive value corresponding to each distribution scheme, wherein the adaptive value is calculated according to a principle that the minimum selection times are prior to emptying the places;
and selecting the quantity of the resources in the allocation scheme with the minimum adaptive value.
5. The method of claim 4, wherein the adaptation value is represented as a weighted sum of a number of operations to select the resource and a number of places to place the resource, wherein a sum of a weight of the number of operations and a weight of the number of places is 1.
6. The method of claim 5, wherein the number of operations is weighted more heavily than the number of placement locations.
7. The method of claim 1, wherein after the step of comparing the specified quantity of resources to a total quantity of all premises on which the resource is placed, the method further comprises: terminating if the specified quantity value exceeds the total quantity.
8. An apparatus for resource allocation, the apparatus comprising:
the comparison module is used for comparing the specified quantity of the resources required to be selected with the total quantity of the resources placed in all the places, wherein each place is used for placing the same kind of resources;
a determining module, configured to execute a selection operation that a minimum selection number preferentially empties places if the specified number does not exceed the total number, select the specified number of resources from the places, and determine a selection result;
and the generating module is used for distributing according to the selection result to generate a distribution scheme.
9. A computer readable storage medium having stored thereon computer instructions, which when executed by a processor, implement the method of resource allocation of any of claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of resource allocation according to any one of claims 1 to 7 when executing the program.
CN201911087625.5A 2019-11-08 2019-11-08 Resource allocation method, device and storage medium Pending CN112329968A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911087625.5A CN112329968A (en) 2019-11-08 2019-11-08 Resource allocation method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911087625.5A CN112329968A (en) 2019-11-08 2019-11-08 Resource allocation method, device and storage medium

Publications (1)

Publication Number Publication Date
CN112329968A true CN112329968A (en) 2021-02-05

Family

ID=74319745

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911087625.5A Pending CN112329968A (en) 2019-11-08 2019-11-08 Resource allocation method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112329968A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113949678A (en) * 2021-09-15 2022-01-18 北京三快在线科技有限公司 Flow control method and device, electronic equipment and computer readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106372838A (en) * 2016-08-31 2017-02-01 珠海港信息技术股份有限公司 Stock sorting method based on knapsack algorithm
CN106934580A (en) * 2017-03-21 2017-07-07 北京京东尚科信息技术有限公司 Method for inventory control and device
CN107977763A (en) * 2016-10-24 2018-05-01 菜鸟智能物流控股有限公司 Resource allocation method and related device
CN108694535A (en) * 2017-04-07 2018-10-23 北京京东尚科信息技术有限公司 information generating method and device
WO2018193586A1 (en) * 2017-04-20 2018-10-25 株式会社日立物流 Article management system and article management method
CN109165886A (en) * 2018-07-16 2019-01-08 顺丰科技有限公司 A kind of logistics vehicles paths planning method and device, equipment, storage medium
CN109472441A (en) * 2018-09-21 2019-03-15 顺丰科技有限公司 Method, processing unit, equipment and the storage medium allocated supplies
CN109615300A (en) * 2018-12-17 2019-04-12 珠海港信息技术股份有限公司 A kind of coil outbound management method based on warehouse homework
CN109919526A (en) * 2017-12-12 2019-06-21 北京京东尚科信息技术有限公司 Stock management method, apparatus, medium and the electronic equipment of unmanned warehouse

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106372838A (en) * 2016-08-31 2017-02-01 珠海港信息技术股份有限公司 Stock sorting method based on knapsack algorithm
CN107977763A (en) * 2016-10-24 2018-05-01 菜鸟智能物流控股有限公司 Resource allocation method and related device
CN106934580A (en) * 2017-03-21 2017-07-07 北京京东尚科信息技术有限公司 Method for inventory control and device
CN108694535A (en) * 2017-04-07 2018-10-23 北京京东尚科信息技术有限公司 information generating method and device
WO2018193586A1 (en) * 2017-04-20 2018-10-25 株式会社日立物流 Article management system and article management method
CN109919526A (en) * 2017-12-12 2019-06-21 北京京东尚科信息技术有限公司 Stock management method, apparatus, medium and the electronic equipment of unmanned warehouse
CN109165886A (en) * 2018-07-16 2019-01-08 顺丰科技有限公司 A kind of logistics vehicles paths planning method and device, equipment, storage medium
CN109472441A (en) * 2018-09-21 2019-03-15 顺丰科技有限公司 Method, processing unit, equipment and the storage medium allocated supplies
CN109615300A (en) * 2018-12-17 2019-04-12 珠海港信息技术股份有限公司 A kind of coil outbound management method based on warehouse homework

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113949678A (en) * 2021-09-15 2022-01-18 北京三快在线科技有限公司 Flow control method and device, electronic equipment and computer readable storage medium
CN113949678B (en) * 2021-09-15 2023-09-01 北京三快在线科技有限公司 Flow control method, flow control device, electronic equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN107103446B (en) Inventory scheduling method and device
CN109840648B (en) Method and device for outputting bin information
Henn et al. Metaheuristics for order batching and sequencing in manual order picking systems
US9092265B2 (en) Long-term resource provisioning with cascading allocations
CN107958349B (en) Task allocation method and device, computer equipment and storage medium
US9374314B2 (en) QoS aware balancing in data centers
US20090281818A1 (en) Quality of service aware scheduling for composite web service workflows
Joseph et al. Analysis of dynamic due-date assignment models in a flexible manufacturing system
CN109784791B (en) Order distribution method and device
CN111813523A (en) Duration pre-estimation model generation method, system resource scheduling method, device, electronic equipment and storage medium
JP2011073883A (en) Method for supply chain management
CN111176840A (en) Distributed task allocation optimization method and device, storage medium and electronic device
CN103970606A (en) Device And Method For Distributing Resource
Khorasanian et al. An iterated greedy algorithm for solving the blocking flow shop scheduling problem with total flow time criteria
CN105824705A (en) Task distribution method and electronic equipment
Venkitasubramony et al. Modeling the effect of imperfect staggering in product inflow using queuing theory: revisiting block stacking layout
CN109544347B (en) Tail difference distribution method, computer readable storage medium and tail difference distribution system
CN113419833B (en) Method and device for task scheduling of quantum cloud computing platform and task scheduling server of quantum cloud computing platform
CN112329968A (en) Resource allocation method, device and storage medium
CN109062683B (en) Method, apparatus and computer readable storage medium for host resource allocation
Abrishami et al. Scheduling in hybrid cloud to maintain data privacy
CN112990624A (en) Task allocation method, device, equipment and storage medium
CN110073321B (en) Storage controller and IO request processing method
CN115599522A (en) Task scheduling method, device and equipment for cloud computing platform
WO2018205890A1 (en) Task assignment method and system of distributed system, computer readable storage medium and computer device therefor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination