A resource allocation method, device and equipment for compressed natural gas

By constructing an optimization model for compressed natural gas resource allocation and improving the whale algorithm, the initial matrix is ​​optimized to generate the optimal solution matrix, which solves the problems of high planning costs and low efficiency in CNG refueling station resource allocation and achieves efficient resource allocation.

CN122175170APending Publication Date: 2026-06-09CHINA NAT PETROLEUM CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA NAT PETROLEUM CORP
Filing Date
2024-12-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies suffer from high planning costs and low efficiency in CNG refueling station resource allocation, especially in large-scale resource allocation where it is difficult to find a reasonable resource allocation scheme within a specified time.

Method used

A compressed natural gas resource allocation optimization model is constructed. The initial matrix is ​​optimized by combining the improved whale algorithm. The optimal solution matrix is ​​generated through the objective function and constraints to determine the resource allocation scheme.

Benefits of technology

It reduces manual planning costs, improves resource allocation efficiency, and provides a feasible solution for large-scale CNG refueling station resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122175170A_ABST
    Figure CN122175170A_ABST
Patent Text Reader

Abstract

The present application belongs to the field of resource allocation, and particularly relates to a compressed natural gas resource allocation method, device and equipment, the method comprising: constructing a compressed natural gas resource allocation optimization model; the optimization model comprises a target function and a constraint condition; generating a plurality of initial matrices according to the total amount of transport vehicles, the total amount of gas stations and random initial numbers; wherein the elements in each initial matrix represent whether the destination of the transport vehicle corresponding to the element is the gas station corresponding to the element; optimizing the plurality of initial matrices based on an improved whale algorithm and the optimization model to obtain a best solution matrix; and determining a compressed natural gas resource allocation scheme according to the best solution matrix. The present application solves the problems of high cost and low efficiency of large-scale CNG gas station resource allocation scheme planning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of resource allocation, and more particularly to a method, apparatus, and equipment for allocating compressed natural gas. Background Technology

[0002] Compressed natural gas (CNG) is a clean and economical energy source widely used in passenger transport, public transport, taxis, and heavy trucks. Therefore, the rational allocation of CNG refueling station resources is crucial to ensuring the efficient operation of these sectors and the sustainable development of urban transportation.

[0003] Currently, CNG refueling stations primarily supply resources through CNG transport vehicles. There are two main solutions: one is for operational staff to manually plan resource allocation based on experience, which requires significant investment of manpower and time; the other is to use integer programming to solve small-scale resource allocation problems, but this approach is not suitable for large-scale resource allocation problems. When applying integer programming to large-scale resource allocation, it is difficult to find a reasonable resource allocation solution within the specified time. Summary of the Invention

[0004] This invention provides a method, apparatus, and equipment for resource allocation of compressed natural gas, which addresses the problems of high planning costs and low efficiency in resource allocation schemes for large-scale CNG refueling stations.

[0005] To address the aforementioned technical problems, the first aspect of this paper provides a method for allocating compressed natural gas resources, the method comprising:

[0006] An optimization model for the allocation of compressed natural gas resources is constructed. The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum consumption of transport vehicles en route, the arrival time, and the traffic flow of gas stations.

[0007] Multiple random initial numbers are obtained based on the total number of transport vehicles and the total number of gas stations;

[0008] Based on the multiple random initial numbers, multiple initial matrices are generated; wherein, each element in the initial matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element;

[0009] The optimal solution matrix is ​​obtained by optimizing the multiple initial matrices based on the improved whale algorithm and the optimization model.

[0010] Based on the optimal solution matrix, a compressed natural gas resource allocation scheme is determined.

[0011] Furthermore, the objective function is expressed by the following formula:

[0012]

[0013] x ij ∈{0,1};

[0014] Where G represents the objective function, This represents the total amount of compressed natural gas resources allocated to gas stations, where m represents the total number of gas stations, n represents the total number of transport vehicles, and x represents the total number of vehicles. ij Indicate whether the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station. ij This represents the load capacity of the i-th transport vehicle when its destination is the j-th gas station.

[0015] Furthermore, the destination constraint of the transport vehicle is expressed using the following formula:

[0016]

[0017] x ij ∈{0,1};

[0018] The loading capacity constraint of the transport vehicle is expressed by the following formula:

[0019] w ij ≤C i ;

[0020]

[0021] The capacity constraint of the gas station is expressed by the following formula:

[0022] y ij =w ij -c ij ;

[0023]

[0024] The maximum on-the-go consumption constraint for the transport vehicle is expressed by the following formula:

[0025] c ij ≤w ij l ij ;

[0026] The arrival time constraint is expressed using the following formula:

[0027] TimeStart ij +TimeCostij ≤Time j ;

[0028] The vehicle flow constraint at the gas station is expressed by the following formula:

[0029] s j ≤station j ;

[0030] Where, x ij This indicates whether the destination of the i-th transport vehicle is the j-th gas station, m represents the total number of gas stations, and x represents the total number of gas stations. ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station. ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station; ij C represents the load capacity of the i-th transport vehicle when its destination is the j-th gas station. i T represents the maximum loading capacity of the i-th transport vehicle, n represents the total number of transport vehicles, and T represents the total loading capacity of the transport vehicle. j This represents the maximum capacity of the j-th gas station. c represents the remaining capacity of the j-th gas station; ij y represents the amount of gas consumed en route when the i-th transport vehicle's destination is the j-th gas station. ij This represents the delivery volume when the destination of the i-th transport vehicle is the j-th gas station; ij Indicates the upper limit of the consumption rate of transport vehicles in transit; TimeStart ij TimeCost represents the departure time of the i-th transport vehicle when its destination is the j-th gas station. ij Time represents the transit time of the i-th transport vehicle when its destination is the j-th gas station. j This represents the agreed time when the destination of the i-th transport vehicle is the j-th gas station; s j Let the traffic flow at the j-th gas station be denoted as station. j Let be the maximum traffic flow limit for the j-th gas station.

[0031] Furthermore, based on the total number of transport vehicles, the total number of gas stations, and the random initial number, multiple initial matrices are generated, including:

[0032] Based on the total number of transport vehicles and the total number of gas stations, the random initial number is subjected to a Logistic mapping to obtain multiple mapping values;

[0033] The multiple mapping values ​​are adjusted according to a preset threshold to obtain multiple binarized mapping values;

[0034] Multiple initial matrices are constructed based on the binarized multiple mapping values.

[0035] Furthermore, the process of determining the preset threshold includes:

[0036] Generate a random threshold corresponding to each mapping value;

[0037] A preset threshold corresponding to each mapping value is determined based on the random threshold.

[0038] Furthermore, based on the improved whale algorithm and the optimization model, the multiple initial matrices are optimized to obtain the optimal solution matrix, including:

[0039] The multiple initial matrices are optimized based on the improved whale algorithm to obtain the optimized multiple initial matrices;

[0040] Based on the constraints of the optimization model, adjust the optimized initial matrices.

