Extreme value searching method and device, electronic equipment and storage medium

By using adaptive inertial weights in the particle swarm optimization algorithm, combining the initial weight, attenuation factor and iteration times, the problem of imbalance in particle swarm search capabilities is solved, and the search speed and accuracy of the extreme value of the function is improved.

CN120012816APending Publication Date: 2025-05-16SHANGHAI YINRONG INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510094708.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-16

Smart Images

  • Figure CN120012816A_ABST
    Figure CN120012816A_ABST
Patent Text Reader

Abstract

The invention provides an extreme value searching method and device, electronic equipment and a storage medium, and the method comprises the steps: searching function values at a searching position at a searching speed through employing a plurality of random particles generated according to an independent variable value interval, and obtaining an individual optimal solution and a global optimal solution; attenuating the initial weight according to the initial weight, the attenuation factor and the number of iterations to obtain an inertia weight; updating the search speed according to the inertia weight, the individual optimal solution and the global optimal solution; updating the search position according to the updated search speed and search position; updating the number of iterations; when the number of iterations is smaller than the preset number of iterations, triggering and executing the step of searching function values at the search position at the search speed by using the plurality of random particles to obtain an individual optimal solution and a global optimal solution; and when the number of iterations is equal to the preset number of times, the global optimal solution is determined as the function extreme value, so that the global search capability of the particles is ensured, the local search capability of the particles is also considered, and the speed and the accuracy of searching the function extreme value are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of evolutionary computing technology, and in particular to an extreme value finding method, device, electronic equipment and storage medium. Background Art

[0002] In the particle swarm optimization (PSO) algorithm, the search speed of particles is controlled by inertia weight to find the function extreme value in the search space. However, if the inertia weight is too large, the particle swarm is relatively scattered, the global search ability is strong, but the local search ability is weak, and the function extreme value searched by the particles may not be the accurate function extreme value; if the inertia weight is too small, the particle swarm will be relatively concentrated, the local search ability is strong, but the global search ability is weak, and it is impossible to quickly find the function extreme value in the search space. Therefore, how to ensure the global search ability of particles while taking into account the local search ability of particles to improve the speed and accuracy of finding the function extreme value is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The present invention provides an extreme value searching method, device, electronic device and storage medium, which can solve the problem of low searching speed and accuracy of function extreme values.

[0004] According to a first aspect of the present invention, there is provided a method for finding an extreme value, the method comprising:

[0005] Get the function's independent variable value interval, initial weight, decay factor, number of iterations, search speed, and search position;

[0006] Generate a plurality of random particles according to the independent variable value interval;

[0007] Using the plurality of random particles to search for a function value at the search position at the search speed, to obtain an individual optimal solution and a global optimal solution;

[0008] According to the initial weight, the attenuation factor and the number of iterations, attenuating the initial weight to obtain an inertia weight;

[0009] updating a search speed according to the inertia weight, the individual optimal solution and the global optimal solution;

[0010] updating the search position according to the updated search speed and the search position;

[0011] Updating the number of iterations, and determining whether the number of iterations is less than a preset number;

[0012] When the number of iterations is less than a preset number, triggering the step of searching for function values ​​at the search position using the multiple random particles at the search speed to obtain an individual optimal solution and a global optimal solution;

[0013] When the number of iterations is equal to a preset number, the global optimal solution is determined as the function extreme value of the function.

[0014] According to a second aspect of the present invention, there is provided an extreme value finding device, the device comprising:

[0015] Parameter acquisition module, used to obtain the function's independent variable value interval, initial weight, attenuation factor, number of iterations, search speed and search position;

[0016] A particle generation module, used for generating a plurality of random particles according to the independent variable value interval;

[0017] A function value search module, used to use the multiple random particles to search for function values ​​at the search position at the search speed to obtain an individual optimal solution and a global optimal solution;

[0018] A weight decay module, used for decaying the initial weight to obtain an inertia weight according to the initial weight, the decay factor and the number of iterations;

[0019] A speed updating module, used for updating the search speed according to the inertia weight, the individual optimal solution and the global optimal solution;

[0020] A position updating module, used for updating the search position according to the updated search speed and the search position;

[0021] A times updating module, used to update the number of iterations and determine whether the number of iterations is less than a preset number;

