A page loading method and system based on a hybrid genetic algorithm

CN117762515BActive Publication Date: 2026-08-21CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311585148.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2026-08-21
Estimated Expiration
2043-11-24

AI Technical Summary

Technical Problem

[0006]为了解决现有技术对于资源请求任务优先级的评判标准单一,并未考虑到文件之间的依赖关系,同时该方法并未从全局角度考虑页面整体加载速度,因此无法充分提高页面加载速率的技术问题,本发明提供一种基于混合遗传算法的页面加载方法及系统

Benefits of technology

[0102](1)在本发明中,根据文件之间的依赖关系,划分文件加载层级,对同一层级下的文件进行归并,形成文件集合,进而根据所述文件集合,确定加载序列,之后对加载序列进行寻优,确定出加载序列最优解对页面进行加载,提升页面整体加载速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117762515B_ABST
    Figure CN117762515B_ABST
Patent Text Reader

Abstract

The application discloses a page loading method and system based on a hybrid genetic algorithm, and belongs to the technical field of computers, which comprises the following steps: obtaining files contained in a page to be loaded; determining the dependency relationship between the files and the loading duration of each file; dividing the file loading levels according to the dependency relationship between the files, merging the files under the same level, and forming a file set; determining the loading sequence according to the file set, splicing the loading sequences under the same level, and forming a loading sequence set; performing global optimization on the loading sequence set by the genetic algorithm, taking the least overall page loading time as the target, and determining the loading sequence optimal solution set under each level; determining the loading sequence optimal solution from the loading sequence optimal solution set by the simplex method; and loading the files according to the loading sequence optimal solution when loading the page to be loaded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, specifically relating to a page loading method and system based on a hybrid genetic algorithm. Background Technology

[0002] With the continuous development of internet technology, web pages have become a very important tool for displaying information. When accessing a web page on a client side, users need to wait for the web page resources to finish rendering before they can see the content. Therefore, the request speed of web page resources directly affects the user's browsing experience, making page loading optimization crucial.

[0003] Existing methods for accelerating web pages mainly use resource caching combined with browser parallel loading. However, the browser's parallel loading capability is not intelligent and cannot select the optimal queue for file loading. When a page contains a large number of non-cached files, problems such as poor web page acceleration and slow page response will occur.

[0004] To address the task scheduling problem, existing methods convert task waiting time into task priority, continuously adjust the scheduling algorithm, and calculate the overall priority before scheduling various resources, thereby improving page loading efficiency and reducing the number of queue requests through browser caching.

[0005] However, this method uses a single criterion for prioritizing resource request tasks and does not take into account the dependencies between files. Furthermore, it does not consider the overall page loading speed from a global perspective, thus failing to significantly improve page loading speed. Summary of the Invention

[0006] To address the shortcomings of existing technologies, which rely on a single criterion for prioritizing resource request tasks, fail to consider file dependencies, and do not take a global perspective on overall page loading speed, thus failing to significantly improve page loading rate, this invention provides a page loading method and system based on a hybrid genetic algorithm.

[0007] First aspect

[0008] This invention provides a page loading method based on a hybrid genetic algorithm, comprising:

[0009] S1: Get the files contained in the page to be loaded;

[0010] S2: Determine the dependencies between files and the loading time of each file;

[0011] S3: Based on the dependencies between files, divide the file loading hierarchy, merge files at the same level to form a file set;

[0012] S4: Based on the file set, determine the loading sequence, and concatenate the loading sequences at the same level to form a loading sequence set;

[0013] S5: Using a genetic algorithm, with the goal of minimizing the overall page loading time, perform a global optimization on the set of loading sequences to determine the set of optimal loading sequence solutions at each level;

[0014] S6: Determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method;

[0015] S7: When loading the page to be loaded, the file is loaded according to the optimal solution of the loading sequence.

[0016] Furthermore, the fitness function of the genetic algorithm is:

[0017]

[0018] Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function;

[0019] Wherein, the file loading time T of the i-th channel i The calculation method is as follows:

[0020]

[0021] Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

[0022] Furthermore, S5 specifically includes:

[0023] S501: Initialize the population, which consists of multiple individuals, each representing a loading sequence;

[0024] S502: Calculate the fitness of each individual in the population;

[0025] S503: Employs an elite retention strategy, replacing the individual with the lowest fitness.

