CN117762515A - Page loading method and system based on hybrid genetic algorithm - Google Patents

Page loading method and system based on hybrid genetic algorithm Download PDF

Info

Publication number
CN117762515A
CN117762515A CN202311585148.1A CN202311585148A CN117762515A CN 117762515 A CN117762515 A CN 117762515A CN 202311585148 A CN202311585148 A CN 202311585148A CN 117762515 A CN117762515 A CN 117762515A
Authority
CN
China
Prior art keywords
loading
individual
representing
fitness
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311585148.1A
Other languages
Chinese (zh)
Inventor
李建霖
王昕�
王小乾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202311585148.1A priority Critical patent/CN117762515A/en
Publication of CN117762515A publication Critical patent/CN117762515A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a page loading method and a system based on a hybrid genetic algorithm, which belong to the technical field of computers, and the method comprises the following steps: acquiring a file contained in a page to be loaded; determining the dependency relationship among the files and the loading time of each file; dividing file loading levels according to the dependency relationship among files, merging files under the same level to form a file set; determining a loading sequence according to the file set, and splicing the loading sequences under the same level to form a loading sequence set; through a genetic algorithm, taking the minimum overall loading time of a page as a target, carrying out global optimization on a loading sequence set, and determining a loading sequence optimal solution set under each level; determining a loading sequence optimal solution from a loading sequence optimal solution set by a simplex method; when loading the page to be loaded, loading the file according to the optimal solution of the loading sequence.

Description