[0022] A trigger module, configured to trigger, when the number of iterations is less than a preset number, the step of searching for a function value at the search position using the plurality of random particles at the search speed to obtain an individual optimal solution and a global optimal solution;

[0023] The extreme value determination module is used to determine the global optimal solution as the function extreme value of the function when the number of iterations is equal to a preset number.

[0024] According to a third aspect of the present invention, there is provided an electronic device, comprising a processor and a memory.

[0025] The memory is used to store codes and related data;

[0026] The processor is used to execute the code in the memory to implement the extreme value finding method as described in any one of the embodiments of the present invention.

[0027] According to a fourth aspect of the present invention, there is provided a storage medium on which a computer program is stored, and when the program is executed by a processor, the extreme value finding method as described in any one of the embodiments of the present invention is implemented.

[0028] In an embodiment of the present invention, an independent variable value interval, an initial weight, an attenuation factor, a number of iterations, a search speed, and a search position of a function are obtained; a plurality of random particles are generated according to the independent variable value interval; a function value is searched at a search position at a search speed using the plurality of random particles to obtain an individual optimal solution and a global optimal solution; the initial weight is attenuated according to the initial weight, the attenuation factor, and the number of iterations to obtain an inertia weight; the search speed is updated according to the inertia weight, the individual optimal solution, and the global optimal solution; the search position is updated according to the updated search speed and search position; the number of iterations is updated, and it is determined whether the number of iterations is less than a preset number; when the number of iterations is less than the preset number, the step of searching the function value at the search position at a search speed using the plurality of random particles to obtain an individual optimal solution and a global optimal solution is triggered; when the number of iterations is equal to the preset number, the global optimal solution is determined as the function extreme value of the function. That is, the present invention determines the inertia weight through the initial weight, the decay factor and the number of iterations. The inertia weight is not an unchangeable fixed quantity, but an adaptive variable. In the early stage of particle search, a larger adaptive inertia weight can be obtained through the initial weight, the decay factor and the number of iterations, so that the particles can search quickly in the early stage of search and find the vicinity of the global optimal solution through the adaptive inertia weight. Then, in the subsequent search process, a smaller adaptive inertia weight can be obtained by adjusting the initial weight, the decay factor and the number of iterations, so that the particles can accurately find the function extreme value around the global optimal solution through the adaptive inertia weight, and the balance between the early stage of global search and the late stage of local search is achieved, that is, the global search ability of the particles is guaranteed, and the local search ability of the particles is taken into account, and the speed and accuracy of finding the function extreme value are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 is a flow chart of an extreme value finding method provided by an embodiment of the present invention;

[0031] Figure 2 is a schematic diagram of inertia weight provided by an embodiment of the present invention;

[0032] Figure 3 A function graph of multiple random particle searches when the number of iterations is 50;

[0033] Figure 4 A schematic diagram of the number of updates of the search speed corresponding to finding the function extreme value using a fixed inertia weight;

[0034] Figure 5 A function graph of multiple random particle searches when the number of updates is 50;

[0035] Figure 6 A schematic diagram of the number of iterations corresponding to finding the function extremum using adaptive inertia weights;

[0036] Figure 7 is a structural schematic diagram of an extreme value finding device provided by an embodiment of the present invention;

[0037] Figure 8 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] The terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0040] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0041] Figure 1 1 is a flow chart of an extreme value search method provided by an embodiment of the present invention. The method can be executed by an extreme value search device, which can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated in an electronic device, such as a computer, a server, etc. The following embodiments will be described by taking the device integrated in an electronic device as an example. Figure 1, the method may specifically include the following steps:

[0042] Step 101, obtaining the function's independent variable value interval, initial weight, attenuation factor, number of iterations, search speed, and search position.

[0043] Among them, the function can be a continuous function. The independent variable value interval can be understood as the numerical interval corresponding to the independent variable of the function. The initial weight can be understood as a preset fixed weight. The attenuation factor can be understood as a numerical value used to attenuate the initial weight, and the attenuation factor can be an arbitrary numerical value. The number of iterations can be understood as the number of attenuations of the preset initial weight. The search speed can be understood as the search speed of the particle in the independent variable value interval to find the function extreme value. The search position can be understood as the search position of the particle in the independent variable value interval to find the function extreme value.