[0026] S504: Select a subset of individuals for gene crossover to generate new individuals;

[0027] S505: Select a subset of individuals for genetic mutation to generate new individuals;

[0028] S506: Determine whether the termination condition is met; if yes, complete the global optimization of the loading sequence set to obtain the set of better loading sequence solutions at each level; otherwise, return to S502 and continue iterating.

[0029] Furthermore, S505 specifically includes:

[0030] Determine the mutation probability of each individual:

[0031]

[0032] Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual; avg f represents the average fitness of the population. max This represents the maximum fitness among individuals;

[0033] Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

[0034] Furthermore, S6 specifically includes:

[0035] S601: Select the top m individuals with the highest fitness ranking from the set of better solutions to the loading sequence to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M. W ;

[0036] S602: Calculate the reflection center M of the simplex based on the vertex set. C :

[0037]

[0038] Among them, M C Indicates the center of reflection, f(M) C ) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the vertices. W This represents the worst-case mapping scheme, and θ represents the preset difference.

[0039] S603: Calculate the difference between each vertex and the reflection center:

[0040] V i =Mi ΘM C

[0041] Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex, and Θ represent the difference operation.

[0042] S604: When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R :

[0043]

[0044] Among them, M R P0 represents the emission point, and P0 represents the evolution parameter, where 0 < P0 < 1;

[0045] S605: When f(M) R )<f(M B When ), perform an expansion operation to obtain a new individual M. E :

[0046]

[0047] Among them, M E This represents a new individual, and γ represents the expansion coefficient.

[0048] S606: When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual;

[0049] S607: When f(M) R )≥f(M B When ), a contraction operation is performed to obtain a new individual M. E :

[0050]

[0051] Among them, M E This represents a new individual, and σ represents the shrinkage coefficient.

[0052] S608: When f(M) E )<f(M B When using the new individual M EReplace the current individual; otherwise, all individuals except the optimal individual move half the distance from themselves in the direction to the optimal individual, reconstruct the simplex configuration, and iterate.

[0053] S609: Determine whether the termination condition is met; if yes, take the optimal simplex vertex as the optimal solution of the loading sequence and output the optimal solution of the loading sequence; otherwise, return to S602 and continue iterating.

[0054] Second aspect

[0055] This invention provides a page loading system based on a hybrid genetic algorithm, comprising:

[0056] The retrieval module is used to retrieve the files contained in the page to be loaded.

[0057] The determination module is used to determine the dependencies between files and the loading time of each file;

[0058] The partitioning module is used to divide the file loading hierarchy according to the dependencies between files, and to merge files at the same level to form a file set;

[0059] The splicing module is used to determine the loading sequence based on the file set, and splice the loading sequences at the same level to form a loading sequence set;

[0060] The global optimization module is used to perform global optimization on the loading sequence set with the goal of minimizing the overall page loading time through a genetic algorithm, and to determine the set of better loading sequence solutions at each level.

[0061] The local optimization module is used to determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method;

[0062] The loading module is used to load files according to the optimal solution of the loading sequence when loading the page to be loaded.

[0063] Furthermore, the fitness function of the genetic algorithm is:

[0064]

[0065] Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function;

[0066] Wherein, the file loading time T of the i-th channel i The calculation method is as follows:

[0067]

[0068] Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

[0069] Furthermore, the global optimization module is specifically used for:

[0070] Initialize the population, which consists of multiple individuals, each representing a loading sequence;

[0071] Calculate the fitness of each individual in the population;

[0072] An elite retention strategy is adopted, replacing the individuals with the lowest fitness.

[0073] Select a subset of individuals and perform gene crossover to generate new individuals;

[0074] Select a subset of individuals and perform genetic mutations to create new individuals;

[0075] Determine if the termination condition is met; if yes, complete the global optimization of the loading sequence set to obtain the set of better loading sequence solutions at each level; otherwise, return and continue iterating.

[0076] Furthermore, the global optimization module is specifically used for:

[0077] Determine the mutation probability of each individual:

[0078]

[0079] Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual; avg f represents the average fitness of the population. max This represents the maximum fitness among individuals;

[0080] Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

[0081] Furthermore, the local optimization module is specifically used for:

[0082] From the set of optimal solutions to the loading sequence, the top m individuals with the highest fitness ranking are selected to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M.W ;

[0083] Based on the vertex set, calculate the reflection center M of the simplex. C :

[0084]

[0085] Among them, M C Indicates the center of reflection, f(M) C ) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the vertices. W This represents the worst-case mapping scheme, and θ represents the preset difference.