[0041] Based on the objective function of the optimization model, determine the optimal matrix of the optimized multiple initial matrices;

[0042] Determine whether the optimal matrix satisfies the first preset condition;

[0043] If the determination is negative, continue to optimize the element distribution of the multiple initial matrices until the first preset condition is met;

[0044] If the determination is yes, the optimal matrix is ​​determined as the optimal solution matrix.

[0045] Furthermore, the multiple initial matrices are optimized based on the improved whale algorithm, including:

[0046] Generate a random number and determine whether the random number satisfies the second preset condition;

[0047] If the determination is yes, when the encirclement operation coefficient meets the third preset condition, the encirclement operation of the improved whale algorithm is executed; otherwise, the search operation of the improved whale algorithm is executed.

[0048] If the determination is negative, execute the spiral attack operation of the improved whale algorithm.

[0049] Furthermore, the encirclement operation of the improved whale algorithm is represented by the following formula:

[0050] X′ n =X best +A×D[X n C1(X) best )];

[0051] A = 2a × rand - a;

[0052] a = 2(1 - t / maxlter);

[0053] The search operation of the improved whale algorithm is represented by the following formula:

[0054] X′ n =X rand +A×D[X n C2(X) rand )];

[0055] The spiral attack operation of the improved whale algorithm is represented by the following formula:

[0056] X′ n =D(X) n ,X best )×e bl cos(2πl)×L+X best ;

[0057] Among them, X n Let X′ represent the nth initial matrix. n Let X represent the adjusted nth initial matrix. best Let D[X] represent the optimal matrix among multiple initial matrices, C1 represent the encirclement operation adjustment coefficient, C2 represent the search operation adjustment coefficient, and D[X] represent the optimal matrix among multiple initial matrices. n ,C(X best )] represents X n and C(X) best The distance is given by X, where A represents the enclosing operation coefficient, a represents the coefficient calculated by A, rand represents a random number in [0,1], t represents the t-th enclosing operation, and maxlter represents the total number of iterations of the preset enclosing operation; rand D[X] represents a random matrix among multiple initial matrices. n ,C(X rand )] represents X n and C(X) rand The distance between ); b is a constant, l is a random number on [-1,1], e bl cos(2πl) represents the shape of the spiral path, and L represents the spiral parameter, which is used to adjust the shape of the spiral path.

[0058] Furthermore, after performing the encirclement operation of the improved whale algorithm, the method further includes:

[0059] Obtain the best encirclement operation adjustment coefficient from the historical encirclement operation adjustment coefficients, where the best encirclement operation adjustment coefficient represents the encirclement operation adjustment coefficient that achieves the best optimization effect on the initial matrix;

[0060] Generate a random number and determine whether the random number satisfies the fourth preset condition;

[0061] If the determination is yes, update the enclosing operation adjustment factor to the optimal enclosing operation adjustment factor;

[0062] If the determination is negative, the encirclement operation adjustment coefficient is updated randomly.

[0063] Furthermore, after randomly updating the encirclement operation adjustment coefficient, the process also includes:

[0064] When the optimization effect of the updated enclosing operation adjustment coefficient is better than that of the optimal enclosing operation adjustment coefficient, the optimal enclosing operation adjustment coefficient is adjusted to the updated enclosing operation adjustment coefficient.

[0065] Furthermore, after performing the search operation of the improved whale algorithm, the process also includes:

[0066] Obtain the best search operation adjustment coefficient from the historical search operation adjustment coefficients, where the best search operation adjustment coefficient represents the search operation adjustment coefficient that achieves the best optimization effect on the initial matrix;

[0067] Generate a random number and determine whether the random number satisfies the fifth preset condition;

[0068] If the determination is yes, update the search operation adjustment factor to the optimal search operation adjustment factor;

[0069] If the determination is negative, the adjustment coefficient of the search operation is updated randomly.

[0070] Furthermore, after randomly updating the search operation adjustment coefficient, the process also includes:

[0071] When the optimization effect of the updated search operation adjustment coefficient is better than that of the optimal search operation adjustment coefficient, the optimal search operation adjustment coefficient is adjusted to the updated search operation adjustment coefficient.

[0072] Furthermore, after executing the spiral attack operation of the improved whale algorithm, the following steps are also included:

[0073] Obtain the optimal spiral parameter from the historical spiral parameters, where the optimal spiral parameter represents the spiral parameter that achieves the best optimization effect on the initial matrix;

[0074] Generate a random number and determine whether the random number satisfies the sixth preset condition;

[0075] If the determination is yes, update the helical parameters to the optimal helical parameters;

[0076] If the determination is negative, the spiral parameters are updated randomly.

[0077] Furthermore, after randomly updating the spiral parameters, the process also includes:

[0078] When the optimization effect of the updated spiral parameters is better than that of the optimal spiral parameters, the optimal spiral parameters are adjusted to the updated spiral parameters.

[0079] A second aspect of this document provides a resource distribution device for compressed natural gas, the device comprising:

[0080] A construction module is used to build an optimization model for compressed natural gas resource allocation. The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum on-the-go consumption of transport vehicles, the arrival time, and the traffic flow of gas stations.

[0081] The generation module is used to generate multiple initial matrices based on the total number of transport vehicles, the total number of gas stations, and a random initial number; where each element in the initial matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element.

[0082] The optimization module is used to optimize the multiple initial matrices based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix;

[0083] The determination module is used to determine the compressed natural gas resource allocation scheme based on the optimal solution matrix.

[0084] A third aspect of this document provides a computer device including a memory, a processor, and a computer program stored on the memory, wherein the computer program, when executed by the processor, performs instructions for the resource allocation method for compressed natural gas as described in any of the foregoing embodiments.

[0085] A fourth aspect of this document provides a computer storage medium having a computer program stored thereon, which, when executed by a processor of a computer device, executes instructions for the resource allocation method for compressed natural gas described in any of the foregoing embodiments.

[0086] The fifth aspect of this document provides a computer program product comprising a computer program that, when executed by a processor of a computer device, executes instructions for the resource allocation method for compressed natural gas as described in any of the foregoing embodiments.

[0087] This paper presents a method, apparatus, and equipment for compressed natural gas (CNG) resource allocation. It constructs a CNG resource allocation optimization model with the objective function of maximizing the total CNG supply. Based on the total number of transport vehicles, the total number of refueling stations, and random initial numbers, it generates multiple initial matrices for inputting an improved whale algorithm, providing a solution objective and computational basis for applying the improved whale algorithm to solve resource allocation schemes. By solving resource allocation schemes using the improved whale algorithm and combining it with the optimization model's constraint-based solution process, a feasible solution is provided for solving large-scale resource allocation problems, thus addressing the issues of high planning costs and low efficiency in large-scale CNG refueling station resource allocation schemes.

[0088] To make the above and other objects, features and advantages of this document more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0089] To more clearly illustrate the technical solutions in the embodiments or prior art described herein, the accompanying drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this article. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0090] Figure 1 A flowchart of the resource allocation method for compressed natural gas according to the embodiments of this article is shown;