[0044] Step 102, generating a plurality of random particles according to the independent variable value interval.

[0045] In an optional implementation, a plurality of random particles belonging to the independent variable value interval may be generated according to the independent variable value interval.

[0046] Step 103, using multiple random particles to search for function values ​​at a search position at a search speed to obtain an individual optimal solution and a global optimal solution.

[0047] Among them, the individual optimal solution can be understood as the function extreme value found by a single random particle within the interval of independent variable values. The global optimal solution can be understood as the function extreme value found by all random particles within the interval of independent variable values.

[0048] Step 104, according to the initial weight, the attenuation factor and the number of iterations, the initial weight is attenuated to obtain the inertia weight.

[0049] In an optional implementation, the initial weight, the decay factor, and the number of iterations may be substituted into the weight decay function to obtain the inertia weight;

[0050] The weight decay function is as follows:

[0051] w=w0×(u) n

[0052] Among them, w represents the inertia weight, w0 represents the initial weight, u represents the attenuation factor, n represents the number of iterations, and the initial value of n can be 0 or any other integer, which is not specifically limited in the embodiment of the present invention.

[0053] In an embodiment of the present invention, the initial weight, the attenuation factor and the number of iterations are substituted into the weight attenuation function to obtain the inertia weight. It can be seen from the weight attenuation function that in the process of inertia weight attenuation, the initial weight and the attenuation factor remain unchanged. In the early stage of particle search, the number of iterations is small. The initial weight, the attenuation factor and the number of iterations can be used to obtain a larger adaptive inertia weight, so that the particles can search quickly in the early stage of the search and find the vicinity of the global optimal solution through the adaptive inertia weight. Then, in the subsequent search process, the number of iterations becomes larger and larger. The initial weight, the attenuation factor and the number of iterations can be adjusted to obtain a smaller adaptive inertia weight, so that the particles can accurately find the function extreme value around the global optimal solution through the adaptive inertia weight, thereby achieving a balance between the early stage of global search and the late stage of local search.

[0054] For example, the attenuation factor may be The attenuation factor is When Figure 2 It can be seen that with the increase of the number of iterations, the inertia weight obtained in the early stage of the search is larger, the particle swarm is more dispersed, and the global search ability is stronger. The inertia weight obtained at the end of the search is smaller, the particle swarm is more concentrated, and the local search ability is stronger. It can quickly find the function extreme value in the search space, which ensures the global search ability of the particles and takes into account the local search ability of the particles, thereby improving the speed and accuracy of finding the function extreme value.

[0055] Step 105, updating the search speed according to the inertia weight, the individual optimal solution and the global optimal solution.

[0056] In an optional implementation, the inertia weight, the individual optimal solution, and the global optimal solution may be substituted into the speed update formula to obtain an updated search speed;

[0057] The speed update formula is as follows:

[0058] V i =w×v i (t)+c1×r1×(pbest i -x i (t))+c2×r2

[0059] ×(gbest i -x i (t))

[0060] Where t represents the time, V i represents the search speed of particle i after update, w represents the inertia weight, v i (t) represents the search speed of particle i at time t, c1 represents the self-learning factor, r1 represents the first random number, pbest i represents the individual optimal solution of particle i, xi (t) represents the search position of particle i at time t, c2 represents the self-learning factor, r2 represents the second random number, gbest i represents the global optimal solution of the group.

[0061] Step 106: Update the search position according to the updated search speed and search position.

[0062] In an optional implementation, the updated search speed and search position may be substituted into the position update formula to obtain an updated search position;

[0063] The position update formula is as follows:

[0064] X i =x i (t)+V i

[0065] Among them, X i represents the updated search position of particle i, x i (t) represents the search position of particle i at time t, V i Represents the search speed of particle i after update.

[0066] Step 107, update the number of iterations, and determine whether the number of iterations is less than a preset number, if so, return to step 103; if not, execute step 108.

[0067] In an optional implementation, the number of iterations may be updated according to the number of iterations and a preset value.

[0068] Specifically, each time the inertia weight is attenuated, the number of iterations increases by a preset value, and the preset value may be 1 or any other integer, and the embodiment of the present invention does not make any specific limitation.

[0069] Step 108: determine the global optimal solution as the function extreme value of the function.