[0086] Calculate the difference between each vertex and the reflection center:

[0087] V i =M i ΘM C

[0088] Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex, and Θ represent the difference operation.

[0089] When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R :

[0090]

[0091] Among them, M R P0 represents the emission point, and P0 represents the evolution parameter, where 0 < P0 < 1;

[0092] When f(M) R )<f(M B When ), perform an expansion operation to obtain a new individual M. E :

[0093]

[0094] Among them, M E This represents a new individual, and γ represents the expansion coefficient.

[0095] When f(M) E )<f(M BWhen using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual;

[0096] When f(M) R )≥f(M B When ), a contraction operation is performed to obtain a new individual M. E :

[0097]

[0098] Among them, M E This represents a new individual, and σ represents the shrinkage coefficient.

[0099] When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, all individuals except the optimal individual move half the distance from themselves in the direction to the optimal individual, reconstruct the simplex configuration, and iterate.

[0100] Determine if the termination condition is met; if so, take the optimal simplex vertex as the optimal solution of the loading sequence and output the optimal solution of the loading sequence; otherwise, return and continue iterating.

[0101] Compared with the prior art, the present invention has at least the following beneficial technical effects:

[0102] (1) In this invention, the file loading levels are divided according to the dependencies between files, and files at the same level are merged to form a file set. Then, the loading sequence is determined based on the file set, and the loading sequence is optimized to determine the optimal solution of the loading sequence to load the page, thereby improving the overall page loading speed.

[0103] (2) In this invention, a genetic algorithm is combined with the simplex method to give full play to the global optimization capability of the genetic algorithm and to make up for the shortcomings of the genetic algorithm in local optimization. This makes the solution process have a fast convergence speed and also takes into account the stability of the algorithm solution. It achieves accurate and efficient solution of the optimal solution of the loading sequence at each level. Combined with the browser's multi-channel parallel loading capability, it reduces the overall resource loading time of the page. Attached Figure Description

[0104] The preferred embodiments will now be described in a clear and easy-to-understand manner, in conjunction with the accompanying drawings, to further explain the above-mentioned characteristics, technical features, advantages, and implementation methods of the present invention.

[0105] Figure 1 This is a flowchart illustrating a page loading method based on a hybrid genetic algorithm provided by the present invention.

[0106] Figure 2 This is a flowchart illustrating a genetic algorithm provided by the present invention;

[0107] Figure 3 This is a schematic diagram of the structure of a page loading system based on a hybrid genetic algorithm provided by the present invention. Detailed Implementation

[0108] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.

[0109] To keep the drawings concise, each figure only schematically shows the parts relevant to the invention, and these do not represent the actual structure of the product. Furthermore, to facilitate understanding, in some figures, only one of components with the same structure or function is schematically depicted, or only one is labeled. In this document, "one" not only means "only one," but can also mean "more than one."

[0110] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0111] In this document, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections. They can refer to mechanical connections or electrical connections. They can refer to direct connections or indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0112] Furthermore, in the description of this invention, the terms "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0113] Example 1

[0114] In one embodiment, refer to the appendix to the specification. Figure 1 The diagram shows a flowchart of a page loading method based on a hybrid genetic algorithm provided by the present invention.

[0115] This invention provides a page loading method based on a hybrid genetic algorithm, comprising:

[0116] S1: Get the files contained in the page to be loaded.

[0117] S2: Determine the dependencies between files and the loading time of each file.

[0118] Specifically, the front-end SDK (Software Development Kit) package can be used to obtain the dependencies between static resource files and calculate the loading time of each file.

[0119] The front-end SDK package is a collection of tools, libraries, and resources designed to help front-end developers build, test, and deploy applications more easily.

[0120] In this invention, understanding the dependencies between files helps developers optimize the loading order. Ensuring that necessary core files are loaded first, followed by other resources that depend on them, helps reduce page rendering time and improve user experience. Furthermore, understanding dependencies can prevent the loading of unnecessary files. Some files may only be used under specific conditions; by clearly defining dependencies, unnecessary resource loading can be avoided, reducing page load time and bandwidth consumption.