[0091] Figure 2 A flowchart illustrating the method for generating the initial matrix in the embodiments of this paper is shown;

[0092] Figure 3 A flowchart illustrating the preset threshold determination process in the embodiments of this article is shown;

[0093] Figure 4 The flowchart illustrating the process of obtaining the optimal solution matrix in the embodiments described herein is shown.

[0094] Figure 5 A flowchart illustrating the method for optimizing the initial matrix in this embodiment is shown.

[0095] Figure 6 A flowchart illustrating the updating of the enclosing operation adjustment factor in the embodiments of this paper is shown;

[0096] Figure 7 A flowchart illustrating the updating of the search operation adjustment coefficients in the embodiments of this paper is shown;

[0097] Figure 8 A flowchart illustrating the updating of helical parameters in an embodiment of this paper is shown;

[0098] Figure 9 A structural diagram of the compressed natural gas resource distribution device according to an embodiment of this article is shown;

[0099] Figure 10 A structural diagram of the computer device described in this embodiment is shown.

[0100] Explanation of symbols in the attached drawings:

[0101] 910. Building Modules;

[0102] 920. Generation Module;

[0103] 930. Optimization module;

[0104] 940. Determine the module;

[0105] 1002. Computer equipment;

[0106] 1004, Processor;

[0107] 1006. Memory;

[0108] 1008. Drive mechanism;

[0109] 1010. Input / Output Module;

[0110] 1012. Input devices;

[0111] 1014. Output devices;

[0112] 1016. Presentation device;

[0113] 1018. Graphical User Interface;

[0114] 1020. Network interface;

[0115] 1022. Communication link;

[0116] 1024. Communication bus. Detailed Implementation

[0117] The technical solutions in the embodiments described below will be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments described herein, and not all of the embodiments. Based on the embodiments described herein, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this document.

[0118] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0119] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or device products, the methods shown in the embodiments or drawings can be executed sequentially or in parallel.

[0120] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification all comply with the relevant provisions of national laws and regulations.

[0121] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0122] It should be noted that in the embodiments of this application, the transport vehicle refers to a CNG transport vehicle and the gas station refers to a CNG gas station.

[0123] In one embodiment of this paper, a resource allocation method for compressed natural gas is provided to solve the problems of high planning costs and low efficiency in resource allocation schemes for large-scale CNG refueling stations.

[0124] Specifically, such as Figure 1 As shown, the resource allocation methods for compressed natural gas include:

[0125] Step 110: Construct an optimization model for compressed natural gas resource allocation;

[0126] The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum consumption of transport vehicles en route, the arrival time, and the traffic flow of gas stations.

[0127] Step 120: Generate multiple initial matrices based on the total number of transport vehicles, the total number of gas stations, and random initial numbers;

[0128] In each initial matrix, the element indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element.

[0129] Step 130: Optimize the multiple initial matrices based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix;

[0130] Step 140: Determine the compressed natural gas resource allocation scheme based on the optimal solution matrix.

[0131] This embodiment constructs a compressed natural gas (CNG) resource allocation optimization model and combines it with an improved whale algorithm to solve the CNG resource allocation scheme. This eliminates the need for manual planning of CNG refueling station resource allocation schemes, reduces labor costs, and improves resource allocation efficiency. At the same time, based on the advantages of the improved whale algorithm and the CNG resource allocation optimization model, it provides a solution for planning the allocation of resources for large-scale CNG refueling stations.

[0132] In this embodiment, each transport vehicle needs to be transported to a designated gas station within a specified time period. According to the requirements, each CNG transport vehicle can only have one destination gas station.

[0133] In this embodiment, the objective function of the compressed natural gas resource allocation optimization model is to maximize the sum of compressed natural gas supply from all gas stations. At the same time, the constraints of the compressed natural gas resource allocation optimization model are: vehicle destination constraint, vehicle loading constraint, gas station capacity constraint, maximum on-the-way consumption constraint, arrival time constraint, and gas station traffic flow constraint. That is, the resource allocation scheme must satisfy all of the above constraints at the same time.

[0134] In this embodiment, the destination constraint for transport vehicles is a constraint on the destination refueling station, meaning each transport vehicle can only have one destination refueling station; the load constraint for transport vehicles is a constraint on the amount of CNG loaded onto the transport vehicle, meaning the CNG loaded onto the transport vehicle cannot exceed the maximum CNG capacity of the transport vehicle, and the CNG loaded onto the transport vehicle cannot exceed the maximum CNG replenishment capacity that the refueling station can receive; the capacity constraint for refueling stations is a constraint on the maximum CNG replenishment capacity that the refueling station can receive, meaning the sum of the CNG delivered by all transport vehicles heading to the refueling station cannot exceed the maximum CNG replenishment capacity that the refueling station can receive. The constraints on CNG consumption include: maximum CNG consumption during transport; maximum CNG consumption during transport; arrival time; and traffic flow at the refueling station.

[0135] In this embodiment, the objective function is represented by the following formula:

[0136]

[0137] x ij ∈{0,1};

[0138] Where G represents the objective function, This represents the total amount of compressed natural gas resources allocated to gas stations, where m represents the total number of gas stations, n represents the total number of transport vehicles, and x represents the total number of vehicles. ij Indicate whether the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station. ij This represents the CNG load of the i-th transport vehicle when its destination is the j-th gas station.

[0139] The destination constraint for the transport vehicle is expressed by the following formula:

[0140]

[0141] x ij ∈{0,1};

[0142] The loading capacity constraint of the transport vehicle is expressed by the following formula:

[0143] w ij ≤C i ;

[0144]

[0145] The capacity constraint of a gas station can be expressed by the following formula:

[0146] y ij =w ij -c ij ;

[0147]

[0148] The maximum in-transit consumption constraint for transport vehicles is expressed by the following formula:

[0149] c ij ≤w ij l ij ;

[0150] The arrival time constraint is expressed by the following formula:

[0151] TimeStart ij +TimeCost ij ≤Time j ;

[0152] The following formula represents the vehicle flow constraint at the gas station:

[0153] s j ≤station j ;

[0154] Where, x ij This indicates whether the destination of the i-th transport vehicle is the j-th gas station, m represents the total number of gas stations, and x represents the total number of gas stations. ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station. ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station; ij C represents the CNG load of the i-th transport vehicle when its destination is the j-th refueling station. i T represents the maximum CNG loading capacity of the i-th transport vehicle, n represents the total number of transport vehicles, and T represents the total number of transport vehicles. j This represents the maximum capacity of the j-th gas station. c represents the remaining CNG capacity of the j-th gas station; ij y represents the CNG consumption during transit when the i-th transport vehicle's destination is the j-th refueling station. ij This represents the CNG delivery volume when the destination of the i-th transport vehicle is the j-th refueling station; ij Indicates the maximum CNG consumption rate of the transport vehicle during transit; TimeStart ij TimeCost represents the departure time of the i-th transport vehicle when its destination is the j-th gas station. ij Time represents the transit time of the i-th transport vehicle when its destination is the j-th gas station. j This represents the agreed time when the destination of the i-th transport vehicle is the j-th gas station; s j Let the traffic flow at the j-th gas station be denoted as station. j Let be the maximum traffic flow limit for the j-th gas station.