[0070] In the embodiment of the present invention, the inertia weight is determined by the initial weight, the attenuation factor and the number of iterations. The inertia weight is not an unchangeable fixed quantity, but an adaptive variable. In the early stage of particle search, a larger adaptive inertia weight can be obtained by the initial weight, the attenuation factor and the number of iterations, so that the particles can search quickly in the early stage of search and find the vicinity of the global optimal solution through the adaptive inertia weight. Then, in the subsequent search process, the initial weight, the attenuation factor and the number of iterations can be adjusted to obtain a smaller adaptive inertia weight, so that the particles can accurately find the function extreme value around the global optimal solution through the adaptive inertia weight, and achieve a balance between the early stage of global search and the late stage of local search, that is, the global search ability of the particles is guaranteed, while the local search ability of the particles is taken into account, and the speed and accuracy of finding the function extreme value are improved.

[0071] In some embodiments, after using multiple random particles to search for function values ​​at a search position at a search speed to obtain an individual optimal solution and a global optimal solution, the following steps may also be included: generating a solution according to the search position and the global optimal solution: Figure 3 The function graph shown in the figure can be used to determine the dispersion degree of the particle swarm and the accuracy of the function extreme value found by the particle swarm according to the function graph, and then determine how to adjust the inertia weight according to the dispersion degree of the particle swarm and the accuracy of the function extreme value found by the particle swarm to improve the speed and accuracy of finding the function extreme value. Figure 3 The 18.301427386759844 is the search position, and 32.146195833223601 is the function extreme value.

[0072] In some embodiments, when the accuracy of the function extreme value does not meet the preset conditions, the initial weight and / or attenuation factor can be updated, triggering the step of obtaining the inertia weight by attenuating the initial weight according to the initial weight and the number of iterations. In this way, the initial weight and / or attenuation factor can be updated in time according to the accuracy requirements of the function extreme value, so that the numerical change trend of the inertia weight can quickly meet the requirements, thereby improving the speed at which the accuracy of the function extreme value meets the preset conditions.

[0073] The preset condition may be understood as a condition of the accuracy of the preset function extreme value, specifically, the number of decimal places of the function extreme value.

[0074] Figure 4 A schematic diagram of the number of updates of the search speed corresponding to finding the function extreme value using a fixed inertia weight, Figure 4 It can be seen that after the search speed is updated 50 times, multiple random particles successfully find the function extreme value. Figure 5 This is a function graph of multiple random particle searches when the number of updates is 50. Figure 5 The gray circles in the figure represent particles, represented by Figure 5It can be seen that at the end of the local search, the particle group is relatively concentrated, the local search ability is strong, but the global search ability is weak, and the function extreme value found by multiple random particles in the search space is not the accurate function extreme value. Figure 5 It can be seen that when the fixed inertia weight is used and the search position is 16.270970343709347, the function extreme value found is 28.578253159575489. Figure 6 is a schematic diagram of the number of iterations corresponding to the use of adaptive inertia weights to find the function extreme value. In the embodiment of the present invention, the number of iterations is the same as the number of updates of the search speed. Figure 6 It can be seen that when the number of iterations is 50, that is, after the search speed is updated 50 times, multiple random particles successfully find the function extreme value. Figure 3 This is a function graph of multiple random particle searches when the number of iterations is 50. Figure 3 The gray circles in the figure represent particles, represented by Figure 3 It can be seen that at the end of the local search, the particle swarm is relatively concentrated, and both the global search ability and the local search ability are strong, and a more accurate function extreme value can be quickly found in the search space.

[0075] Figure 7 is a schematic diagram of the structure of an extreme value finding device provided in an embodiment of the present invention, and the device is suitable for executing the extreme value finding method provided in an embodiment of the present invention. Figure 7 As shown, the device may specifically include:

[0076] Parameter acquisition module 201, used to obtain the function's independent variable value interval, initial weight, attenuation factor, number of iterations, search speed and search position;

[0077] A particle generation module 202, used to generate a plurality of random particles according to the independent variable value interval;

[0078] A function value search module 203 is used to use the multiple random particles to search for function values ​​at the search position at the search speed to obtain an individual optimal solution and a global optimal solution;

[0079] A weight decay module 204, configured to decay the initial weight to obtain an inertia weight according to the initial weight, the decay factor and the number of iterations;