Page loading method and system based on hybrid genetic algorithm
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a page loading method and system based on a hybrid genetic algorithm.
Background
With the continuous development of internet technology, web pages become a very important information display tool. When a client accesses a webpage, a user needs to wait for webpage resources to be rendered to be completed so as to see content information, so that the request speed of the webpage resources directly influences the browsing experience of the user, and the optimization of page loading becomes critical.
The existing webpage acceleration method mainly uses a technology of combining resource caching with parallel loading of a browser, however, the parallel loading capability of the browser is not intelligent, an optimal queue cannot be selected for file loading, and when a large number of non-cached files exist on a webpage, the problems of poor webpage acceleration effect, slow webpage response and the like can occur.
Aiming at the task scheduling problem, the existing method continuously adjusts the scheduling algorithm by converting the waiting time of the task into the priority of the task, calculates the comprehensive priority and schedules each resource, thereby improving the page loading efficiency and reducing the queue request times through the browser cache.
However, the method has single evaluation standard for the priority of the resource request task, does not consider the dependency relationship between files, and does not consider the overall loading speed of the page from the global perspective, so that the loading speed of the page cannot be fully improved.
Disclosure of Invention
The invention provides a page loading method and a system based on a hybrid genetic algorithm, which aim to solve the technical problems that the prior art has single judgment standard for the priority of a resource request task, does not consider the dependency relationship among files, and the overall loading speed of a page is not considered from the global angle, so that the loading speed of the page cannot be fully improved.
First aspect
The invention provides a page loading method based on a hybrid genetic algorithm, which comprises the following steps:
s1: acquiring a file contained in a page to be loaded;
s2: determining the dependency relationship among the files and the loading time of each file;
s3: dividing file loading levels according to the dependency relationship among files, merging files under the same level to form a file set;
s4: determining a loading sequence according to the file set, and splicing the loading sequences under the same level to form a loading sequence set;
s5: through a genetic algorithm, taking the minimum overall loading time of a page as a target, carrying out global optimization on the loading sequence set, and determining a loading sequence optimal solution set under each level;
s6: determining a loading sequence optimal solution from the loading sequence optimal solution set by a simplex method;
s7: and when the page to be loaded is loaded, loading the file according to the optimal solution of the loading sequence.
Further, the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading time length of the ith channel, and max { } represents a maximum value function;
wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
Further, the step S5 specifically includes:
s501: initializing a population, wherein the population comprises a plurality of individuals, and each individual represents a loading sequence;
s502: calculating the fitness of each individual in the population;
s503: adopting elite retention strategy to replace the individual with the lowest fitness;
s504: selecting part of individuals to perform gene crossover operation to generate new individuals;
s505: selecting part of individuals to carry out genetic variation operation to generate new individuals;
s506: judging whether a termination condition is met; if yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained; otherwise, return to S502, continue iteration.
Further, the step S505 specifically includes:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum variation probability, and f represents the fitness of the current individual; f (f) avg Represents the average fitness of the population, f max Representing a maximum fitness in the individual;
each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
Further, the step S6 specifically includes:
s601: selecting top M individuals with top fitness from the loading sequence optimal solution set to form the top of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
S602: from the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Representing the fitness of the ith vertex, i=1, 2, …, M, M representing the total number of vertices of the simplex, M W Representing a worst mapping scheme, and θ represents a preset difference value;
s603: calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ representing a difference operation;
s604: when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1;
S605: when f (M) R )<f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma representing the expansion coefficient;
s606: when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, using the reflection point M R Replacing the current individual;
s607: when f (M) R )≥f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ representing the coefficient of contraction;
s608: when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the individual to the optimal individual, reconstructing the simplex configuration, and iterating;
s609: judging whether a termination condition is met; if so, taking the optimal simplex vertex as the optimal solution of the loading sequence, and outputting the optimal solution of the loading sequence; otherwise, returning to S602, iteration is continued.
Second aspect
The invention provides a page loading system based on a hybrid genetic algorithm, which comprises:
the acquisition module is used for acquiring files contained in the page to be loaded;
the determining module is used for determining the dependency relationship among the files and the loading time length of each file;
the division module is used for dividing file loading levels according to the dependency relationship among the files, merging the files under the same level, and forming a file set;
the splicing module is used for determining a loading sequence according to the file set and splicing the loading sequences under the same level to form a loading sequence set;
the global optimizing module is used for carrying out global optimizing on the loading sequence set by taking the minimum loading time of the whole page as a target through a genetic algorithm, and determining a loading sequence optimal solution set under each level;
the local optimizing module is used for determining a loading sequence optimal solution from the loading sequence optimal solution set through a simplex method;
and the loading module is used for loading the file according to the optimal solution of the loading sequence when loading the page to be loaded.
Further, the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading time length of the ith channel, and max { } represents a maximum value function;
wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
Further, the global optimizing module is specifically configured to:
initializing a population, wherein the population comprises a plurality of individuals, and each individual represents a loading sequence;
calculating the fitness of each individual in the population;
adopting elite retention strategy to replace the individual with the lowest fitness;
selecting part of individuals to perform gene crossover operation to generate new individuals;
selecting part of individuals to carry out genetic variation operation to generate new individuals;
judging whether a termination condition is met; if yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained; otherwise, returning to continue iteration.
Further, the global optimizing module is specifically configured to:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum variation probability, and f represents the fitness of the current individual; f (f) avg Represents the average fitness of the population, f max Representing a maximum fitness in the individual;
each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
Further, the local optimizing module is specifically configured to:
selecting top M individuals with top fitness from the loading sequence optimal solution set to form the top of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
From the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Representing the fitness of the ith vertex, i=1, 2, …, M, M representing the total number of vertices of the simplex, M W Representing a worst mapping scheme, and θ represents a preset difference value;
calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ representing a difference operation;
when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1;
When f (M) R )<f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma representing the expansion coefficient;
when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, using the reflection point M R Replacing the current individual;
when f (M) R )≥f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ representing the coefficient of contraction;
when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the individual to the optimal individual, reconstructing the simplex configuration, and iterating;
judging whether a termination condition is met; if so, taking the optimal simplex vertex as the optimal solution of the loading sequence, and outputting the optimal solution of the loading sequence; otherwise, returning to continue iteration.
Compared with the prior art, the invention has at least the following beneficial technical effects:
(1) According to the method, the device and the system, file loading levels are divided according to the dependency relationship among files, files under the same level are merged to form a file set, then a loading sequence is determined according to the file set, then optimizing is carried out on the loading sequence, the optimal solution of the loading sequence is determined to load the page, and the overall loading speed of the page is improved.
(2) In the invention, the genetic algorithm is combined with the simplex method, the global optimizing capability of the genetic algorithm is fully exerted, the simplex method is adopted to make up for the defect of local optimizing aspect of the genetic algorithm, so that the solving process has higher convergence speed, meanwhile, the stability of algorithm solving is also considered, the accurate and efficient solving of the optimal solution of the loading sequence under each level is realized, the capability of parallel loading of multiple channels of a browser is matched, and the whole resource loading time of the page is reduced.
Drawings
The above features, technical features, advantages and implementation of the present invention will be further described in the following description of preferred embodiments with reference to the accompanying drawings in a clear and easily understood manner.
FIG. 1 is a schematic flow chart of a page loading method based on a hybrid genetic algorithm;
FIG. 2 is a schematic flow chart of a genetic algorithm provided by the invention;
FIG. 3 is a schematic diagram of a page loading system based on a hybrid genetic algorithm according to the present invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will explain the specific embodiments of the present invention with reference to the accompanying drawings. It is evident that the drawings in the following description are only examples of the invention, from which other drawings and other embodiments can be obtained by a person skilled in the art without inventive effort.
For simplicity of the drawing, only the parts relevant to the invention are schematically shown in each drawing, and they do not represent the actual structure thereof as a product. Additionally, in order to simplify the drawing for ease of understanding, components having the same structure or function in some of the drawings are shown schematically with only one of them, or only one of them is labeled. Herein, "a" means not only "only this one" but also "more than one" case.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
In this context, it should be noted that the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected, unless otherwise explicitly stated and defined. Either mechanically or electrically. Can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
In addition, in the description of the present invention, the terms "first," "second," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Example 1
In one embodiment, referring to fig. 1 of the specification, a flow diagram of a page loading method based on a hybrid genetic algorithm provided by the invention is shown.
The invention provides a page loading method based on a hybrid genetic algorithm, which comprises the following steps:
s1: and acquiring a file contained in the page to be loaded.
S2: and determining the dependency relationship among the files and the loading time of each file.
Specifically, the front end SDK (Software Development Kit) package may be used to obtain the dependency relationship between static resource files and calculate the loading time of each file.
Wherein the front-end SDK package is a collection of tools, libraries, and resources that is intended to help front-end developers build, test, and deploy applications more easily.
In the invention, knowing the dependency relationship between files can help the developer optimize the loading order. The necessary core files are ensured to be loaded firstly, and then other resources depending on the files are loaded, so that the page rendering time is reduced, and the user experience is improved. Further, by knowing the dependency, unnecessary file loading can be avoided. Some files can be used only under specific conditions, unnecessary resource loading can be avoided through clear dependency, and loading time and bandwidth consumption of pages are reduced.
S3: according to the dependency relationship among the files, the file loading levels are divided, and the files under the same level are merged to form a file set.
In the invention, the files are divided into loading levels and merged into the files under the same level, so that the page loading sequence can be optimized. By loading according to the dependency and hierarchy, unnecessary waiting time can be reduced, and the page can be presented faster at the user side. Meanwhile, after the files of the same hierarchy are merged into the file set, the parallel loading capacity of the browser can be better utilized. The browser can request and load multiple files in a file set simultaneously, thereby accelerating the overall loading process.
S4: and determining a loading sequence according to the file set, and splicing the loading sequences under the same level to form a loading sequence set.
Specifically, the set of loading sequences may be used as parent gene sequences during the optimization by genetic algorithm.
S5: and (3) carrying out global optimization on the loading sequence set by taking the minimum loading time of the whole page as a target through a genetic algorithm, and determining a loading sequence optimal solution set under each level.
The genetic algorithm is an optimization algorithm simulating natural selection and genetic mechanism, and is widely used for solving the searching and optimizing problems.
In one possible implementation, the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading duration of the ith channel, max { } represents the maximum function.
Specifically, the longer the maximum file loading duration, the slower the loading speed, and the lower the fitness function. Conversely, the shorter the maximum file loading time length is, the faster the loading speed is, and the larger the fitness function is.
Wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
In the invention, the fitness function integrates the performance of the whole loading sequence set. By considering the overall loading time, it can be ensured that the genetic algorithm is optimized not only for a specific channel or file, but also for overall performance, conforming to the objective of global optimization. Meanwhile, the calculation mode of the file loading time directly reflects the actual loading time. By considering the loading time length of each file in each channel, the fitness function is closer to the actual application scene, so that the optimization result meets the actual performance requirement better.
Referring to fig. 2 of the specification, a schematic flow chart of a genetic algorithm provided by the invention is shown.
In one possible implementation, S5 specifically includes substeps S501 to S506:
s501: initializing a population.
Wherein the population comprises a plurality of individuals, each individual representing a loading sequence.
S502: and calculating the fitness of each individual in the population.
S503: and replacing the individual with the lowest fitness by adopting an elite retention strategy.
In the invention, the elite retention strategy is adopted to directly replace the individual with the lowest fitness, so that the damage to the gene sequence can be prevented, and the population average fitness can be improved.
S504: and selecting part of individuals to perform gene crossover operation to generate new individuals.
In the invention, excellent gene segments among different individuals can be combined in a crossing way through gene crossing operation, so that the aim of exploring and generating a better solution is fulfilled, and along with continuous iteration of an algorithm, the better solution is continuously generated, and finally the optimal solution is obtained.
S505: and selecting part of individuals to carry out genetic mutation operation to generate new individuals.
In the invention, some randomness is introduced in the genetic variation operation, and the diversity of the population can be increased by carrying out variation on part of individuals, thereby being beneficial to preventing the algorithm from falling into a local optimal solution and improving the global searching capability.
Optionally, in the invention, the method of combining segment crossing and point crossing is adopted to perform gene mutation operation, the segment crossing mode is adopted in the initial stage of algorithm execution, algorithm iteration can be accelerated, the point mutation method is selected and adopted in the middle and later stages of the algorithm, the optimal solution of the algorithm can be prevented from being damaged, and the local searching capability of the algorithm is improved.
In one possible implementation, S505 specifically includes:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum probability of variation, f represents the fitness of the current individual. f (f) avg Represents the average fitness of the population, f max Representing the maximum fitness in the individual.
Each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
In the present invention, individual fitness driven variation can be achieved by correlating variation probabilities with individual fitness. Individuals with higher fitness are more likely to be selected for mutation, thereby focusing on more promising areas of the search space, improving the efficiency of mutation.
S506: and judging whether a termination condition is satisfied. If yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained. Otherwise, return to S502, continue iteration.
Wherein the termination condition may be that the maximum number of iterations is reached, or that the individual fitness |f m+1 -f m The I is less than or equal to epsilon, epsilon represents a preset threshold value,
the size of the preset threshold epsilon can be set by a person skilled in the art according to actual conditions, and the invention is not limited.
According to the invention, under the condition that the overall loading time of the page is taken into account, the genetic algorithm can comprehensively consider various factors, such as file dependency relationship, file loading time and the like, so that a more comprehensive loading optimization scheme can be found, a loading sequence with the minimum overall loading time of the page can be found more effectively, the user experience is improved, and the overall loading time is reduced.
S6: and determining the optimal solution of the loading sequence from the optimal solution set of the loading sequence by a simplex method.
The simplex method is a mathematical programming method and is used for searching an optimal solution under a linear constraint condition in a multidimensional space.
The genetic algorithm is combined with the simplex method, the global optimizing capability of the genetic algorithm is fully exerted, the simplex method is adopted to make up for the defects of the genetic algorithm in the aspect of local optimizing, so that the solving process has higher convergence speed, and meanwhile, the stability of algorithm solving is also considered.
In one possible embodiment, S6 specifically includes substeps S601 to S609:
s601: selecting top M individuals with highest fitness from a loading sequence optimal solution set to form the vertex of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
S602: from the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Representing the fitness of the ith vertex, i=1, 2, …, M, M representing the total number of vertices of the simplex, M W Representing the worst mapping scheme, θ represents the preset difference.
S603: calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ represents the difference operation.
S604: when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1。
S605: when f (M) R )≥f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma represents the expansion coefficient.
S606: when f (M) E )≥f(M B ) When using a new individual M E Replacing the current individual, otherwise, using the reflection point M R Replacing the current individual.
S607: when f (M) R )<f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ represents the coefficient of contraction.
In the invention, by setting the optimizing control parameters, the expansion coefficient gamma and the compression coefficient sigma, the operations of expansion, reflection, compression and the like are carried out on the premise of ensuring the strict decrease of the objective function value, and as many potential optimal individuals are generated as possible to replace worse individuals, thereby forming a new simplex, and repeating the iteration until the search termination condition is met, and the solution of the optimal loading queue is completed.
Further, the shape of the simplex can be adjusted through operations such as reflection, expansion, replacement, contraction and the like, and the convergence rate of the algorithm can be controlled. This helps balance exploration and utilization at different stages, improving convergence efficiency.
S608: when f (M) E )≥f(M B ) And when the new individual ME is used for replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the new individual ME to the optimal individual, reconstructing the simplex configuration, and iterating.
In the present invention, by moving all but the optimal individual a half way along the direction of itself to the optimal individual, it helps to preserve diversity and avoid premature convergence to a locally optimal solution.
S609: and judging whether a termination condition is satisfied. If so, taking the optimal simplex vertex as a loading sequence optimal solution, and outputting the loading sequence optimal solution. Otherwise, returning to S602, iteration is continued.
According to the invention, the defect of local optimization of the genetic algorithm can be overcome by the simplex method, so that the solving process has higher convergence speed, meanwhile, the stability of algorithm solving is also considered, the optimal solution of the loading sequence can be more accurately and efficiently determined, and the overall loading performance of the page is improved.
S7: when loading the page to be loaded, loading the file according to the optimal solution of the loading sequence.
Compared with the prior art, the invention has at least the following beneficial technical effects:
(1) According to the method, the device and the system, file loading levels are divided according to the dependency relationship among files, files under the same level are merged to form a file set, then a loading sequence is determined according to the file set, then optimizing is carried out on the loading sequence, the optimal solution of the loading sequence is determined to load the page, and the overall loading speed of the page is improved.
(2) In the invention, the genetic algorithm is combined with the simplex method, the global optimizing capability of the genetic algorithm is fully exerted, the simplex method is adopted to make up for the defect of local optimizing aspect of the genetic algorithm, so that the solving process has higher convergence speed, meanwhile, the stability of algorithm solving is also considered, the accurate and efficient solving of the optimal solution of the loading sequence under each level is realized, the capability of parallel loading of multiple channels of a browser is matched, and the whole resource loading time of the page is reduced.
Example 2
In one embodiment, referring to fig. 3 of the specification, a schematic structural diagram of a page loading system based on a hybrid genetic algorithm provided by the invention is shown.
The invention provides a page loading system 20 based on a hybrid genetic algorithm, which comprises:
an obtaining module 201, configured to obtain a file contained in a page to be loaded;
a determining module 202, configured to determine a dependency relationship between files and a loading duration of each file;
the dividing module 203 is configured to divide a file loading level according to a dependency relationship between files, and merge files under the same level to form a file set;
the splicing module 204 is configured to determine a loading sequence according to the file set, and splice the loading sequences under the same level to form a loading sequence set;
the global optimizing module 205 is configured to perform global optimization on the set of loading sequences by using a genetic algorithm with minimum overall loading time of a page as a target, and determine a set of better solutions of the loading sequences under each level;
the local optimizing module 206 is configured to determine a loading sequence optimal solution from the loading sequence optimal solution set by using a simplex method;
and the loading module 207 is configured to load the file according to the optimal solution of the loading sequence when loading the page to be loaded.
In one possible embodiment, the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading time length of the ith channel, and max { } represents a maximum value function;
wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
In one possible implementation, the global optimizing module 205 is specifically configured to:
initializing a population, wherein the population comprises a plurality of individuals, and each individual represents a loading sequence;
calculating the fitness of each individual in the population;
adopting elite retention strategy to replace the individual with the lowest fitness;
selecting part of individuals to perform gene crossover operation to generate new individuals;
selecting part of individuals to carry out genetic variation operation to generate new individuals;
judging whether a termination condition is met; if yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained; otherwise, returning to continue iteration.
In one possible implementation, the global optimizing module 205 is specifically configured to:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum variation probability, and f represents the fitness of the current individual; f (f) avg Represents the average fitness of the population, f max Representing a maximum fitness in the individual;
each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
In one possible implementation, the local optimization module 206 is specifically configured to:
selecting top M individuals with top fitness from the loading sequence optimal solution set to form the top of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
From the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Representing the fitness of the ith vertex, i=1, 2, …, M, M representing the total number of vertices of the simplex, M W Representing a worst mapping scheme, and θ represents a preset difference value;
calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ representing a difference operation;
when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1;
When f (M) R )<f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma representing the expansion coefficient;
when f (M) E )<f(M B ) When using a new individual M E Replace the current individual, otherwise, makeBy means of reflection points M R Replacing the current individual;
when f (M) R )≥f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ representing the coefficient of contraction;
when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the individual to the optimal individual, reconstructing the simplex configuration, and iterating;
judging whether a termination condition is met; if so, taking the optimal simplex vertex as the optimal solution of the loading sequence, and outputting the optimal solution of the loading sequence; otherwise, returning to continue iteration
The page loading system based on the hybrid genetic algorithm provided by the invention can realize the steps and effects of the page loading method based on the hybrid genetic algorithm in the embodiment 1, and in order to avoid repetition, the invention is not repeated.
Compared with the prior art, the invention has at least the following beneficial technical effects:
(1) According to the method, the device and the system, file loading levels are divided according to the dependency relationship among files, files under the same level are merged to form a file set, then a loading sequence is determined according to the file set, then optimizing is carried out on the loading sequence, the optimal solution of the loading sequence is determined to load the page, and the overall loading speed of the page is improved.
(2) In the invention, the genetic algorithm is combined with the simplex method, the global optimizing capability of the genetic algorithm is fully exerted, the simplex method is adopted to make up for the defect of local optimizing aspect of the genetic algorithm, so that the solving process has higher convergence speed, meanwhile, the stability of algorithm solving is also considered, the accurate and efficient solving of the optimal solution of the loading sequence under each level is realized, the capability of parallel loading of multiple channels of a browser is matched, and the whole resource loading time of the page is reduced.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.