[0155] In some embodiments of this paper, a two-dimensional matrix is ​​constructed to simulate the relationship between the transport vehicle and the destination gas station. Each element in the two-dimensional matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element. The two-dimensional matrix is ​​represented as follows:

[0156]

[0157] In the above two-dimensional matrix, the total number of transport vehicles is n, the total number of gas stations is m, and x ij Let x represent the correspondence between the i-th transport vehicle and the j-th gas station. ij When x = 1, it means that the destination of the i-th transport vehicle is the j-th gas station. ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station. Specifically, x 12 =1, indicating that vehicle number 1 is heading to gas station number 2, x 13=0, meaning that vehicle number 1 cannot go to gas station number 3, and that once the destination gas station for the vehicle is determined, the vehicle cannot go to any other gas station, i.e., x 12 When x = 1, 1j =0, where j≠2; Therefore, if the value of each element in the two-dimensional matrix is ​​determined, the correspondence between the transport vehicle and the destination can be obtained from the two-dimensional matrix. Then, by combining the load capacity of the transport vehicle when solving the two-dimensional matrix, the resource allocation scheme of compressed natural gas can be determined.

[0158] In some embodiments of this paper, multiple two-dimensional matrices are generated based on the total number of transport vehicles, the total number of gas stations, and random initial numbers. These multiple two-dimensional matrices represent multiple solutions to the correspondence between transport vehicles and destinations in the compressed natural gas resource allocation scheme. Each two-dimensional matrix needs to be used as an initial matrix. Based on the improved whale algorithm and the compressed natural gas resource allocation optimization model, these multiple initial matrices are optimized, and the optimal solution matrix is ​​found among the optimized multiple initial matrices. The optimal solution matrix represents the optimal solution to the correspondence between transport vehicles and destinations.

[0159] In one embodiment of this article, such as Figure 2 As shown, based on the total number of transport vehicles, the total number of gas stations, and random initial numbers, multiple initial matrices are generated, including:

[0160] Step 210: Based on the total number of transport vehicles and the total number of gas stations, perform a Logistic mapping on the random initial number to obtain multiple mapping values;

[0161] Step 220: Adjust the multiple mapping values ​​according to a preset threshold to obtain multiple binarized mapping values;

[0162] Step 230: Construct multiple initial matrices based on the binarized multiple mapping values.

[0163] In this embodiment, a Logistic mapping is performed on the random initial numbers based on the total number of transport vehicles and the total number of gas stations to obtain multiple mapping values ​​for constructing the initial matrix, thereby providing optimization targets for improving the whale algorithm.

[0164] In some embodiments of this paper, in order to minimize human intervention, a Logistic mapping is performed on the random initial numbers when constructing the initial matrix to obtain multiple mapping values. The formula for the Logistic mapping is as follows:

[0165] x n+1 =μx n (1-x n );

[0166] Where, x n This represents the mapping value, x. n+1This indicates the next mapping value, where μ represents the control parameter, ranging from 3.57 to 4, when x... n When representing the initial random number, x n+1 This is the first mapping value of the initial random number.

[0167] The number of mapped values ​​is determined based on the total number of transport vehicles and the total number of gas stations. Specifically, firstly, random initial numbers in the (0,1) interval are obtained. There can be one or more random initial numbers. Since this embodiment involves solving a large-scale CNG gas station resource allocation scheme, it is preferable to obtain multiple random initial numbers in the (0,1) interval to reduce the non-chaotic influence that may exist in the Logistic mapping. Non-chaotic influence means that the mapped values ​​are not random enough and may have certain patterns. Then, Logistic mapping is performed on these random initial numbers. For example, if the total number of transport vehicles is n and the total number of gas stations is m, then the dimension of each initial matrix to be constructed is n×m. When N initial matrices need to be constructed, the required data volume is n×m×N, and there are also n×m×N corresponding mapped values. Therefore, based on the total number of transport vehicles and the total number of gas stations, these random initial numbers are Logistic mapped to obtain a total of n×m×N mapped values. In order to reduce the non-chaotic influence of Logistic mapping, the mapped values ​​obtained based on all random initial numbers should be mixed distribution.

[0168] After obtaining n×m×N mapping values, these values ​​need to be adjusted to 0 or 1 so that the elements in the initial matrix reflect the correspondence between the transport vehicle and the destination gas station. This can be done using a preset threshold, such as 0.5, where values ​​greater than 0.5 are adjusted to 1 and values ​​less than 0.5 are adjusted to 0. Other thresholds can also be used, or the Sigmoid function can be employed to adjust the distribution range of the mapping values ​​to suit situations with specific requirements for the range or distribution of the mapping values. This step binarizes the mapping values, and then constructs N two-dimensional matrices of dimension n×m from the binarized values. At this point, the elements in the two-dimensional matrices do not satisfy the constraints; for example, the same transport vehicle may travel to multiple destination gas stations. Therefore, the two-dimensional matrices need to be adaptively adjusted according to the constraints of the compressed natural gas resource allocation optimization model. This can be done by traversing rows or columns, adjusting each row and column sequentially, or by other adjustment methods, to obtain two-dimensional matrices that satisfy the constraints. These constrained two-dimensional matrices are then used as the initial matrices for subsequent solutions.

[0169] In one embodiment of this article, such as Figure 3 As shown, the process of determining the preset threshold includes:

[0170] Step 310: Generate a random threshold corresponding to each mapping value;

[0171] Step 320: Determine the preset threshold corresponding to each mapping value based on the random threshold.

[0172] This embodiment considers a more preferred scheme for determining the preset threshold. By generating a random threshold for each mapping value, the generated random threshold corresponding to each mapping value is used as the preset threshold for each mapping value. When the mapping value is subsequently binarized and adjusted according to the preset threshold, the non-chaotic influence of the Logistic mapping is further eliminated.

[0173] In one embodiment of this article, such as Figure 4 As shown, the multiple initial matrices are optimized based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix, including:

[0174] Step 410: Optimize the multiple initial matrices based on the improved whale algorithm to obtain the optimized multiple initial matrices;

[0175] Step 420: Adjust the optimized initial matrices according to the constraints of the optimization model;

[0176] Step 430: Determine the optimal matrix of the optimized plurality of initial matrices based on the objective function of the optimization model;

[0177] Step 440: Determine whether the optimal matrix satisfies the first preset condition. If the determination is no, proceed to step 450; if the determination is yes, proceed to step 460.

[0178] Step 450: Continue to optimize the element distribution of the plurality of initial matrices until the first preset condition is met;

[0179] Step 460: Determine the optimal matrix as the optimal solution matrix.