[0080] A speed updating module 205, configured to update a search speed according to the inertia weight, the individual optimal solution and the global optimal solution;

[0081] A location updating module 206, configured to update the search location according to the updated search speed and the search location;

[0082] The number updating module 207 is used to update the number of iterations and determine whether the number of iterations is less than a preset number;

[0083] A trigger module 208, configured to trigger the step of searching for a function value at the search position using the plurality of random particles at the search speed to obtain an individual optimal solution and a global optimal solution when the number of iterations is less than a preset number;

[0084] The extreme value determination module 209 is used to determine the global optimal solution as the function extreme value of the function when the number of iterations is equal to a preset number.

[0085] Optionally, the weight decay module 204 is specifically configured to:

[0086] Substituting the initial weight, the attenuation factor and the number of iterations into a weight attenuation function to obtain the inertia weight;

[0087] The weight decay function is as follows:

[0088] w=w0×(u) n

[0089] Among them, w represents the inertia weight, w0 represents the initial weight, u represents the attenuation factor, and n represents the number of iterations.

[0090] Optionally, the speed updating module 205 is specifically configured to:

[0091] Substituting the inertia weight, the individual optimal solution and the global optimal solution into a speed update formula to obtain an updated search speed;

[0092] The speed update formula is as follows:

[0093] V i =w×v i (t)+c1×r1×(pbest i -x i (t))+c2×r2

[0094] ×(gbest i -x i (t))

[0095] Where t represents the time, V i represents the search speed of particle i after update, w represents the inertia weight, v i (t) represents the search speed of particle i at time t, c1 represents the self-learning factor, r1 represents the first random number, pbest i represents the individual optimal solution of particle i, x i(t) represents the search position of particle i at time t, c2 represents the self-learning factor, r2 represents the second random number, gbest i represents the global optimal solution of the group.

[0096] Optionally, the location updating module 206 is specifically configured to:

[0097] Substituting the updated search speed and the search position into a position update formula to obtain an updated search position;

[0098] The position update formula is as follows:

[0099] X i =x i (t)+V i

[0100] Among them, X i represents the updated search position of particle i, x i (t) represents the search position of particle i at time t, V i Represents the search speed of particle i after update.

[0101] Optionally, the times updating module 207 is specifically configured to:

[0102] The number of iterations is updated according to the number of iterations and a preset value.

[0103] Furthermore, the device also includes:

[0104] A function graph generating module is used to generate a function graph according to the search position and the global optimal solution.

[0105] Furthermore, the device also includes:

[0106] The initial weight updating module is used to update the initial weight and / or the attenuation factor when the accuracy of the function extreme value does not meet the preset conditions, and trigger the step of attenuating the initial weight to obtain the inertia weight according to the initial weight, the attenuation factor and the number of iterations.

[0107] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0108] The extreme value searching device provided by the embodiment of the present invention can determine the inertia weight through the initial weight, the attenuation factor and the number of iterations. The inertia weight is not an unchangeable fixed quantity, but an adaptive variable. In the early stage of particle search, a larger adaptive inertia weight can be obtained through the initial weight, the attenuation factor and the number of iterations, so that the particles can search quickly in the early stage of search and find the vicinity of the global optimal solution through the adaptive inertia weight. Then, in the subsequent search process, the initial weight, the attenuation factor and the number of iterations can be adjusted to obtain a smaller adaptive inertia weight, so that the particles can accurately find the function extreme value around the global optimal solution through the adaptive inertia weight, thereby achieving a balance between the early stage of global search and the late stage of local search, that is, ensuring the global search capability of the particles, while taking into account the local search capability of the particles, and improving the speed and accuracy of finding the function extreme value.

[0109] Figure 8 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0110] Please refer to Figure 8 , an electronic device 50 is provided, comprising:

[0111] a processor 51; and

[0112] A memory 52, used to store executable instructions of the processor;

[0113] The processor 51 is configured to execute the above-mentioned method by executing the executable instructions.

[0114] The processor 51 can communicate with the memory 52 via a bus 53 .

[0115] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned method is implemented.