[0121] S3: Based on the dependencies between files, divide the file loading hierarchy, merge files at the same level to form a file set.

[0122] In this invention, dividing files into loading levels and merging files at the same level helps optimize page loading order. By loading according to dependencies and levels, unnecessary waiting time can be reduced, allowing pages to be displayed to the user faster. Furthermore, merging files at the same level into a file collection allows for better utilization of the browser's parallel loading capabilities. The browser can simultaneously request and load multiple files from a file collection, thereby accelerating the overall loading process.

[0123] S4: Based on the file set, determine the loading sequence and concatenate the loading sequences at the same level to form a loading sequence set.

[0124] Specifically, in the process of optimization using genetic algorithms, the loaded sequence set can serve as the parent gene sequence.

[0125] S5: Using a genetic algorithm, with the goal of minimizing the overall page loading time, a global optimization of the loading sequence set is performed to determine the set of optimal loading sequence solutions at each level.

[0126] Among them, the genetic algorithm is an optimization algorithm that simulates the mechanisms of natural selection and inheritance, and is widely used to solve search and optimization problems.

[0127] In one possible implementation, the fitness function of the genetic algorithm is:

[0128]

[0129] Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function.

[0130] Specifically, a longer maximum file loading time means a slower loading speed and a lower fitness function. Conversely, a shorter maximum file loading time means a faster loading speed and a higher fitness function.

[0131] Wherein, the file loading time T of the i-th channel i The calculation method is as follows:

[0132]

[0133] Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

[0134] In this invention, the fitness function integrates the performance of the entire loading sequence set. By considering the overall loading time, it ensures that the genetic algorithm optimizes not only a specific channel or file, but also the overall performance, aligning with the goal of global optimization. Furthermore, the calculation method for file loading time directly reflects the actual loading time. By considering the loading time of each file in each channel, the fitness function more closely reflects real-world application scenarios, making the optimization results more consistent with actual performance requirements.

[0135] Reference manual attached Figure 2 The diagram shows a flowchart of a genetic algorithm provided by the present invention.

[0136] In one possible implementation, S5 specifically includes sub-steps S501 to S506:

[0137] S501: Initialize the population.

[0138] The population consists of multiple individuals, each representing a loading sequence.

[0139] S502: Calculate the fitness of each individual in the population.

[0140] S503: Employs an elite retention strategy, replacing individuals with the lowest fitness.

[0141] In this invention, an elite retention strategy is adopted, which directly replaces the individual with the lowest fitness, preventing damage to its gene sequence and also helping to improve the average fitness of the population.

[0142] S504: Select a subset of individuals for gene crossover to generate new individuals.

[0143] In this invention, gene crossover operations can be used to combine excellent gene fragments from different individuals to explore and generate better solutions. As the algorithm iterates, it will continuously generate better solutions and eventually obtain the optimal solution.

[0144] S505: Select a subset of individuals for genetic mutation to generate new individuals.

[0145] In this invention, gene mutation operation introduces some randomness. By mutating some individuals, the diversity of the population can be increased, which helps to prevent the algorithm from getting stuck in local optima and improves the ability of global search.

[0146] Optionally, in this invention, a combination of fragment crossover and point crossover is used to perform gene mutation operations. Fragment crossover is used in the initial stage of algorithm execution to accelerate algorithm iteration, while point mutation is used in the middle and later stages of the algorithm to avoid destroying the optimal solution of the algorithm and improve the local search capability of the algorithm.

[0147] In one possible implementation, S505 specifically includes:

[0148] Determine the mutation probability of each individual:

[0149]

[0150] Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual. avg f represents the average fitness of the population. max This represents the maximum fitness among individuals.

[0151] Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

[0152] In this invention, by correlating the mutation probability with individual fitness, fitness-driven mutation can be achieved. Individuals with higher fitness are more likely to be selected for mutation, thereby focusing the search on more promising regions in the search space and improving the efficiency of mutation.

[0153] S506: Determine if the termination condition is met. If yes, complete the global optimization of the loading sequence set to obtain the set of better loading sequence solutions at each level. Otherwise, return to S502 and continue iterating.