Claims (10)

1. A hybrid genetic algorithm-based page loading method, comprising:
s1: acquiring a file contained in a page to be loaded;
s2: determining the dependency relationship among the files and the loading time of each file;
s3: dividing file loading levels according to the dependency relationship among files, merging files under the same level to form a file set;
s4: determining a loading sequence according to the file set, and splicing the loading sequences under the same level to form a loading sequence set;
s5: through a genetic algorithm, taking the minimum overall loading time of a page as a target, carrying out global optimization on the loading sequence set, and determining a loading sequence optimal solution set under each level;
s6: determining a loading sequence optimal solution from the loading sequence optimal solution set by a simplex method;
s7: and when the page to be loaded is loaded, loading the file according to the optimal solution of the loading sequence.
2. The hybrid genetic algorithm-based page loading method of claim 1, wherein the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading time length of the ith channel, and max { } represents a maximum value function;
wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
3. The method for loading a page based on a hybrid genetic algorithm according to claim 1, wherein S5 specifically comprises:
s501: initializing a population, wherein the population comprises a plurality of individuals, and each individual represents a loading sequence;
s502: calculating the fitness of each individual in the population;
s503: adopting elite retention strategy to replace the individual with the lowest fitness;
s504: selecting part of individuals to perform gene crossover operation to generate new individuals;
s505: selecting part of individuals to carry out genetic variation operation to generate new individuals;
s506: judging whether a termination condition is met; if yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained; otherwise, return to S502, continue iteration.
4. The method for loading a page based on a hybrid genetic algorithm as claimed in claim 3, wherein the step S505 specifically comprises:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum variation probability, and f represents the fitness of the current individual; f (f) avg Represents the average fitness of the population, f max Representing a maximum fitness in the individual;
each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
5. The method for loading a page based on a hybrid genetic algorithm according to claim 1, wherein S6 specifically comprises:
s601: selecting top M individuals with top fitness from the loading sequence optimal solution set to form the top of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
S602: from the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Indicating the fit of the ith vertexThe degree of responsibility, i=1, 2, …, M, M represents the total number of vertices of the simplex, M W Representing a worst mapping scheme, and θ represents a preset difference value;
s603: calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ representing a difference operation;
s604: when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1;
S605: when f (M) R )<f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma representing the expansion coefficient;
s606: when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, using the reflection point M R Replacing the current individual;
s607: when f (M) R )≥f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ representing the coefficient of contraction;
s608: when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the individual to the optimal individual, reconstructing the simplex configuration, and iterating;
s609: judging whether a termination condition is met; if so, taking the optimal simplex vertex as the optimal solution of the loading sequence, and outputting the optimal solution of the loading sequence; otherwise, returning to S602, iteration is continued.
6. A hybrid genetic algorithm-based page loading system, comprising:
the acquisition module is used for acquiring files contained in the page to be loaded;
the determining module is used for determining the dependency relationship among the files and the loading time length of each file;
the division module is used for dividing file loading levels according to the dependency relationship among the files, merging the files under the same level, and forming a file set;
the splicing module is used for determining a loading sequence according to the file set and splicing the loading sequences under the same level to form a loading sequence set;
the global optimizing module is used for carrying out global optimizing on the loading sequence set by taking the minimum loading time of the whole page as a target through a genetic algorithm, and determining a loading sequence optimal solution set under each level;
the local optimizing module is used for determining a loading sequence optimal solution from the loading sequence optimal solution set through a simplex method;
and the loading module is used for loading the file according to the optimal solution of the loading sequence when loading the page to be loaded.
7. The hybrid genetic algorithm based page loading system of claim 6, wherein the fitness function of the genetic algorithm is:
wherein f () represents the fitness function of the genetic algorithm, α represents the set of loading sequences, T i Representing the file loading time length of the ith channel, and max { } represents a maximum value function;
wherein, the file loading time length T of the ith channel i The calculation mode of (a) is as follows:
wherein t is ij Representing the loading time of the jth file in the ith channel, j=1, 2, …, n i ,n i Indicating the total number of files to be loaded in the ith channel.
8. The hybrid genetic algorithm based page loading system of claim 6, wherein the global optimization module is specifically configured to:
initializing a population, wherein the population comprises a plurality of individuals, and each individual represents a loading sequence;
calculating the fitness of each individual in the population;
adopting elite retention strategy to replace the individual with the lowest fitness;
selecting part of individuals to perform gene crossover operation to generate new individuals;
selecting part of individuals to carry out genetic variation operation to generate new individuals;
judging whether a termination condition is met; if yes, global optimization of the loading sequence set is completed, and a loading sequence optimal solution set under each level is obtained; otherwise, returning to continue iteration.
9. The hybrid genetic algorithm based page loading system of claim 8, wherein the global optimization module is specifically configured to:
determining the mutation probability of each individual:
wherein P represents the mutation probability of the current individual, P max Represents the maximum mutation probability, P min Representing the minimum variation probability, and f represents the fitness of the current individual; f (f) avg Represents the average fitness of the population, f max Representing a maximum fitness in the individual;
each individual is subjected to genetic mutation operation according to mutation probability, and a new individual is generated.
10. The hybrid genetic algorithm based page loading system of claim 6, wherein the local optimization module is specifically configured to:
selecting top M individuals with top fitness from the loading sequence optimal solution set to form the top of the simplex, wherein the individual with highest fitness is an optimal mapping scheme M B The second highest fitness individual is sub-optimal mapping scheme M S The individual with the lowest fitness is the worst mapping scheme M W
From the vertex set, the reflection center M of the simplex is calculated C
Wherein M is C Represents the reflection center, f (M C ) Indicating the fitness of the reflection center, f avg Represents the average fitness, M i Represents the ith vertex, f (M i ) Representing the fitness of the ith vertex, i=1, 2, …, M, M representing the total number of vertices of the simplex, M W Representing a worst mapping scheme, and θ represents a preset difference value;
calculating the difference between each vertex and the reflection center:
V i =M i ΘM C
wherein V is i Representing the difference between the ith vertex and the reflection center, M i Representing the ith vertex, Θ representing a difference operation;
when the current vertex satisfies f (M W )<f(M i )<f(M C ) Then calculate the reflection center M C Is a reflection point M of (2) R
Wherein M is R Represents the emission point, P 0 Representing evolution parameters, 0 < P 0 <1;
When f (M) R )<f(M B ) In the process, the expansion operation is carried out to obtain a new individual M E
Wherein M is E Representing a new individual, gamma representing the expansion coefficient;
when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, using the reflection point M R Replacing the current individual;
when f (M) R )≥f(M B ) At the time, a contracting operation is performed to obtain a new individual M E
Wherein M is E Representing a new individual, σ representing the coefficient of contraction;
when f (M) E )<f(M B ) When using a new individual M E Replacing the current individual, otherwise, all the individuals except the optimal individual move a half distance along the direction from the individual to the optimal individual, reconstructing the simplex configuration, and performingIterating;
judging whether a termination condition is met; if so, taking the optimal simplex vertex as the optimal solution of the loading sequence, and outputting the optimal solution of the loading sequence; otherwise, returning to continue iteration.
CN202311585148.1A 2023-11-24 2023-11-24 Page loading method and system based on hybrid genetic algorithm Pending CN117762515A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311585148.1A CN117762515A (en) 2023-11-24 2023-11-24 Page loading method and system based on hybrid genetic algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311585148.1A CN117762515A (en) 2023-11-24 2023-11-24 Page loading method and system based on hybrid genetic algorithm