[0180] This embodiment controls the process of optimizing the initial matrix using the improved whale algorithm. After each iteration, the matrix is ​​adjusted according to the constraints of the compressed natural gas resource allocation optimization model, and the effect of the optimized matrix is ​​verified according to the objective function of the compressed natural gas resource allocation optimization model, so as to ensure that the best solution matrix that meets the actual application is finally obtained through iteration.

[0181] In some embodiments described herein, the first preset condition may be a preset total amount of compressed natural gas supply, or it may be a score that combines the total amount of compressed natural gas supply and the efficiency of compressed natural gas supply. This article does not limit it.

[0182] In some embodiments described in this paper, the improved whale algorithm continuously changes the element distribution in the initial matrix when optimizing the initial matrix. For example, in the initial matrix, x ij Let x represent the correspondence between the i-th transport vehicle and the j-th gas station.12 =1,x 13 =0, x 14 =0 may be adjusted to x 12 =0, x 13 =1,x 14 =0, or x 12 =0, x 13 =0, x 14 =1, and may also adjust other elements.

[0183] In one embodiment of this article, such as Figure 5 As shown, the multiple initial matrices are optimized based on the improved whale algorithm, including:

[0184] Step 510: Generate random numbers;

[0185] Step 520: Determine whether the random number meets the second preset condition. If the determination is yes, proceed to step 530; if the determination is no, proceed to step 540.

[0186] Step 530: Determine whether the enclosing operation coefficient satisfies the third preset condition. If the determination is no, proceed to step 531. If the determination is yes, proceed to step 532.

[0187] Step 531: Perform the search operation of the improved whale algorithm;

[0188] Step 532: Perform the encirclement operation of the improved whale algorithm;

[0189] Step 540: Perform the spiral attack operation of the improved whale algorithm.

[0190] This embodiment controls the encirclement, search, and spiral attack operations of the improved whale algorithm, enabling the optimization process to integrate multiple methods to approach the optimal solution, thereby maximizing the algorithm's search effectiveness.

[0191] In some embodiments of this paper, random numbers within the interval (0,1) can be generated. The second preset condition can be a specific value, such as a random number greater than 0.3 or a random number greater than 0.6. When a random number greater than 0.7 is selected as the second preset condition, more search or encirclement operations will be used. When a random number greater than 0.5 is selected as the second preset condition, more spiral attack operations will be used. Therefore, the optimization strategy can be flexibly determined. When the random number meets the second preset condition, it is further judged whether the encirclement operation coefficient meets the third preset condition. The third preset condition can be that the encirclement operation coefficient is less than 1. That is, when the encirclement operation coefficient is less than 1 during the encirclement process, it means that other solutions have approached a certain range of the current optimal solution. It is necessary to adjust other solutions to encircle the "prey" captured by the optimal solution from various directions. When the operation coefficient is greater than 1, it means that other solutions are still a certain distance away from the current optimal solution. A search operation is performed to search for other possible "prey". Here, "prey" should be understood as the correspondence between the transport vehicle and the destination. When there is a greater reliance on the optimal solution, the third preset condition can be adjusted to have the enclosing operation coefficient less than 0.8, less than 0.7, etc., and gradually reduced. When it is necessary to reduce the reliance on the optimal solution, the third preset condition can be adjusted to have the enclosing operation coefficient less than 1.2, less than 1.3, etc., and gradually increased. The choice should be made according to the actual situation, and this paper does not impose any restrictions.

[0192] In this embodiment, the encirclement operation of the improved whale algorithm is represented by the following formula:

[0193] X′ n =X best +A×D[X n C1(X) best )];

[0194] A = 2a × rand - a;

[0195] a = 2(1 - t / maxlter);

[0196] The search operation of the improved whale algorithm is represented by the following formula:

[0197] X′ n =X rand +A×D[X n C2(X) rand )];

[0198] The spiral attack operation of the improved whale algorithm is represented by the following formula:

[0199] X′ n =D(X) n ,X best )×e blcos(2πl)×L+X best ;

[0200] Among them, X n Let X′ represent the nth initial matrix. n Let X represent the adjusted nth initial matrix. best Let D[X] represent the optimal matrix among multiple initial matrices, C1 represent the encirclement operation adjustment coefficient, C2 represent the search operation adjustment coefficient, and D[X] represent the optimal matrix among multiple initial matrices. n ,C(X best )] represents X n and C(X) best The distance is given by X, where A represents the enclosing operation coefficient, a represents the coefficient calculated by A, rand represents a random number in [0,1], t represents the t-th enclosing operation, and maxlter represents the total number of iterations of the preset enclosing operation; rand D[X] represents a random matrix among multiple initial matrices. n ,C(X rand )] represents X n and C(X) rand The distance between ); b is a constant, l is a random number on [-1,1], e bl cos(2πl) represents the shape of the spiral path, and L represents the spiral parameter, which is used to adjust the shape of the spiral path.

[0201] According to the above formula, when performing the encirclement operation of the improved whale algorithm, 'a' will gradually decrease from 2 to 0. For example, if the total number of iterations for the preset encirclement operation is set to 100, i.e., maxlter = 100, then when the encirclement operation is performed for the first time, t = 1. When the encirclement operation is performed for the second time, t = 2. At this time... When the encirclement operation is performed for the fiftieth time, t = 50. At this time, The value of 'a' affects the range of variation of the enclosing operation coefficient. According to the formula for the enclosing operation coefficient, A∈[-a,a]. Therefore, as 'a' gradually decreases from 2 to 0, A will randomly change within an increasingly smaller range, thereby gradually enclosing the optimal solution and exhibiting a certain degree of randomness in enclosing the optimal solution.

[0202] According to the above formula, when performing the search operation of the improved whale algorithm, all solutions will randomly move closer to each other in order to continuously search for "prey" within a certain range, thereby increasing the probability of finding the optimal "prey".

[0203] According to the above formula, when performing the spiral attack operation of the improved whale algorithm, all solutions will spiral around the optimal solution, paying attention to the situation near the optimal solution while also exploring other regions outward, thus effectively balancing the relationship between global optima and local optima. Furthermore, when using e... bl When the cos(2πl) function mimics the shape of a spiral path, the spiral parameter is also taken into consideration. The spiral parameter can be used to adjust the shape of the spiral path, so as to flexibly improve the spiral movement path and increase the probability of finding a better solution.

[0204] In one embodiment of this article, such as Figure 6 As shown, after performing the encirclement operation of the improved whale algorithm, the following steps are also included:

[0205] Step 610: Obtain the best encirclement operation adjustment coefficient from the historical encirclement operation adjustment coefficients;

[0206] Wherein, the optimal enclosing operation adjustment coefficient represents the enclosing operation adjustment coefficient that achieves the best optimization effect on the initial matrix;

[0207] Step 620: Generate random numbers;

[0208] Step 630: Determine whether the random number satisfies the fourth preset condition. If the determination is yes, proceed to step 640; if the determination is no, proceed to step 650.