[0154] The termination condition can be reaching the maximum number of iterations, or the individual fitness |f m+1 -f m |≤ε, where ε represents the preset threshold value.

[0155] Those skilled in the art can set the preset threshold value ε according to the actual situation, and the present invention does not limit it.

[0156] In this invention, the genetic algorithm can take into account various factors, such as file dependencies and file loading time, while considering the overall page loading time as the objective. This helps to find a more comprehensive loading optimization scheme, and can more effectively find the loading sequence that minimizes the overall page loading time, thereby improving user experience and reducing overall loading time.

[0157] S6: Determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method.

[0158] The simplex method is a mathematical programming method used to find the optimal solution under linear constraints in a multidimensional space.

[0159] It should be noted that by combining the genetic algorithm with the simplex method, the global optimization capability of the genetic algorithm is fully utilized, while the simplex method is used to make up for the shortcomings of the genetic algorithm in local optimization. This results in a solution process that has both a fast convergence speed and good stability.

[0160] In one possible implementation, S6 specifically includes sub-steps S601 to S609:

[0161] S601: Select the top m individuals with the highest fitness ranking from the set of better solutions in the loading sequence to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M. W .

[0162] S602: Calculate the reflection center M of the simplex based on the vertex set. C :

[0163]

[0164] Among them, M C Indicates the center of reflection, f(M) C) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the vertices. W This represents the worst-case mapping scheme, and θ represents the preset difference.

[0165] S603: Calculate the difference between each vertex and the reflection center:

[0166] V i =M i ΘM C

[0167] Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex and Θ represent the difference operation.

[0168] S604: When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R :

[0169]

[0170] Among them, M R P0 represents the emission point, and P0 represents the evolution parameter, where 0 < P0 < 1.

[0171] S605: When f(M) R )≥f(M B When ), perform an expansion operation to obtain a new individual M. E :

[0172]

[0173] Among them, M E γ represents the new individual, and γ represents the expansion coefficient.

[0174] S606: When f(M) E )≥f(M B When using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual.

[0175] S607: When f(M) R )<f(M B When ), a contraction operation is performed to obtain a new individual M. E :

[0176]

[0177] Among them, M E σ represents the new individual, and σ represents the contraction coefficient.

[0178] In this invention, by setting optimization control parameters, expansion coefficient γ and compression coefficient σ, expansion, reflection and compression operations are performed under the premise of ensuring that the objective function value is strictly decreasing. This generates as many potential optimal individuals as possible to replace poor individuals, thereby forming a new simplex. This process is repeated iteratively until the search termination condition is met, thus completing the solution for the optimal loading queue.

[0179] Furthermore, by using operations such as reflection, expansion, replacement, and contraction, the shape of the simplex can be adjusted to control the convergence speed of the algorithm. This helps to balance exploration and utilization at different stages, thereby improving convergence efficiency.