[0116] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for finding an extreme value, characterized in that: The method comprises: Get the function's independent variable value interval, initial weight, decay factor, number of iterations, search speed, and search position; Generate a plurality of random particles according to the independent variable value interval; Using the plurality of random particles to search for a function value at the search position at the search speed, to obtain an individual optimal solution and a global optimal solution; According to the initial weight, the attenuation factor and the number of iterations, attenuating the initial weight to obtain an inertia weight; updating the search speed according to the inertia weight, the individual optimal solution and the global optimal solution; updating the search position according to the updated search speed and the search position; Updating the number of iterations, and determining whether the number of iterations is less than a preset number; When the number of iterations is less than a preset number, triggering the step of searching for function values ​​at the search position using the multiple random particles at the search speed to obtain an individual optimal solution and a global optimal solution; When the number of iterations is equal to a preset number, the global optimal solution is determined as the function extreme value of the function.

2. The method according to claim 1, characterized in that The step of attenuating the initial weight to obtain the inertia weight according to the initial weight, the attenuation factor and the number of iterations includes: Substituting the initial weight, the attenuation factor and the number of iterations into a weight attenuation function to obtain the inertia weight; The weight decay function is as follows: w=w0×(u) n Among them, w represents the inertia weight, w0 represents the initial weight, u represents the attenuation factor, and n represents the number of iterations.

3. The method according to claim 1, characterized in that The updating of the search speed according to the inertia weight, the individual optimal solution and the global optimal solution comprises: Substituting the inertia weight, the individual optimal solution and the global optimal solution into a speed update formula to obtain an updated search speed; The speed update formula is as follows: V i =w×v i (t)+c1×r1×(pbest i -x i (t))+c2×r2 ×(gbest i -x i (t)) Where t represents the time, V i represents the search speed of particle i after update, w represents the inertia weight, v i (t) represents the search speed of particle i at time t, c1 represents the self-learning factor, r1 represents the first random number, pbest i represents the individual optimal solution of particle i, x i (t) represents the search position of particle i at time t, c2 represents the self-learning factor, r2 represents the second random number, gbest i represents the global optimal solution of the group.

4. The method according to claim 1, characterized in that: The updating of the search position according to the updated search speed and the search position includes: Substituting the updated search speed and the search position into a position update formula to obtain an updated search position; The position update formula is as follows: X i =x i (t)+V i Among them, X i represents the updated search position of particle i, x i (t) represents the search position of particle i at time t, V i Represents the search speed of particle i after update.

5. The method according to claim 1, characterized in that The updating of the number of iterations comprises: The number of iterations is updated according to the number of iterations and a preset value.

6. The method according to claim 1, characterized in that After using the plurality of random particles to search for the function value at the search position at the search speed to obtain an individual optimal solution and a global optimal solution, the method further includes: A function graph is generated according to the search position and the global optimal solution.

7. The method according to claim 1, characterized in that The method further comprises: When the accuracy of the extreme value of the function does not meet the preset conditions, the initial weight and / or the attenuation factor is updated, triggering the step of attenuating the initial weight to obtain the inertia weight according to the initial weight, the attenuation factor and the number of iterations.

8. An extreme value finding device, characterized in that: The device comprises: Parameter acquisition module, used to obtain the function's independent variable value interval, initial weight, attenuation factor, number of iterations, search speed and search position; A particle generation module, used for generating a plurality of random particles according to the independent variable value interval; A function value search module, used to use the multiple random particles to search for function values ​​at the search position at the search speed to obtain an individual optimal solution and a global optimal solution; A weight decay module, used for decaying the initial weight to obtain an inertia weight according to the initial weight, the decay factor and the number of iterations; A speed updating module, used for updating the search speed according to the inertia weight, the individual optimal solution and the global optimal solution; A position updating module, used for updating the search position according to the updated search speed and the search position; A times updating module, used to update the number of iterations and determine whether the number of iterations is less than a preset number; A trigger module, configured to trigger, when the number of iterations is less than a preset number, the step of searching for a function value at the search position using the plurality of random particles at the search speed to obtain an individual optimal solution and a global optimal solution; The extreme value determination module is used to determine the global optimal solution as the function extreme value of the function when the number of iterations is equal to a preset number.

9. An electronic device, characterized in that: Including processor and memory, The memory is used to store codes and related data; The processor is used to execute the code in the memory to implement the extreme value finding method according to any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the extreme value finding method according to any one of claims 1 to 7 is implemented.