[0209] Step 640: Update the enclosing operation adjustment factor to the optimal enclosing operation adjustment factor;

[0210] Step 650: Randomly update the encirclement operation adjustment coefficient.

[0211] This embodiment records the encirclement operation adjustment coefficients and selectively adopts the encirclement operation adjustment coefficients that achieve the best results during the iterative process of improving the whale algorithm, thereby making full use of the advantageous parameters; at the same time, the encirclement operation adjustment coefficients are selectively and randomly updated so that the encirclement operation adjustment coefficients are not limited to historical experience.

[0212] In some embodiments of this paper, achieving the best optimization effect on the initial matrix means that the total compressed natural gas supply obtained after optimizing the initial matrix has the highest improvement rate, or that the combined score of the total compressed natural gas supply and the compressed natural gas supply efficiency has the highest score improvement rate.

[0213] In some embodiments described herein, the first preset condition may be a preset total amount of compressed natural gas supply, or it may be a score that combines the total amount of compressed natural gas supply and the efficiency of compressed natural gas supply. This article does not limit it.

[0214] In some embodiments of this paper, the fourth preset condition can be a specific value. For example, when a random number greater than 0.5 is selected as the fourth preset condition, the historical best encirclement operation adjustment coefficient and the randomly updated encirclement operation adjustment coefficient will be considered in a balanced manner as the encirclement operation adjustment coefficient selected this time. When a random number greater than 0.6 is selected as the fourth preset condition, the historical best encirclement operation adjustment coefficient will be considered more as the encirclement operation adjustment coefficient selected this time in order to seek a more stable improvement effect. When a random number greater than 0.3 is selected as the fourth preset condition, the randomly updated encirclement operation adjustment coefficient will be considered more as the encirclement operation adjustment coefficient selected this time in order to seek a more breakthrough effect.

[0215] In some embodiments of this document, after randomly updating the encirclement operation adjustment coefficient, the method further includes:

[0216] When the optimization effect of the updated enclosing operation adjustment coefficient is better than that of the optimal enclosing operation adjustment coefficient, the optimal enclosing operation adjustment coefficient is adjusted to the updated enclosing operation adjustment coefficient.

[0217] When a better encirclement adjustment factor appears, it is recorded and set as the optimal encirclement adjustment factor, so as to continuously optimize the optimal encirclement adjustment factor.

[0218] In one embodiment of this article, such as Figure 7 As shown, after performing the search operation of the improved whale algorithm, the following steps are also included:

[0219] Step 710: Obtain the best search operation adjustment factor from the historical search operation adjustment factors;

[0220] Wherein, the optimal search operation adjustment coefficient represents the search operation adjustment coefficient that achieves the best optimization effect on the initial matrix;

[0221] Step 720: Generate random numbers;

[0222] Step 730: Determine whether the random number satisfies the fifth preset condition. If the determination is yes, proceed to step 740; if the determination is no, proceed to step 750.

[0223] Step 740: Update the search operation adjustment factor to the optimal search operation adjustment factor;

[0224] Step 750: Randomly update the search operation adjustment coefficient.

[0225] This embodiment records the search operation adjustment coefficients and selectively adopts the search operation adjustment coefficients that achieve the best results during the iterative process of improving the whale algorithm, thereby making full use of the advantageous parameters; at the same time, it selectively and randomly updates the search operation adjustment coefficients so that the search operation adjustment coefficients are not limited to historical experience.

[0226] In some embodiments of this paper, achieving the best optimization effect on the initial matrix means that the total compressed natural gas supply obtained after optimizing the initial matrix has the highest improvement rate, or that the combined score of the total compressed natural gas supply and the compressed natural gas supply efficiency has the highest score improvement rate.

[0227] In some embodiments of this paper, the fifth preset condition can be a specific value. For example, when a random number greater than 0.5 is selected as the fifth preset condition, the historical best search operation adjustment coefficient and the randomly updated search operation adjustment coefficient will be considered in a balanced manner as the search operation adjustment coefficient selected this time. When a random number greater than 0.6 is selected as the fifth preset condition, the historical best search operation adjustment coefficient will be considered more as the search operation adjustment coefficient selected this time in order to seek a more stable improvement effect. When a random number greater than 0.3 is selected as the fifth preset condition, the randomly updated search operation adjustment coefficient will be considered more as the search operation adjustment coefficient selected this time in order to seek a more breakthrough effect.

[0228] In some embodiments of this document, after randomly updating the search operation adjustment coefficient, the method further includes:

[0229] When the optimization effect of the updated search operation adjustment coefficient is better than that of the optimal search operation adjustment coefficient, the optimal search operation adjustment coefficient is adjusted to the updated search operation adjustment coefficient.

[0230] When a better search operation adjustment factor appears, it is recorded and set as the optimal search operation adjustment factor, so as to continuously optimize the optimal search operation adjustment factor.

[0231] In one embodiment of this article, such as Figure 8 As shown, after executing the spiral attack operation of the improved whale algorithm, the following steps are also included:

[0232] Step 810: Obtain the optimal spiral parameters from the historical spiral parameters;

[0233] Wherein, the optimal spiral parameter refers to the spiral parameter that achieves the best optimization effect on the initial matrix;

[0234] Step 820: Generate random numbers;

[0235] Step 830: Determine whether the random number satisfies the sixth preset condition. If the determination is yes, proceed to step 840; if the determination is no, proceed to step 850.

[0236] Step 840: Update the helical parameters to the optimal helical parameters;

[0237] Step 850: Randomly update the spiral parameters.

[0238] This embodiment records the spiral parameters and selectively adopts the spiral parameters that achieve the best results during the iterative process of improving the whale algorithm, thereby making full use of the advantageous parameters; at the same time, the spiral parameters are selectively and randomly updated so that the spiral parameters are not limited to historical experience.

[0239] In some embodiments of this paper, achieving the best optimization effect on the initial matrix means that the total compressed natural gas supply obtained after optimizing the initial matrix has the highest improvement rate, or that the combined score of the total compressed natural gas supply and the compressed natural gas supply efficiency has the highest score improvement rate.

[0240] In some embodiments of this paper, the sixth preset condition can be a specific value. For example, when a random number greater than 0.5 is selected as the sixth preset condition, the historical best spiral parameter and the randomly updated spiral parameter will be considered in a balanced manner as the spiral parameter selected this time. When a random number greater than 0.6 is selected as the sixth preset condition, the historical best spiral parameter will be considered more as the spiral parameter selected this time in order to seek a more stable improvement effect. When a random number greater than 0.3 is selected as the sixth preset condition, the randomly updated spiral parameter will be considered more as the spiral parameter selected this time in order to seek a more breakthrough effect.

[0241] In some embodiments of this document, after randomly updating the spiral parameters, the method further includes:

[0242] When the optimization effect of the updated spiral parameters is better than that of the optimal spiral parameters, the optimal spiral parameters are adjusted to the updated spiral parameters.