[0180] S608: When f(M) E )≥f(M B If the current individual is replaced by the new individual ME, then all individuals except the optimal individual move half the distance from themselves to the optimal individual, reconstruct the simplex configuration, and iterate.

[0181] In this invention, by having all individuals except the optimal one move half the distance from themselves in the direction to the optimal one, diversity can be preserved and premature convergence to a local optimum can be avoided.

[0182] S609: Determine if the termination condition is met. If yes, use the optimal simplex vertex as the optimal solution for the loading sequence and output the optimal solution for the loading sequence. Otherwise, return to S602 and continue iterating.

[0183] In this invention, the simplex method can compensate for the shortcomings of genetic algorithms in local optimization, so that the solution process has both a faster convergence speed and the stability of the algorithm solution. This helps to determine the optimal solution of the loading sequence more accurately and efficiently, and improve the overall page loading performance.

[0184] S7: When loading a page to be loaded, load the file according to the optimal solution of the loading sequence.

[0185] Compared with the prior art, the present invention has at least the following beneficial technical effects:

[0186] (1) In this invention, the file loading levels are divided according to the dependencies between files, and files at the same level are merged to form a file set. Then, the loading sequence is determined based on the file set, and the loading sequence is optimized to determine the optimal solution for loading the page, thereby improving the overall page loading speed.

[0187] (2) In this invention, a genetic algorithm is combined with the simplex method to give full play to the global optimization capability of the genetic algorithm and to make up for the shortcomings of the genetic algorithm in local optimization. This makes the solution process have a fast convergence speed and also takes into account the stability of the algorithm solution. It achieves accurate and efficient solution of the optimal solution of the loading sequence at each level. Combined with the browser's multi-channel parallel loading capability, it reduces the overall resource loading time of the page.

[0188] Example 2

[0189] In one embodiment, refer to the appendix to the specification. Figure 3 The diagram shows a schematic of the structure of a page loading system based on a hybrid genetic algorithm provided by the present invention.

[0190] This invention provides a page loading system 20 based on a hybrid genetic algorithm, comprising:

[0191] Module 201 is used to retrieve the files contained in the page to be loaded;

[0192] Module 202 is used to determine the dependencies between files and the loading time of each file;

[0193] The partitioning module 203 is used to partition the file loading hierarchy according to the dependencies between files, and merge files at the same level to form a file set;

[0194] The splicing module 204 is used to determine the loading sequence based on the file set, and splice the loading sequences at the same level to form a loading sequence set;

[0195] The global optimization module 205 is used to perform global optimization on the loading sequence set with the goal of minimizing the overall page loading time through a genetic algorithm, and to determine the set of better solutions for the loading sequence at each level.

[0196] The local optimization module 206 is used to determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method;

[0197] The loading module 207 is used to load files according to the optimal solution of the loading sequence when loading the page to be loaded.

[0198] In one possible implementation, the fitness function of the genetic algorithm is:

[0199]

[0200] Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function;

[0201] Wherein, the file loading time T of the i-th channel i The calculation method is as follows:

[0202]

[0203] Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

[0204] In one possible implementation, the global optimization module 205 is specifically used for:

[0205] Initialize the population, which consists of multiple individuals, each representing a loading sequence;

[0206] Calculate the fitness of each individual in the population;

[0207] An elite retention strategy is adopted, replacing the individuals with the lowest fitness.

[0208] Select a subset of individuals and perform gene crossover to generate new individuals;

[0209] Select a subset of individuals and perform genetic mutations to create new individuals;

[0210] Determine if the termination condition is met; if yes, complete the global optimization of the loading sequence set to obtain the set of better loading sequence solutions at each level; otherwise, return and continue iterating.

[0211] In one possible implementation, the global optimization module 205 is specifically used for:

[0212] Determine the mutation probability of each individual:

[0213]

[0214] Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual; avg f represents the average fitness of the population. maxThis represents the maximum fitness among individuals;

[0215] Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

[0216] In one possible implementation, the local optimization module 206 is specifically used for:

[0217] From the set of optimal solutions to the loading sequence, the top m individuals with the highest fitness ranking are selected to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M. W ;

[0218] Based on the vertex set, calculate the reflection center M of the simplex. C :

[0219]

[0220] Among them, M C Indicates the center of reflection, f(M) C ) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the vertices. W This represents the worst-case mapping scheme, and θ represents the preset difference.

[0221] Calculate the difference between each vertex and the reflection center:

[0222] V i =M i ΘM C

[0223] Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex, and Θ represent the difference operation.

[0224] When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R :

[0225]

[0226] Among them, M RP0 represents the emission point, and P0 represents the evolution parameter, where 0 < P0 < 1;

[0227] When f(M) R )<f(M B When ), perform an expansion operation to obtain a new individual M. E :

[0228]

[0229] Among them, M E This represents a new individual, and γ represents the expansion coefficient.

[0230] When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual;

[0231] When f(M) R )≥f(M B When ), a contraction operation is performed to obtain a new individual M. E :

[0232]

[0233] Among them, M E This represents a new individual, and σ represents the shrinkage coefficient.

[0234] When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, all individuals except the optimal individual move half the distance from themselves in the direction to the optimal individual, reconstruct the simplex configuration, and iterate.

[0235] Determine if the termination condition is met; if yes, select the optimal simplex vertex as the optimal solution of the loading sequence and output the optimal solution of the loading sequence; otherwise, return and continue iterating.

[0236] The page loading system based on a hybrid genetic algorithm provided by this invention can achieve the steps and effects of the page loading method based on a hybrid genetic algorithm in Embodiment 1 above. To avoid repetition, this invention will not repeat them.

[0237] Compared with the prior art, the present invention has at least the following beneficial technical effects:

[0238] (1) In this invention, the file loading levels are divided according to the dependencies between files, and files at the same level are merged to form a file set. Then, the loading sequence is determined based on the file set, and the loading sequence is optimized to determine the optimal solution of the loading sequence to load the page, thereby improving the overall page loading speed.

[0239] (2) In this invention, a genetic algorithm is combined with the simplex method to give full play to the global optimization capability of the genetic algorithm and to make up for the shortcomings of the genetic algorithm in local optimization. This makes the solution process have a fast convergence speed and also takes into account the stability of the algorithm solution. It achieves accurate and efficient solution of the optimal solution of the loading sequence at each level. Combined with the browser's multi-channel parallel loading capability, it reduces the overall resource loading time of the page.

[0240] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0241] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A page loading method based on a hybrid genetic algorithm, characterized in that, include: S1: Retrieve the files contained in the page to be loaded; S2: Determine the dependencies between files and the loading time of each file; S3: Based on the dependencies between files, divide the file loading hierarchy, merge files at the same level to form a file set; S4: Based on the file set, determine the loading sequence, and concatenate the loading sequences at the same level to form a loading sequence set; S5: Using a genetic algorithm, with the goal of minimizing the overall page loading time, perform a global optimization on the set of loading sequences to determine the set of optimal loading sequence solutions at each level; S6: Determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method; S7: When loading the page to be loaded, the file is loaded according to the optimal solution of the loading sequence.

2. The page loading method based on a hybrid genetic algorithm according to claim 1, characterized in that, The fitness function of the genetic algorithm is: Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function; Wherein, the file loading time T of the i-th channel i The calculation method is as follows: Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

3. The page loading method based on a hybrid genetic algorithm according to claim 1, characterized in that, S5 specifically includes: S501: Initialize the population, which consists of multiple individuals, each representing a loading sequence; S502: Calculate the fitness of each individual in the population; S503: Employs an elite retention strategy, replacing the individual with the lowest fitness. S504: Select a subset of individuals for gene crossover to generate new individuals; S505: Select a subset of individuals for genetic mutation to generate new individuals; S506: Determine whether the termination condition is met; if yes, complete the global optimization of the loading sequence set to obtain the set of better loading sequence solutions at each level; otherwise, return to S502 and continue iterating.

4. The page loading method based on a hybrid genetic algorithm according to claim 3, characterized in that, Specifically, S505 includes: Determine the mutation probability of each individual: Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual; avg f represents the average fitness of the population. max This represents the maximum fitness among individuals; Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

5. The page loading method based on a hybrid genetic algorithm according to claim 1, characterized in that, S6 specifically includes: S601: Select the top m individuals with the highest fitness ranking from the set of better solutions to the loading sequence to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M. W ; S602: Calculate the reflection center M of the simplex based on the vertex set. C : Among them, M C Indicates the center of reflection, f(M) C ) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the vertices. W This represents the worst-case mapping scheme, and θ represents the preset difference. S603: Calculate the difference between each vertex and the reflection center: V i =M i ΘM C Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex, and Θ represent the difference operation. S604: When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R : Among them, M R P0 represents the reflection point, and P0 represents the evolutionary parameter, where 0 < P0 < 1. S605: When f(M) R )<f(M B When ), perform an expansion operation to obtain a new individual M. E : Among them, M E This represents a new individual, and γ represents the expansion coefficient. S606: When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual; S607: When f(M) R )≥f(M B When ), a contraction operation is performed to obtain a new individual M. E : Among them, M E This represents a new individual, and σ represents the shrinkage coefficient. S608: When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, all individuals except the optimal individual move half the distance from themselves in the direction to the optimal individual, reconstruct the simplex configuration, and iterate. S609: Determine whether the termination condition is met; if yes, take the optimal simplex vertex as the optimal solution of the loading sequence and output the optimal solution of the loading sequence; otherwise, return to S602 and continue iterating.

6. A page loading system based on a hybrid genetic algorithm, characterized in that, include: The retrieval module is used to retrieve the files contained in the page to be loaded. The determination module is used to determine the dependencies between files and the loading time of each file; The partitioning module is used to divide the file loading hierarchy according to the dependencies between files, and to merge files at the same level to form a file set; The splicing module is used to determine the loading sequence based on the file set, and splice the loading sequences at the same level to form a loading sequence set; The global optimization module is used to perform global optimization on the loading sequence set with the goal of minimizing the overall page loading time through a genetic algorithm, and to determine the set of better loading sequence solutions at each level. The local optimization module is used to determine the optimal solution of the loading sequence from the set of better solutions of the loading sequence using the simplex method; The loading module is used to load files according to the optimal solution of the loading sequence when loading the page to be loaded.