Publications (1)

Publication Number Publication Date
CN117762515A true CN117762515A (en) 2024-03-26

Family

ID=90317166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311585148.1A Pending CN117762515A (en) 2023-11-24 2023-11-24 Page loading method and system based on hybrid genetic algorithm

Country Status (1)

Country Link
CN (1) CN117762515A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117675961A (en) * 2023-11-28 2024-03-08 江苏慧铭信息科技有限公司 Communication transmission data management method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117675961A (en) * 2023-11-28 2024-03-08 江苏慧铭信息科技有限公司 Communication transmission data management method and system
CN117675961B (en) * 2023-11-28 2024-06-25 江苏慧铭信息科技有限公司 Communication transmission data management method and system

Similar Documents

Publication Publication Date Title
CN110197258B (en) Neural network searching method, image processing device, neural network searching apparatus, image processing apparatus, and recording medium
De Boer et al. A tutorial on the cross-entropy method
US8700548B2 (en) Optimization technique using evolutionary algorithms
CN113574325B (en) Method and system for controlling an environment by selecting a control setting
CN117762515A (en) Page loading method and system based on hybrid genetic algorithm
KR20190086134A (en) Method and apparatus for selecting optiaml training model from various tarining models included in neural network
CN112765477B (en) Information processing method and device, information recommendation method and device, electronic equipment and storage medium
US8412494B2 (en) Optimal solution relation display apparatus and optimal solution relation display method
CN111694664B (en) Calculation unloading distribution method of edge server
US20170083873A1 (en) Infeasible schedules in a quantum annealing optimization process
CN108875955A (en) Gradient based on parameter server promotes the implementation method and relevant device of decision tree
US20050021317A1 (en) Fast feature selection method and system for maximum entropy modeling
CN111612528A (en) Method, device and equipment for determining user classification model and storage medium
CN115994567B (en) Asynchronous scheduling method for parallel computing tasks of deep neural network model
CN109558898B (en) Multi-choice learning method with high confidence based on deep neural network
CN111338765B (en) Virtual machine deployment method, device, equipment and storage medium based on cat swarm algorithm
CN116321299A (en) Internet of vehicles task unloading and resource allocation method based on MEC under information age constraint
CN112165721B (en) Multi-service task unloading and service migration method based on edge computing
US9841990B2 (en) Encoding of a schedule into a binary structure
CN112256422A (en) Heterogeneous platform task scheduling method and system based on Q learning
CN116915869A (en) Cloud edge cooperation-based time delay sensitive intelligent service quick response method
Romero et al. SkyFlow: Heterogeneous streaming for skyline computation using flowgraph and SYCL
CN111813525B (en) Heterogeneous system workflow scheduling method
Esfahanizadeh et al. Stream iterative distributed coded computing for learning applications in heterogeneous systems
JP5416659B2 (en) Information storage search device, information storage method, and information storage program

Legal Events

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