[0243] When a superior spiral parameter appears, it is recorded and set as the optimal spiral parameter to continuously optimize the optimal spiral parameter.

[0244] Based on the same inventive concept, this document also provides a resource allocation device for compressed natural gas, as described in the following embodiments. Since the principle of the resource allocation device for compressed natural gas is similar to that of the resource allocation method for compressed natural gas, the implementation of the resource allocation device for compressed natural gas can refer to the resource allocation method for compressed natural gas, and repeated details will not be elaborated further.

[0245] Specifically, such as Figure 9As shown, the compressed natural gas resource distribution device includes:

[0246] Module 910 is used to construct an optimization model for compressed natural gas resource allocation. The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum on-the-go consumption of transport vehicles, the arrival time, and the traffic flow of gas stations.

[0247] The generation module 920 is used to generate multiple initial matrices based on the total number of transport vehicles, the total number of gas stations, and a random initial number; wherein, each element in the initial matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element.

[0248] Optimization module 930 is used to optimize the multiple initial matrices based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix;

[0249] The determination module 940 is used to determine the compressed natural gas resource allocation scheme based on the optimal solution matrix.

[0250] This embodiment constructs a compressed natural gas (CNG) resource allocation optimization model and combines it with an improved whale algorithm to solve the CNG resource allocation scheme. This eliminates the need for manual planning of CNG refueling station resource allocation schemes, reduces labor costs, and improves resource allocation efficiency. At the same time, based on the advantages of the improved whale algorithm and the CNG resource allocation optimization model, it provides a solution for planning the allocation of resources for large-scale CNG refueling stations.

[0251] This paper presents a method, apparatus, and equipment for compressed natural gas (CNG) resource allocation. It constructs a CNG resource allocation optimization model with the objective function of maximizing the total CNG supply. Based on the total number of transport vehicles, the total number of refueling stations, and random initial numbers, it generates multiple initial matrices for inputting an improved whale algorithm, providing a solution objective and computational basis for applying the improved whale algorithm to solve resource allocation schemes. By solving resource allocation schemes using the improved whale algorithm and combining it with the optimization model's constraint-based solution process, a feasible solution is provided for solving large-scale resource allocation problems, thus addressing the issues of high planning costs and low efficiency in large-scale CNG refueling station resource allocation schemes.

[0252] In one embodiment of this document, a computer device is also provided for implementing the methods described in any of the above embodiments, such as... Figure 10The diagram illustrates the structure of a computer device according to an embodiment of this document. The computer device 1002 may include one or more processors 1004, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 1002 may also include any memory 1006 for storing information of any kind, such as code, settings, data, etc. Without limitation, for example, the memory 1006 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Furthermore, any memory may provide volatile or non-volatile retention of information. Furthermore, any memory may represent a fixed or removable component of the computer device 1002. In one case, when the processor 1004 executes associated instructions stored in any memory or combination of memories, the computer device 1002 may perform any operation of the associated instructions. The computer device 1002 also includes one or more drive mechanisms 1008 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.

[0253] Computer device 1002 may further include an input / output module 1010 (I / O) for receiving various inputs (via input device 1012) and providing various outputs (via output device 1014). A specific output mechanism may include a presentation device 1016 and an associated graphical user interface (GUI) 1018. In other embodiments, the input / output module 1010 (I / O), input device 1010, and output device 1014 may be omitted, and the device may function solely as a computer device within a network. Computer device 1002 may also include one or more network interfaces 1020 for exchanging data with other devices via one or more communication links 1022. One or more communication buses 1024 couple the components described above together.

[0254] The communication link 1022 can be implemented in any way, such as via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, or any combination thereof. The communication link 1022 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0255] Corresponding to Figures 1 to 8 In addition to the methods described above, this embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the above-described methods.

[0256] This embodiment also provides a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to perform the following: Figures 1 to 8 The method shown.

[0257] It should be understood that in the various embodiments of this document, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.

[0258] It should also be understood that, in the embodiments herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following associated objects have an "or" relationship.

[0259] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.

[0260] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0261] In the embodiments provided herein, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.

[0262] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described herein, depending on actual needs.

[0263] Furthermore, the functional units in the various embodiments of this document can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0264] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this paper, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this paper. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0265] This document uses specific embodiments to illustrate the principles and implementation methods of this document. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this document. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this document. Therefore, the content of this specification should not be construed as a limitation of this document.

Claims

1. A method for allocating compressed natural gas resources, characterized in that, The method includes: An optimization model for the allocation of compressed natural gas resources is constructed. The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum consumption of transport vehicles en route, the arrival time, and the traffic flow of gas stations. Based on the total number of transport vehicles, the total number of gas stations, and a random initial number, multiple initial matrices are generated; where each element in the initial matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element. The optimal solution matrix is ​​obtained by optimizing the multiple initial matrices based on the improved whale algorithm and the optimization model. Based on the optimal solution matrix, a compressed natural gas resource allocation scheme is determined.

2. The method as described in claim 1, characterized in that, The objective function can be expressed by the following formula: x ij ∈{0,1}; Where G represents the objective function, This represents the total amount of compressed natural gas resources allocated to gas stations, where m represents the total number of gas stations, n represents the total number of transport vehicles, and x represents the total number of vehicles. ij Indicate whether the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station, x ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station. ij This represents the load capacity of the i-th transport vehicle when its destination is the j-th gas station.

3. The method as described in claim 1, characterized in that, The destination constraint for the transport vehicle is expressed using the following formula: x ij ∈{0,1}; The loading capacity constraint of the transport vehicle is expressed by the following formula: In ij ≤C i ; The capacity constraint of the gas station is expressed by the following formula: y ij =w ij -c ij ; The maximum on-the-go consumption constraint for the transport vehicle is expressed by the following formula: c ij ≤w ij L ij ; The arrival time constraint is expressed using the following formula: TimeStart ij +TimeCost ij ≤Time j ; The vehicle flow constraint at the gas station is expressed by the following formula: s j ≤station j ; Where, x ij This indicates whether the destination of the i-th transport vehicle is the j-th gas station, m represents the total number of gas stations, and x represents the total number of gas stations. ij When the value is 1, it indicates that the destination of the i-th transport vehicle is the j-th gas station. ij When the value is 0, it indicates that the destination of the i-th transport vehicle is not the j-th gas station; ij C represents the load capacity of the i-th transport vehicle when its destination is the j-th gas station. i T represents the maximum loading capacity of the i-th transport vehicle, n represents the total number of transport vehicles, and T represents the total loading capacity of the transport vehicle. j This represents the maximum capacity of the j-th gas station. c represents the remaining capacity of the j-th gas station; ij y represents the amount of gas consumed en route when the i-th transport vehicle's destination is the j-th gas station. ij This represents the delivery volume when the destination of the i-th transport vehicle is the j-th gas station; ij Indicates the upper limit of the consumption rate of transport vehicles in transit; TimeStart ij TimeCost represents the departure time of the i-th transport vehicle when its destination is the j-th gas station. ij Time represents the transit time of the i-th transport vehicle when its destination is the j-th gas station. j This represents the agreed time when the destination of the i-th transport vehicle is the i-th gas station; s j Let the traffic flow at the j-th gas station be denoted as station. j Let be the maximum traffic flow limit for the j-th gas station.