7. The page loading system based on a hybrid genetic algorithm according to claim 6, characterized in that, The fitness function of the genetic algorithm is: Where f() represents the fitness function of the genetic algorithm, α represents the set of loaded sequences, and T i This represents the file loading time for the i-th channel, and max{} represents the maximum value function; Wherein, the file loading time T of the i-th channel i The calculation method is as follows: Among them, t ij This represents the loading time of the j-th file in the i-th channel, where j = 1, 2, ..., n i n i This represents the total number of files that need to be loaded in the i-th channel.

8. The page loading system based on a hybrid genetic algorithm according to claim 6, characterized in that, The global optimization module is specifically used for: Initialize the population, which consists of multiple individuals, each representing a loading sequence; Calculate the fitness of each individual in the population; An elite retention strategy is adopted, replacing the individuals with the lowest fitness. Select a subset of individuals and perform gene crossover to generate new individuals; Select a subset of individuals and perform genetic mutations to create new individuals; Determine whether the termination condition is met; if so, complete the global optimization of the loading sequence set to obtain a set of better loading sequence solutions at each level. Otherwise, return and continue iterating.

9. The page loading system based on a hybrid genetic algorithm according to claim 8, characterized in that, The global optimization module is specifically used for: Determine the mutation probability of each individual: Where P represents the mutation probability of the current individual, P max P represents the maximum mutation probability. min Let f represent the minimum mutation probability, and let f represent the fitness of the current individual; avg f represents the average fitness of the population. max This represents the maximum fitness among individuals; Each individual is subjected to gene mutation operations according to the mutation probability to generate new individuals.

10. The page loading system based on a hybrid genetic algorithm according to claim 6, characterized in that, The local optimization module is specifically used for: From the set of optimal solutions to the loading sequence, the top m individuals with the highest fitness ranking are selected to form the vertices of the simplex, where the individual with the highest fitness is the optimal mapping scheme M. B The individual with the second highest fitness is the suboptimal mapping scheme M. S The individual with the lowest fitness is the worst mapping scheme M. W ; Based on the vertex set, calculate the reflection center M of the simplex. C : Among them, M C Indicates the center of reflection, f(M) C ) represents the fitness of the reflection center, f avg M represents the average fitness. i Let f(M) represent the i-th vertex. i Let represent the fitness of the i-th vertex, i = 1, 2, ..., m, where m represents the total number of vertices in the simplex, and M represents the fitness of the i-th vertex. W This represents the worst-case mapping scheme, and θ represents the preset difference. Calculate the difference between each vertex and the reflection center: V i =M i ΘM C Among them, V i M represents the difference between the i-th vertex and the reflection center. i Let θ represent the i-th vertex, and Θ represent the difference operation. When the current vertex satisfies f(M) W )<f(M i )<f(M C When ), the reflection center M is calculated. C The reflection point M R : Among them, M R P0 represents the emission point, and P0 represents the evolution parameter, where 0 < P0 < 1; When f(M) R )<f(M B When ), perform an expansion operation to obtain a new individual M. E : Among them, M E This represents a new individual, and γ represents the expansion coefficient. When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, use reflection point M. R Replace the current individual; When f(M) R )≥f(M B When ), a contraction operation is performed to obtain a new individual M. E : Among them, M E This represents a new individual, and σ represents the shrinkage coefficient. When f(M) E )<f(M B When using the new individual M E Replace the current individual; otherwise, all individuals except the optimal individual move half the distance from themselves in the direction to the optimal individual, reconstruct the simplex configuration, and iterate. Determine if the termination condition is met; if so, take the optimal simplex vertex as the optimal solution of the loading sequence and output the optimal solution of the loading sequence; otherwise, return and continue iterating.

Citation Information

Patent Citations

  • VNF deployment method and device for energy saving and QoS guarantee

    CN111538570A

  • Webpage acceleration processing method and system

    CN116484134A