4. The method as described in claim 1, characterized in that, Based on the total number of transport vehicles, the total number of gas stations, and random initial numbers, generate multiple initial matrices, including: Based on the total number of transport vehicles and the total number of gas stations, the random initial number is subjected to a Logistic mapping to obtain multiple mapping values; The multiple mapping values ​​are adjusted according to a preset threshold to obtain multiple binarized mapping values; Multiple initial matrices are constructed based on the binarized multiple mapping values.

5. The method as described in claim 4, characterized in that, The process of determining the preset threshold includes: Generate a random threshold corresponding to each mapping value; A preset threshold corresponding to each mapping value is determined based on the random threshold.

6. The method as described in claim 1, characterized in that, The multiple initial matrices are optimized based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix, including: The multiple initial matrices are optimized based on the improved whale algorithm to obtain the optimized multiple initial matrices; Based on the constraints of the optimization model, adjust the optimized initial matrices. Based on the objective function of the optimization model, determine the optimal matrix of the optimized multiple initial matrices; Determine whether the optimal matrix satisfies the first preset condition; If the determination is negative, continue to optimize the element distribution of the multiple initial matrices until the first preset condition is met; If the determination is yes, the optimal matrix is ​​determined as the optimal solution matrix.

7. The method as described in claim 6, characterized in that, The multiple initial matrices are optimized based on the improved whale algorithm, including: Generate a random number and determine whether the random number satisfies the second preset condition; If the determination is yes, when the encirclement operation coefficient meets the third preset condition, the encirclement operation of the improved whale algorithm is executed; otherwise, the search operation of the improved whale algorithm is executed. If the determination is negative, execute the spiral attack operation of the improved whale algorithm.

8. The method as described in claim 7, characterized in that, The encirclement operation of the improved whale algorithm is represented by the following formula: X′ n =X best +A×D[X n ,C1(X best )]; A = 2a × rand - a; a = 2(1 - t / maxlter); The search operation of the improved whale algorithm is represented by the following formula: X′ n =X rand +A×D[X n ,C2(X rand )]; The spiral attack operation of the improved whale algorithm is represented by the following formula: X′ n =D(X n ,X best )×e bl cos(2πl)×L+X best ; Among them, X n Let X′ represent the nth initial matrix. n Let X represent the adjusted nth initial matrix. best Let D[X] represent the optimal matrix among multiple initial matrices, C1 represent the encirclement operation adjustment coefficient, C2 represent the search operation adjustment coefficient, and D[X] represent the optimal matrix among multiple initial matrices. n ,C(X best )] represents X n and C(X) best The distance is given by X, where A represents the enclosing operation coefficient, a represents the coefficient calculated by A, rand represents a random number in [0,1], t represents the t-th enclosing operation, and maxlter represents the total number of iterations of the preset enclosing operation; rand D[X] represents a random matrix among multiple initial matrices. n ,C(X rand )] represents X n and C(X) rand The distance between ); b is a constant, l is a random number on [-1,1], e bl cos(2πl) represents the shape of the spiral path, and L represents the spiral parameter, which is used to adjust the shape of the spiral path.

9. The method as described in claim 8, characterized in that, After performing the encirclement operation of the improved whale algorithm, the method further includes: Obtain the best encirclement operation adjustment coefficient from the historical encirclement operation adjustment coefficients, where the best encirclement operation adjustment coefficient represents the encirclement operation adjustment coefficient that achieves the best optimization effect on the initial matrix; Generate a random number and determine whether the random number satisfies the fourth preset condition; If the determination is yes, update the enclosing operation adjustment factor to the optimal enclosing operation adjustment factor; If the determination is negative, the encirclement operation adjustment coefficient is updated randomly.

10. The method as described in claim 9, characterized in that, After randomly updating the encirclement operation adjustment coefficient, the process further includes: When the optimization effect of the updated enclosing operation adjustment coefficient is better than that of the optimal enclosing operation adjustment coefficient, the optimal enclosing operation adjustment coefficient is adjusted to the updated enclosing operation adjustment coefficient.

11. The method as described in claim 8, characterized in that, After performing the search operation of the improved whale algorithm, the method further includes: Obtain the best search operation adjustment coefficient from the historical search operation adjustment coefficients, where the best search operation adjustment coefficient represents the search operation adjustment coefficient that achieves the best optimization effect on the initial matrix; Generate a random number and determine whether the random number satisfies the fifth preset condition; If the determination is yes, update the search operation adjustment factor to the optimal search operation adjustment factor; If the determination is negative, the adjustment coefficient of the search operation is updated randomly.

12. The method as described in claim 11, characterized in that, After randomly updating the search operation adjustment coefficients, the process also includes: When the optimization effect of the updated search operation adjustment coefficient is better than that of the optimal search operation adjustment coefficient, the optimal search operation adjustment coefficient is adjusted to the updated search operation adjustment coefficient.

13. The method as described in claim 8, characterized in that, After executing the spiral attack operation of the improved whale algorithm, the following steps are also included: Obtain the optimal spiral parameter from the historical spiral parameters, where the optimal spiral parameter represents the spiral parameter that achieves the best optimization effect on the initial matrix; Generate a random number and determine whether the random number satisfies the sixth preset condition; If the determination is yes, update the helical parameters to the optimal helical parameters; If the determination is negative, the spiral parameters are updated randomly.

14. The method as described in claim 13, characterized in that, After randomly updating the spiral parameters, the process also includes: When the optimization effect of the updated spiral parameters is better than that of the optimal spiral parameters, the optimal spiral parameters are adjusted to the updated spiral parameters.

15. A resource distribution device for compressed natural gas, characterized in that, The device includes: A construction module is used to build an optimization model for compressed natural gas resource allocation. The optimization model includes an objective function and constraints. The objective function aims to maximize the total supply of compressed natural gas. The constraints include constraints on the destination of transport vehicles, the loading capacity of transport vehicles, the capacity of gas stations, the maximum on-the-go consumption of transport vehicles, the arrival time, and the traffic flow of gas stations. The generation module is used to generate multiple initial matrices based on the total number of transport vehicles, the total number of gas stations, and a random initial number; where each element in the initial matrix indicates whether the destination of the transport vehicle corresponding to that element is the gas station corresponding to that element. The optimization module is used to optimize the multiple initial matrices based on the improved whale algorithm and the optimization model to obtain the optimal solution matrix; The determination module is used to determine the compressed natural gas resource allocation scheme based on the optimal solution matrix.

16. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 14.

17. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor of a computer device, it implements the method according to any one of claims 1 to 14.

18. A computer program product, the computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor of a computer device, it implements the method according to any one of claims 1 to 14.