CN107818365A - Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm - Google Patents
Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm Download PDFInfo
- Publication number
- CN107818365A CN107818365A CN201610819414.6A CN201610819414A CN107818365A CN 107818365 A CN107818365 A CN 107818365A CN 201610819414 A CN201610819414 A CN 201610819414A CN 107818365 A CN107818365 A CN 107818365A
- Authority
- CN
- China
- Prior art keywords
- independent variable
- value
- test function
- numerical value
- selfs
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/004—Artificial life, i.e. computing arrangements simulating life
- G06N3/006—Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域technical field
本发明涉及函数寻优领域,具体地,涉及一种融合布谷鸟搜索算法和狼群算法的测试函数寻优方法以及装置。The present invention relates to the field of function optimization, in particular to a test function optimization method and device combining cuckoo search algorithm and wolf pack algorithm.
背景技术Background technique
布谷鸟搜索算法(Cuckoo Search Algorithm,CS)是由Xin-she Yang等人通过观察神奇的大自然现象并经过人为的处理共同开发的,是一种新型元启发式搜索算法。布谷鸟搜索算法的具体步骤如下:Cuckoo Search Algorithm (CS) is a new meta-heuristic search algorithm jointly developed by Xin-she Yang et al. through observation of magical natural phenomena and artificial processing. The specific steps of the cuckoo search algorithm are as follows:
1、进行初始化设置1. Perform initialization settings
随机产生N个鸟窝的位置然后把这N个鸟窝的位置带到测试函数当中进行选择测试,经过测试就可选出最好鸟窝的位置,并将它保存留给到下一代使用。Randomly generate the positions of N bird nests Then bring the positions of the N bird's nests to the test function for a selection test. After testing, the position of the best bird's nest can be selected and saved for the next generation.
2、鸟窝位置搜索2. Bird nest location search
基于莱维飞行,通过以下位置更新公式,开始对下一代鸟窝的位置进行搜寻,以此获得一组新的鸟窝位置,再次带入到测试函数中进行测试实验,跟上一代得到的鸟窝位置进行比较之后选择最优的鸟窝位置进入下一步。Based on Levi's flight, start to search for the position of the next-generation bird's nest through the following position update formula, so as to obtain a new set of bird's nest positions, and bring them into the test function again for testing experiments, keeping up with the bird's nest obtained from the previous generation After comparing the nest positions, select the optimal bird nest position and enter the next step.
3、鸟窝位置选择3. Selection of bird nest location
将宿主发现外来蛋的概率pa=0.25与服从均匀分布的随机数r∈[0,1]相对比,如果r>pa,那么我们可以随机改变的值;否则固定不变。再用测试函数测试改变后的鸟窝位置,把测试完的鸟窝位置跟上一代的最优鸟窝位置进行对比,记录测试值最优的鸟窝位置最后选出测试值最优的鸟窝位置 Comparing the probability p a =0.25 that the host finds a foreign egg with the random number r∈[0,1] that obeys the uniform distribution, if r>p a , then we can randomly change value; otherwise, it is fixed. Then use the test function to test the changed bird’s nest position, compare the tested bird’s nest position with the optimal bird’s nest position of the previous generation, and record the bird’s nest position with the best test value Finally, select the nest position with the best test value
4、精度或者迭代判断4. Accuracy or iterative judgment
计算是否达到目标精度或者达到迭代终止条件。如果符合要求,则就是全局最优解gb,如果不符合,则要保留到下一代,返回步骤2,再进行循环迭代更新。calculate Whether the target accuracy is reached or the iteration termination condition is met. If the requirements are met, then It is the global optimal solution gb, if it does not meet, it should be kept To the next generation, return to step 2, and then update iteratively.
狼群算法主要模拟了自然界中狼的领导等级制和捕猎机理,通过模拟狼群的领导等级制将狼群划分为4种类型,如图1所示。α、β、δ被看作狼群中表现最好的前三只狼,他们引导其它的狼(ω)趋向于搜索空间中最好的区域。在整个迭代搜索过程中用α、β、δ三种狼来预测评估猎物可能位置。The wolf pack algorithm mainly simulates the leadership hierarchy and hunting mechanism of wolves in nature, and divides wolves into four types by simulating the leadership hierarchy of wolves, as shown in Figure 1. α, β, δ are regarded as the top three wolves with the best performance in the wolf pack, and they guide other wolves (ω) towards the best area in the search space. In the whole iterative search process, α, β, δ three kinds of wolves are used to predict and evaluate the possible position of the prey.
根据狼群的捕猎机理将捕猎过程划分为三个阶段:搜索猎物,包围猎物,进攻猎物,如图2所示。在狼群算法中用三个解的位置来综合评估最优解的位置,可以大大降低算法陷入局部最优的概率。According to the hunting mechanism of wolves, the hunting process is divided into three stages: searching for prey, surrounding prey, and attacking prey, as shown in Figure 2. In the wolf pack algorithm, the position of the three solutions is used to comprehensively evaluate the position of the optimal solution, which can greatly reduce the probability of the algorithm falling into a local optimum.
然而,本申请的发明人发现,在利用现有的布谷鸟搜索算法进行测试函数寻优时存在后期收敛速度慢、局部搜索能力弱和易早熟收敛的缺点。However, the inventors of the present application have found that when using the existing cuckoo search algorithm to optimize the test function, there are disadvantages of slow convergence speed, weak local search ability and premature convergence.
发明内容Contents of the invention
本发明的目的是提供一种融合布谷鸟搜索算法和狼群算法的测试函数寻优方法以及装置。其中,所述方法所要解决的技术问题是:如何解决现有的布谷鸟搜索算法进行测试函数寻优时存在后期收敛速度慢、局部搜索能力弱和易早熟收敛的问题。The purpose of the present invention is to provide a test function optimization method and device that integrates the cuckoo search algorithm and the wolf pack algorithm. Among them, the technical problem to be solved by the method is: how to solve the problems of slow convergence speed, weak local search ability and premature convergence when the existing cuckoo search algorithm optimizes the test function.
为了实现上述目的,本发明提供一种融合布谷鸟搜索算法和狼群算法的测试函数寻优方法。所述方法包括以下步骤:In order to achieve the above object, the present invention provides a test function optimization method that combines the cuckoo search algorithm and the wolf pack algorithm. The method comprises the steps of:
S1、根据所述测试函数的自变量取值范围随机生成n个第一自变量数值,并将所述n个第一自变量数值分别代入所述测试函数,得到每一第一自变量数值对应的第一测试函数值;S1. Randomly generate n first independent variable values according to the independent variable value range of the test function, and respectively substitute the n first independent variable values into the test function to obtain the corresponding value of each first independent variable value The first test function value of ;
S2、根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,并将所述n个第二自变量数值分别代入所述测试函数,得到每一第二自变量数值对应的第二测试函数值;S2. According to the Levy flight mechanism, the values of the n first independent variables are respectively updated to obtain n corresponding values of the second independent variables, and the values of the n second independent variables are respectively substituted into the test function, obtaining a second test function value corresponding to each second independent variable value;
S3、将每一第一自变量数值对应的第一测试函数值与对应的第二自变量数值的第二测试函数值进行比较,保留函数值较小者对应的自变量数值,得到n个第三自变量数值;S3. Comparing the first test function value corresponding to each first independent variable value with the second test function value corresponding to the second independent variable value, and retaining the independent variable value corresponding to the smaller function value to obtain nth number Three independent variable values;
S4、根据预设的发现概率对所述n个第三自变量数值分别进行更新,得到n个第四自变量数值;S4. Respectively update the values of the n third independent variables according to the preset discovery probability to obtain n values of the fourth independent variable;
S5、判断迭代次数是否达到预设的迭代次数;若否,则执行步骤S6;若是,则执行步骤S7;S5. Determine whether the number of iterations reaches the preset number of iterations; if not, execute step S6; if yes, execute step S7;
S6、根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,及将包含分配后的所述m个第四自变量数值和所述新的自变量数值的n个自变量数值作为n个第一自变量数值,并返回步骤S1,其中,n和m分别为常数;S6. Select m fourth independent variable values from the n fourth independent variable values according to the fourth test function values respectively corresponding to the n fourth independent variable values, and select m fourth independent variable values for the m fourth independent variable values performing weighted evaluation to obtain a new independent variable value, and assigning the m fourth independent variable values and the new independent variable values to number positions respectively, and including the assigned m fourth independent variable values The variable values and the n independent variable values of the new independent variable values are used as n first independent variable values, and return to step S1, wherein n and m are constants respectively;
S7、输出最小的第四测试函数值和最小的第四测试函数值对应的第四自变量数值。S7. Outputting the smallest fourth test function value and the fourth independent variable value corresponding to the smallest fourth test function value.
可选地,所述根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,包括:Optionally, according to the Levy flight mechanism, the values of the n first independent variables are respectively updated to obtain n corresponding values of the second independent variables, including:
根据以下公式一分别更新所述n个第一自变量数值:The values of the n first independent variables are respectively updated according to the following formula one:
其中,t表示当前迭代次数,xi (t+1)表示更新后的第i个第二自变量数值,xi t表示当前的第i个第一自变量数值,α表示布谷鸟搜索路径的控制参数,表示点乘积,levy(λ)表示布谷鸟飞行随机搜索路径。Among them, t represents the current number of iterations, x i (t+1) represents the value of the i-th second independent variable after the update, x i t represents the current value of the i-th first independent variable, and α represents the value of the cuckoo search path control parameter, Represents the point product, and levy(λ) represents the random search path of cuckoo flight.
可选地,步骤S4,进一步包括:Optionally, step S4 further includes:
采用服从均匀分布的随机数r∈[0,1]作为第三自变量数值的发现概率;Use the random number r∈[0,1] that obeys the uniform distribution as the discovery probability of the value of the third independent variable;
将所述随机数r与预设的发现概率进行比较,得到比较结果;Comparing the random number r with a preset discovery probability to obtain a comparison result;
在根据所述比较结果判断所述随机数r大于所述预设的发行概率的情况下,随机更新所述第三自变量数值;When it is judged according to the comparison result that the random number r is greater than the preset issuance probability, randomly update the value of the third independent variable;
将更新后的第三自变量数值代入所述测试函数,得到更新后的第三自变量数值对应的测试函数值;Substituting the updated third independent variable value into the test function to obtain a test function value corresponding to the updated third independent variable value;
将所述第三自变量数值对应的第三测试函数值与更新后的第三自变量数值对应的测试函数值进行比较,保留函数值较小者对应的自变量数值,得到第四自变量数值。Comparing the third test function value corresponding to the third independent variable value with the updated test function value corresponding to the third independent variable value, retaining the independent variable value corresponding to the smaller function value, and obtaining the fourth independent variable value .
可选地,所述根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,进一步包括:Optionally, the selecting m fourth independent variable values from the n fourth independent variable values according to the fourth test function values respectively corresponding to the n fourth independent variable values further includes:
将所述n个第四自变量数值分别对应的第四测试函数值按从小到大的顺序进行排列,得到排列结果;Arranging the fourth test function values respectively corresponding to the n fourth independent variable values in ascending order to obtain an arrangement result;
根据所述排列结果选择前m个较小的第四测试函数值分别对应的第四自变量数值,从而实现从所述n个第四自变量数值中选择m个第四自变量数值,Selecting the fourth independent variable values corresponding to the first m smaller fourth test function values according to the arrangement result, so as to select m fourth independent variable values from the n fourth independent variable values,
其中,m为小于或等于n的常数。Wherein, m is a constant less than or equal to n.
可选地,所述对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,进一步包括:Optionally, the weighted evaluation of the m fourth independent variable values to obtain a new independent variable value further includes:
根据以下公式二加权评估得到所述新的自变量数值:According to the weighted evaluation of the following formula two, the new independent variable value is obtained:
其中,xnew表示新的自变量数值,m表示常数,x1,x2,...,xm分别表示第四自变量数值,且x1,x2,...,xm分别对应的第四测试函数值依次增大,λ1,λ2,...,λm分别表示第四自变量数值x1,x2,...,xm在加权评估中所占的比重。Among them, x new represents the value of the new independent variable, m represents the constant, x 1 , x 2 ,..., x m represent the value of the fourth independent variable respectively, and x 1 , x 2 ,..., x m respectively correspond to The value of the fourth test function of increases sequentially, and λ 1 , λ 2 ,...,λ m respectively represent the proportions of the fourth independent variable values x 1 , x 2 ,...,x m in the weighted evaluation.
可选地,所述将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,进一步包括:Optionally, the assigning the m fourth independent variable values and the new independent variable values to numbered positions respectively, further includes:
将第四自变量数值xk分别分配到编号位置hk-1+1至编号位置hk;assigning the fourth independent variable value x k to numbering position h k-1 +1 to numbering position h k respectively ;
将所述新的自变量数值分别分配到编号位置hk+1至编号位置h,assigning said new independent variable values to numbered position h k +1 to numbered position h respectively,
其中,k、hk-1、hk以及h均表示常数。Among them, k, h k-1 , h k and h all represent constants.
相应地,本发明还提供一种融合布谷鸟搜索算法和狼群算法的测试函数寻优装置。所述装置包括:Correspondingly, the present invention also provides a test function optimization device that integrates the cuckoo search algorithm and the wolf pack algorithm. The devices include:
随机生成单元,用于根据所述测试函数的自变量取值范围随机生成n个第一自变量数值,并将所述n个第一自变量数值分别代入所述测试函数,得到每一第一自变量数值对应的第一测试函数值;A random generating unit, configured to randomly generate n first independent variable values according to the value range of the independent variables of the test function, and substitute the n first independent variable values into the test function respectively to obtain each first The value of the first test function corresponding to the value of the independent variable;
第一更新单元,用于根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,并将所述n个第二自变量数值分别代入所述测试函数,得到每一第二自变量数值对应的第二测试函数值;The first update unit is used to update the n first independent variable values according to the Levi's flight mechanism to obtain n corresponding second independent variable values, and respectively substitute the n second independent variable values into The test function obtains a second test function value corresponding to each second independent variable value;
比较单元,用于将每一第一自变量数值对应的第一测试函数值与对应的第二自变量数值的第二测试函数值进行比较,保留函数值较小者对应的自变量数值,得到n个第三自变量数值;The comparison unit is used to compare the first test function value corresponding to each first independent variable value with the second test function value corresponding to the second independent variable value, and retain the independent variable value corresponding to the smaller function value to obtain n values of the third independent variable;
第二更新单元,用于根据预设的发现概率对所述n个第三自变量数值分别进行更新,得到n个第四自变量数值;The second updating unit is configured to respectively update the values of the n third independent variables according to a preset discovery probability to obtain n values of the fourth independent variables;
判断单元,用于判断迭代次数是否达到预设的迭代次数,若否,则根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,及将包含分配后的所述m个第四自变量数值和所述新的自变量数值的n个自变量数值作为n个第一自变量数值,并返回步骤S1,其中,n和m分别为常数,若是,则输出最小的第四测试函数值和最小的第四测试函数值对应的第四自变量数值。A judging unit, configured to judge whether the number of iterations reaches a preset number of iterations, and if not, select from the n fourth independent variable values according to the fourth test function values respectively corresponding to the n fourth independent variable values m fourth independent variable values, weighted evaluation of the m fourth independent variable values to obtain a new independent variable value, and the m fourth independent variable values and the new independent variable value respectively Assign to the numbered position, and use the n independent variable values including the assigned m fourth independent variable values and the new independent variable values as n first independent variable values, and return to step S1, wherein, n and m are constants respectively, if yes, output the smallest fourth test function value and the fourth independent variable value corresponding to the smallest fourth test function value.
可选地,所述判断单元,具体用于:Optionally, the judging unit is specifically configured to:
将所述n个第四自变量数值分别对应的第四测试函数值按从小到大的顺序进行排列,得到排列结果;Arranging the fourth test function values respectively corresponding to the n fourth independent variable values in ascending order to obtain an arrangement result;
根据所述排列结果选择前m个较小的第四测试函数值分别对应的第四自变量数值,从而实现从所述n个第四自变量数值中选择m个第四自变量数值,Selecting the fourth independent variable values corresponding to the first m smaller fourth test function values according to the arrangement result, so as to select m fourth independent variable values from the n fourth independent variable values,
其中,m为小于或等于n的常数。Wherein, m is a constant less than or equal to n.
可选地,所述判断单元,还用于:Optionally, the judging unit is also used for:
根据以下公式二加权评估得到所述新的自变量数值:According to the weighted evaluation of the following formula two, the new independent variable value is obtained:
其中,xnew表示新的自变量数值,m表示常数,x1,x2,...,xm分别表示第四自变量数值,且x1,x2,...,xm分别对应的第四测试函数值依次增大,λ1,λ2,...,λm分别表示第四自变量数值x1,x2,...,xm在加权评估中所占的比重。Among them, x new represents the value of the new independent variable, m represents the constant, x 1 , x 2 ,..., x m represent the value of the fourth independent variable respectively, and x 1 , x 2 ,..., x m respectively correspond to The value of the fourth test function of increases sequentially, and λ 1 , λ 2 ,...,λ m respectively represent the proportions of the fourth independent variable values x 1 , x 2 ,...,x m in the weighted evaluation.
可选地,所述判断单元,还用于:Optionally, the judging unit is also used for:
将第四自变量数值xk分别分配到编号位置hk-1+1至编号位置hk;assigning the fourth independent variable value x k to numbering position h k-1 +1 to numbering position h k respectively ;
将所述新的自变量数值分别分配到编号位置hk+1至编号位置h,assigning said new independent variable values to numbered position h k +1 to numbered position h respectively,
其中,k、hk-1、hk以及h均表示常数。Among them, k, h k-1 , h k and h all represent constants.
由上述技术方案可知,在判断迭代次数未达到预设的迭代次数的情况下,根据n个第四自变量数值分别对应的第四测试函数值从n个第四自变量数值中选择m个第四自变量数值,对m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将m个第四自变量数值和新的自变量数值分别分配至编号位置,及将包含分配后的m个第四自变量数值和新的自变量数值的n个自变量数值作为n个第一自变量数值进行下一次迭代,不仅提高了测试函数寻优的收敛速度和精度,而且还降低了测试函数寻优陷入局部最优解的概率。It can be seen from the above technical solution that, in the case where it is judged that the number of iterations has not reached the preset number of iterations, m number of fourth independent variable values are selected from n fourth independent variable values according to the fourth test function values respectively corresponding to n fourth independent variable values. Four independent variable values, perform weighted evaluation on m fourth independent variable values to obtain a new independent variable value, and assign the m fourth independent variable values and the new independent variable value to the numbered positions respectively, and include the assignment The last m fourth independent variable values and n independent variable values of the new independent variable values are used as the n first independent variable values for the next iteration, which not only improves the convergence speed and accuracy of the test function optimization, but also reduces The probability of the test function falling into a local optimal solution is determined.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings that are required in the description of the embodiments or the prior art. Apparently, the drawings in the following description are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
图1是现有技术中模拟狼群的领导等级制度的示意图;Fig. 1 is the schematic diagram of the leadership hierarchy of simulating wolf pack in the prior art;
图2是现有技术中利用狼群算法寻找最优解的示意图;Fig. 2 is a schematic diagram of utilizing the wolf pack algorithm to find an optimal solution in the prior art;
图3是本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法的流程图;Fig. 3 is the flow chart of the test function optimization method of fusion cuckoo search algorithm and wolf pack algorithm provided by an embodiment of the present invention;
图4是本发明一实施例提供的Rastrigrin函数的三维曲面图;Fig. 4 is the three-dimensional surface diagram of the Rastrigrin function provided by an embodiment of the present invention;
图5是本发明一实施例提供的Rastrigrin函数单次收敛的曲线图;Fig. 5 is a curve diagram of a single convergence of the Rastrigrin function provided by an embodiment of the present invention;
图6是本发明一实施例提供的Rastrigrin函数平均值收敛的曲线图;Fig. 6 is a curve diagram of the mean convergence of the Rastrigrin function provided by an embodiment of the present invention;
图7是本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优装置的结构示意图。Fig. 7 is a schematic structural diagram of a test function optimization device integrating a cuckoo search algorithm and a wolf pack algorithm provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
现有的布谷鸟搜索算法采用莱维飞行机制对鸟窝进行高度随机搜索,在搜索过程中对已找到的较好鸟窝位置没有充分利用,因此,在利用现有的布谷鸟搜索算法进行测试函数寻优时会影响寻优的收敛速度和精度。基于此,本发明提供了一种融合布谷鸟搜索算法和狼群算法的测试函数寻优方法。The existing cuckoo search algorithm uses the Levi's flight mechanism to conduct a highly random search for the bird's nest, and does not make full use of the found better bird's nest position during the search process. Therefore, when using the existing cuckoo search algorithm to test When the function is optimized, it will affect the convergence speed and accuracy of the optimization. Based on this, the present invention provides a test function optimization method combining the cuckoo search algorithm and the wolf pack algorithm.
图3是本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法的流程图。寻优例如寻找测试函数的最小值及该最小值对应的自变量取值,或寻找测试函数的最大值及该最大值对应的自变量取值。如图3所示,本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法包括以下步骤:Fig. 3 is a flow chart of a test function optimization method integrating cuckoo search algorithm and wolf pack algorithm provided by an embodiment of the present invention. Optimizing, for example, finds the minimum value of the test function and the value of the independent variable corresponding to the minimum value, or finds the maximum value of the test function and the value of the independent variable corresponding to the maximum value. As shown in Figure 3, the test function optimization method that integrates the cuckoo search algorithm and the wolf pack algorithm provided by an embodiment of the present invention includes the following steps:
在步骤S1中,根据所述测试函数的自变量取值范围随机生成n个第一自变量数值,并将所述n个第一自变量数值分别代入所述测试函数,得到每一第一自变量数值对应的第一测试函数值。In step S1, according to the independent variable value range of the test function, n first independent variable values are randomly generated, and the n first independent variable values are respectively substituted into the test function to obtain each first independent variable value The first test function value corresponding to the variable value.
其中,在步骤S1之前,还需要设置具体的测试函数、自变量的取值范围以及常数n的大小。举例来说,所述测试函数可为测试函数Rastrigrin,自变量的取值范围为x∈[-5.12,5.12],该测试函数的全局最优解为0,分布在(0,0)处,常数n为30。具体地,测试函数Rastrigrin为:Among them, before step S1, it is also necessary to set a specific test function, a value range of an independent variable, and a size of a constant n. For example, the test function may be a test function Rastrigrin, the value range of the independent variable is x∈[-5.12,5.12], the global optimal solution of the test function is 0, distributed at (0,0), The constant n is 30. Specifically, the test function Rastrigrin is:
其中,函数维数d=30,第一自变量数值表示根据测试函数的自变量取值范围随机生成的自变量数值。Wherein, the dimension of the function is d=30, and the value of the first independent variable represents the value of the independent variable randomly generated according to the value range of the independent variable of the test function.
接着,在步骤S2中,根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,并将所述n个第二自变量数值分别代入所述测试函数,得到每一第二自变量数值对应的第二测试函数值。Next, in step S2, the values of the n first independent variables are respectively updated according to the Levi's flight mechanism to obtain n corresponding values of the second independent variables, and the values of the n second independent variables are respectively substituted into The test function obtains a second test function value corresponding to each second independent variable value.
具体地,所述根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,包括:Specifically, according to the Levy flight mechanism, the values of the n first independent variables are respectively updated to obtain n corresponding second independent variable values, including:
根据以下公式一分别更新所述n个第一自变量数值:The values of the n first independent variables are respectively updated according to the following formula one:
其中,t表示当前迭代次数,xi (t+1)表示更新后的第i个第二自变量数值,xi t表示当前的第i个第一自变量数值,α表示布谷鸟搜索路径的控制参数,表示点乘积,levy(λ)表示布谷鸟飞行随机搜索路径。Among them, t represents the current number of iterations, x i (t+1) represents the value of the i-th second independent variable after the update, x i t represents the current value of the i-th first independent variable, and α represents the value of the cuckoo search path control parameter, Represents the point product, and levy(λ) represents the random search path of cuckoo flight.
其中,第二自变量数值表示莱维飞行机制对随机生成的自变量数值进行更新所得到的自变量数值。Wherein, the second independent variable value represents the independent variable value obtained by updating the randomly generated independent variable value by the Levy flight mechanism.
紧接着,在步骤S3中,将每一第一自变量数值对应的第一测试函数值与对应的第二自变量数值的第二测试函数值进行比较,保留函数值较小者对应的自变量数值,得到n个第三自变量数值。Next, in step S3, the first test function value corresponding to each first independent variable value is compared with the second test function value corresponding to the second independent variable value, and the independent variable corresponding to the smaller function value is retained Value, to get n values of the third independent variable.
具体地,在第一自变量数值对应的第一测试函数值小于与所述第一自变量数值对应的第二自变量数值的第二测试函数值的情况下,保留第一自变量数值,丢弃与第一自变量数值对应的第二自变量数值;在第一自变量数值对应的第一测试函数值大于与所述第一自变量数值对应的第二自变量数值的第二测试函数值的情况下,保留与第一自变量数值对应的第二自变量数值,丢弃第一自变量数值;在第一自变量数值对应的第一测试函数值等于与所述第一自变量数值对应的第二自变量数值的第二测试函数值的情况下,保留第一自变量数值和与第一自变量数值对应的第二自变量数值中的任意一者。Specifically, when the first test function value corresponding to the first independent variable value is smaller than the second test function value corresponding to the second independent variable value corresponding to the first independent variable value, keep the first independent variable value and discard The value of the second independent variable corresponding to the value of the first independent variable; the value of the first test function corresponding to the value of the first independent variable is greater than the value of the second test function corresponding to the value of the second independent variable corresponding to the value of the first independent variable In this case, the value of the second independent variable corresponding to the value of the first independent variable is retained, and the value of the first independent variable is discarded; the value of the first test function corresponding to the value of the first independent variable is equal to the value of the first independent variable corresponding to the value of the first independent variable In the case of the second test function value of two independent variable values, either one of the first independent variable value and the second independent variable value corresponding to the first independent variable value is retained.
其中,第三自变量数值表示第一自变量数值和第二自变量数值分别对应的测试函数值中测试函数值较小者所对应的自变量数值。Wherein, the value of the third independent variable represents the value of the independent variable corresponding to the test function value corresponding to the value of the first independent variable and the value of the second independent variable which is smaller in the value of the test function.
然后,在步骤S4中,根据预设的发现概率对所述n个第三自变量数值分别进行更新,得到n个第四自变量数值。Then, in step S4, the values of the n third independent variables are respectively updated according to the preset discovery probability to obtain n values of the fourth independent variable.
具体地,该步骤进一步包括:采用服从均匀分布的随机数r∈[0,1]作为第三自变量数值的发现概率;将所述随机数r与预设的发现概率进行比较,得到比较结果;在根据所述比较结果判断所述随机数r大于所述预设的发行概率的情况下,随机更新所述第三自变量数值;将更新后的第三自变量数值代入所述测试函数,得到更新后的第三自变量数值对应的测试函数值;将所述第三自变量数值对应的第三测试函数值与更新后的第三自变量数值对应的测试函数值进行比较,保留函数值较小者对应的自变量数值,得到第四自变量数值。Specifically, this step further includes: using a random number r∈[0,1] subject to uniform distribution as the discovery probability of the value of the third independent variable; comparing the random number r with the preset discovery probability to obtain a comparison result ; In the case of judging that the random number r is greater than the preset issuance probability according to the comparison result, randomly updating the value of the third independent variable; substituting the updated value of the third independent variable into the test function, Obtain the test function value corresponding to the updated third independent variable value; compare the third test function value corresponding to the third independent variable value with the test function value corresponding to the updated third independent variable value, and retain the function value The value of the independent variable corresponding to the smaller one, to obtain the value of the fourth independent variable.
其中,所述随机更新所述第三自变量数值,包括:采用现有技术中的鸟巢位置随机偏好游动更新公式更新所述第三自变量数值。其中,在第三自变量数值对应的第三测试函数值小于更新后的第三自变量数值对应的测试函数值的情况下,保留第三自变量数值,丢弃更新后的第三自变量数值;在第三自变量数值对应的第三测试函数值大于更新后的第三自变量数值对应的测试函数值的情况下,保留更新后的第三自变量数值,丢弃第三自变量数值;在第三自变量数值对应的第三测试函数值等于更新后的第三自变量数值对应的测试函数值的情况下,保留第三自变量数值和更新后的第三自变量数值中的任意一者。Wherein, the random updating of the value of the third independent variable includes: updating the value of the third independent variable by adopting the bird's nest location random preference walk update formula in the prior art. Wherein, when the third test function value corresponding to the value of the third independent variable is smaller than the value of the test function corresponding to the updated value of the third independent variable, the value of the third independent variable is retained, and the updated value of the third independent variable is discarded; When the value of the third test function corresponding to the value of the third independent variable is greater than the value of the test function corresponding to the updated value of the third independent variable, keep the updated value of the third independent variable and discard the value of the third independent variable; When the third test function value corresponding to the three independent variable values is equal to the test function value corresponding to the updated third independent variable value, any one of the third independent variable value and the updated third independent variable value is retained.
其中,第四自变量数值表示根据预设的发现概率对第三自变量数值进行更新后所得到的自变量数值。Wherein, the value of the fourth independent variable represents the value of the independent variable obtained after updating the value of the third independent variable according to the preset discovery probability.
接着,在步骤S5中,判断迭代次数是否达到预设的迭代次数。Next, in step S5, it is judged whether the number of iterations reaches a preset number of iterations.
紧接着,在步骤S6中,在判断迭代次数未达到预设的迭代次数的情况下,根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,及将包含分配后的所述m个第四自变量数值和所述新的自变量数值的n个自变量数值作为n个第一自变量数值,并返回步骤S1,其中,n和m分别为常数。Next, in step S6, when it is judged that the number of iterations has not reached the preset number of iterations, according to the fourth test function values respectively corresponding to the values of the n fourth independent variables, the n fourth independent variables Selecting m fourth independent variable values from the values, performing weighted evaluation on the m fourth independent variable values to obtain a new independent variable value, and combining the m fourth independent variable values with the new independent variable value Assign variable values to numbered positions respectively, and use n independent variable values including the assigned m fourth independent variable values and the new independent variable values as n first independent variable values, and return to step S1 , where n and m are constants respectively.
最后,在步骤S7中,在判断迭代次数达到预设的迭代次数的情况下,输出最小的第四测试函数值和最小的第四测试函数值对应的第四自变量数值。Finally, in step S7, when it is judged that the number of iterations reaches the preset number of iterations, the smallest fourth test function value and the fourth argument value corresponding to the smallest fourth test function value are output.
具体地,所述根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,进一步包括:将所述n个第四自变量数值分别对应的第四测试函数值按从小到大的顺序进行排列,得到排列结果;根据所述排列结果选择前m个较小的第四测试函数值分别对应的第四自变量数值,从而实现从所述n个第四自变量数值中选择m个第四自变量数值,其中,m为小于或等于n的常数。Specifically, the selecting m fourth independent variable values from the n fourth independent variable values according to the fourth test function values respectively corresponding to the n fourth independent variable values further includes: The fourth test function values corresponding to the fourth independent variable values are arranged in ascending order to obtain the arrangement result; according to the arrangement result, select the first m smaller fourth test function values corresponding to the fourth self respectively. variable values, so as to select m fourth independent variable values from the n fourth independent variable values, wherein m is a constant less than or equal to n.
举例来说,当n=30,m=3时,将30个第四自变量数值分别对应的第四测试函数值按从小到大的顺序进行排列,得到排列结果;根据排列结果选择前3个较小的第四测试函数值分别对应的第四自变量数值x1,x2,x3,换句话说,第四自变量数值x1,x2,x3分别对应的第四测试函数值依次增大,从而实现从30个第四自变量数值中选择3个第四自变量数值。For example, when n=30 and m=3, arrange the fourth test function values corresponding to the 30 fourth independent variable values in ascending order to obtain the arrangement result; select the first three according to the arrangement result The fourth independent variable values x 1 , x 2 , x 3 corresponding to the smaller fourth test function values respectively, in other words, the fourth independent variable values x 1 , x 2 , x 3 respectively correspond to the fourth test function values Increase in turn, so as to realize the selection of 3 fourth independent variable values from 30 fourth independent variable values.
具体地,所述对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,进一步包括:Specifically, the weighted evaluation of the m fourth independent variable values to obtain a new independent variable value further includes:
根据以下公式二加权评估得到所述新的自变量数值:According to the weighted evaluation of the following formula two, the new independent variable value is obtained:
其中,xnew表示新的自变量数值,m表示常数,x1,x2,...,xm分别表示第四自变量数值,且x1,x2,...,xm分别对应的第四测试函数值依次增大,λ1,λ2,...,λm分别表示第四自变量数值x1,x2,...,xm在加权评估中所占的比重。Among them, x new represents the value of the new independent variable, m represents the constant, x 1 , x 2 ,..., x m represent the value of the fourth independent variable respectively, and x 1 , x 2 ,..., x m respectively correspond to The value of the fourth test function of increases sequentially, and λ 1 , λ 2 ,...,λ m respectively represent the proportions of the fourth independent variable values x 1 , x 2 ,...,x m in the weighted evaluation.
举例来说,当m=3时,第四自变量数值x1,x2,x3在加权评估中所占的比重分别为λ1=1.2,λ2=1,λ3=0.8,从而得到新的自变量数值。For example, when m=3, the proportions of the fourth independent variable values x 1 , x 2 , and x 3 in the weighted evaluation are λ 1 =1.2, λ 2 =1, and λ 3 =0.8 respectively, so that The new argument value.
具体地,所述将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,进一步包括:将第四自变量数值xk分别分配到编号位置hk-1+1至编号位置hk;将所述新的自变量数值分别分配到编号位置hk+1至编号位置h,其中,k、hk-1、hk以及h均表示常数。Specifically, assigning the m fourth independent variable values and the new independent variable values to numbered positions respectively, further includes: respectively assigning the fourth independent variable values x k to numbered positions h k-1 + 1 to number position h k ; assign the new independent variable value to number position h k +1 to number position h respectively, wherein k, h k-1 , h k and h all represent constants.
举例来说,当m=3,h=8,h1=2,h2=4,h3=6时,第四自变量数值x1分别分配至编号位置1和编号位置2,第四自变量数值x2分别分配至编号位置3和编号位置4,第四自变量数值x3分别分配至编号位置5和编号位置6,新的自变量数值分别分配至编号位置7和编号位置8。具体地,30个第四自变量数值分别对应一个编号位置,在得到第四自变量数值x1,x2,x3和新的自变量数值后,将原来编号位置1-8对应的第四自变量数值丢弃,空出编号位置1-8。然后,根据以上方法将第四自变量数值x1,x2,x3和新的自变量数值分别分配至编号位置1-8。For example, when m=3, h=8, h 1 =2, h 2 =4, h 3 =6, the value x 1 of the fourth argument is assigned to the number position 1 and the number position 2 respectively, and the fourth argument The variable value x 2 is assigned to number position 3 and number position 4 respectively, the fourth independent variable value x 3 is assigned to number position 5 and number position 6 respectively, and the new independent variable value is assigned to number position 7 and number position 8 respectively. Specifically, the 30 fourth independent variable values correspond to a numbered position respectively. After obtaining the fourth independent variable values x 1 , x 2 , x 3 and the new independent variable values, the fourth independent variable values corresponding to the original numbered positions 1-8 The argument value is discarded, leaving numbered positions 1-8 empty. Then, assign the fourth independent variable value x 1 , x 2 , x 3 and the new independent variable value to numbered positions 1-8 according to the above method.
当选用多个自变量数值时可以同时加强在多个最优区域里的局部搜索。调整编号位置的数量h和最优自变量数值的个数m的取值可以平衡全局搜索和局部搜索的能力。When multiple independent variable values are selected, the local search in multiple optimal regions can be strengthened at the same time. Adjusting the number h of numbered positions and the number m of optimal independent variable values can balance the capabilities of global search and local search.
以测试函数Rastrigrin为例,结合现有的布谷鸟搜索算法和改进的布谷鸟搜索算法来评价本发明提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法的性能优势。其中,Rastrigrin函数的三维曲面图,如图4所示。Taking the test function Rastrigrin as an example, combining the existing cuckoo search algorithm and the improved cuckoo search algorithm to evaluate the performance advantages of the test function optimization method integrating the cuckoo search algorithm and the wolf pack algorithm provided by the present invention. Among them, the three-dimensional surface diagram of the Rastrigrin function is shown in Figure 4.
在利用现有的布谷鸟搜索算法进行测试函数寻优时,算法独立运行50次,每次独立运行的迭代次数为100,在利用改进的布谷鸟搜索算法进行测试函数寻优时,算法独立运行50次,每次独立运行的迭代次数为100,在利用本发明提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法进行测试函数寻优时,算法独立运行50次,每次独立运行的迭代次数为100。其中,改进的布谷鸟搜索算法相对于本发明提供的方法区别在于,改进的布谷鸟搜索算法将选择的自变量数值分别分配至编号位置,但不产生新的自变量数值。When using the existing cuckoo search algorithm to optimize the test function, the algorithm runs independently 50 times, and the number of iterations of each independent operation is 100. When using the improved cuckoo search algorithm to optimize the test function, the algorithm runs independently 50 times, the number of iterations of each independent operation is 100, when using the test function optimization method of the fusion cuckoo search algorithm and wolf pack algorithm provided by the present invention to optimize the test function, the algorithm runs 50 times independently, each time independently The number of iterations run is 100. Among them, the difference between the improved cuckoo search algorithm and the method provided by the present invention is that the improved cuckoo search algorithm assigns the selected independent variable values to the numbered positions respectively, but does not generate new independent variable values.
图5是本发明一实施例提供的Rastrigrin函数单次收敛的曲线图。图5示出了在50次独立运行中某次独立运行的测试函数Rastrigrin的收敛曲线图,其中,CS表示现有的布谷鸟搜索算法,ICS表示改进的布谷鸟搜索算法,new-ICS表示本发明提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法。由图可知,本发明提供的方法相对于现有的布谷鸟搜索算法和改进的布谷鸟搜索算法,具有收敛速度快的优势。Fig. 5 is a graph of a single convergence of the Rastrigrin function provided by an embodiment of the present invention. Fig. 5 shows the convergence curve of the test function Rastrigrin in one of the 50 independent runs, where CS represents the existing cuckoo search algorithm, ICS represents the improved cuckoo search algorithm, and new-ICS represents the current The invention provides a test function optimization method that combines the cuckoo search algorithm and the wolf pack algorithm. It can be seen from the figure that, compared with the existing cuckoo search algorithm and the improved cuckoo search algorithm, the method provided by the present invention has the advantage of fast convergence speed.
图6是本发明一实施例提供的Rastrigrin函数平均值收敛的曲线图。图6示出了50次独立运行中搜索到测试函数的最小值的平均值的收敛曲线图。由图可知,本发明提供的方法相对于现有的布谷鸟搜索算法和改进的布谷鸟搜索算法,具有收敛速度快的优势。Fig. 6 is a graph showing the average convergence of the Rastrigrin function provided by an embodiment of the present invention. Figure 6 shows a graph of the convergence of the average of the searched minima of the test function over 50 independent runs. It can be seen from the figure that, compared with the existing cuckoo search algorithm and the improved cuckoo search algorithm, the method provided by the present invention has the advantage of fast convergence speed.
在迭代次数为500次时,三种方法的寻优精度对比如下:When the number of iterations is 500, the optimization accuracy of the three methods is compared as follows:
CS:best=114.387,mean=150.389,max=196.027,Std=16.7872,CS: best=114.387, mean=150.389, max=196.027, std=16.7872,
ICS:best=61.7044,mean=93.1059,max=136.066,Std=17.8358,ICS: best=61.7044, mean=93.1059, max=136.066, std=17.8358,
new-ICS:best=27.1544,mean=59.3567,max=141.707,Std=20.5961new-ICS: best=27.1544, mean=59.3567, max=141.707, std=20.5961
其中,best表示最优值,mean表示平均值,max表示最大值,Std表示标准值。对比可知,本发明提供的方法的寻优精度大于现有的布谷鸟搜索算法和改进的布谷鸟搜索算法的寻优精度。Among them, best represents the optimal value, mean represents the average value, max represents the maximum value, and Std represents the standard value. It can be seen from the comparison that the optimization accuracy of the method provided by the present invention is greater than that of the existing cuckoo search algorithm and the improved cuckoo search algorithm.
本实施例在判断迭代次数未达到预设的迭代次数的情况下,根据n个第四自变量数值分别对应的第四测试函数值从n个第四自变量数值中选择m个第四自变量数值,对m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将m个第四自变量数值和新的自变量数值分别分配至编号位置,及将包含分配后的m个第四自变量数值和新的自变量数值的n个自变量数值作为n个第一自变量数值进行下一次迭代,不仅提高了测试函数寻优的收敛速度和精度,而且还降低了测试函数寻优陷入局部最优解的概率。In this embodiment, when it is judged that the number of iterations has not reached the preset number of iterations, m fourth independent variables are selected from the n fourth independent variable values according to the fourth test function values corresponding to the n fourth independent variable values. Numerical value, carry out weighted evaluation on m fourth independent variable values to obtain a new independent variable value, and assign m fourth independent variable values and new independent variable values to number positions respectively, and include the assigned m The fourth independent variable value and n independent variable values of the new independent variable value are used as n first independent variable values for the next iteration, which not only improves the convergence speed and accuracy of the test function optimization, but also reduces the test function The probability of finding a local optimal solution.
对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。For the method embodiment, for the sake of simple description, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present invention is not limited by the described action order, because according to the embodiment of the present invention , certain steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
图7是本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优装置的结构示意图。如图7所示,本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优装置包括:Fig. 7 is a schematic structural diagram of a test function optimization device integrating a cuckoo search algorithm and a wolf pack algorithm provided by an embodiment of the present invention. As shown in FIG. 7 , the test function optimization device that integrates the cuckoo search algorithm and the wolf pack algorithm provided by an embodiment of the present invention includes:
随机生成单元201,用于根据所述测试函数的自变量取值范围随机生成n个第一自变量数值,并将所述n个第一自变量数值分别代入所述测试函数,得到每一第一自变量数值对应的第一测试函数值;The random generating unit 201 is configured to randomly generate n first independent variable values according to the value range of the independent variables of the test function, and substitute the n first independent variable values into the test function to obtain each first independent variable value. a first test function value corresponding to an independent variable value;
第一更新单元202,用于根据莱维飞行机制对所述n个第一自变量数值分别进行更新,得到n个对应的第二自变量数值,并将所述n个第二自变量数值分别代入所述测试函数,得到每一第二自变量数值对应的第二测试函数值;The first updating unit 202 is configured to update the values of the n first independent variables according to the Levi's flight mechanism to obtain n corresponding values of the second independent variables, and respectively update the values of the n second independent variables Substituting into the test function to obtain a second test function value corresponding to each second independent variable value;
比较单元203,用于将每一第一自变量数值对应的第一测试函数值与对应的第二自变量数值的第二测试函数值进行比较,保留函数值较小者对应的自变量数值,得到n个第三自变量数值;The comparison unit 203 is configured to compare the first test function value corresponding to each first argument value with the second test function value corresponding to the second argument value, and retain the argument value corresponding to the smaller function value, Obtain n values of the third independent variable;
第二更新单元204,用于根据预设的发现概率对所述n个第三自变量数值分别进行更新,得到n个第四自变量数值;The second updating unit 204 is configured to respectively update the values of the n third independent variables according to a preset discovery probability to obtain n values of the fourth independent variables;
判断单元205,用于判断迭代次数是否达到预设的迭代次数,若否,则根据所述n个第四自变量数值分别对应的第四测试函数值从所述n个第四自变量数值中选择m个第四自变量数值,对所述m个第四自变量数值进行加权评估,得到一个新的自变量数值,并将所述m个第四自变量数值和所述新的自变量数值分别分配至编号位置,及将包含分配后的所述m个第四自变量数值和所述新的自变量数值的n个自变量数值作为n个第一自变量数值,并返回步骤S1,其中,n和m分别为常数,若是,则输出最小的第四测试函数值和最小的第四测试函数值对应的第四自变量数值。The judging unit 205 is configured to judge whether the number of iterations has reached the preset number of iterations, and if not, select from the n fourth independent variable values according to the fourth test function values respectively corresponding to the n fourth independent variable values Selecting m fourth independent variable values, performing weighted evaluation on the m fourth independent variable values to obtain a new independent variable value, and combining the m fourth independent variable values with the new independent variable value respectively assigning to numbered positions, and using n independent variable values including the assigned m fourth independent variable values and the new independent variable values as n first independent variable values, and returning to step S1, wherein , n and m are constants respectively, if so, output the smallest fourth test function value and the fourth independent variable value corresponding to the smallest fourth test function value.
在本发明一可选实施方式中,所述判断单元205,具体用于:In an optional implementation manner of the present invention, the judging unit 205 is specifically configured to:
将所述n个第四自变量数值分别对应的第四测试函数值按从小到大的顺序进行排列,得到排列结果;Arranging the fourth test function values respectively corresponding to the n fourth independent variable values in ascending order to obtain an arrangement result;
根据所述排列结果选择前m个较小的第四测试函数值分别对应的第四自变量数值,从而实现从所述n个第四自变量数值中选择m个第四自变量数值,Selecting the fourth independent variable values corresponding to the first m smaller fourth test function values according to the arrangement result, so as to select m fourth independent variable values from the n fourth independent variable values,
其中,m为小于或等于n的常数。Wherein, m is a constant less than or equal to n.
在本发明一可选实施方式中,所述判断单元205,还用于:In an optional implementation manner of the present invention, the judging unit 205 is further configured to:
根据以下公式二加权评估得到所述新的自变量数值:According to the weighted evaluation of the following formula two, the new independent variable value is obtained:
其中,xnew表示新的自变量数值,m表示常数,x1,x2,...,xm分别表示第四自变量数值,且x1,x2,...,xm分别对应的第四测试函数值依次增大,λ1,λ2,...,λm分别表示第四自变量数值x1,x2,...,xm在加权评估中所占的比重。Among them, x new represents the value of the new independent variable, m represents the constant, x 1 , x 2 ,..., x m represent the value of the fourth independent variable respectively, and x 1 , x 2 ,..., x m respectively correspond to The value of the fourth test function of increases sequentially, and λ 1 , λ 2 ,...,λ m respectively represent the proportions of the fourth independent variable values x 1 , x 2 ,...,x m in the weighted evaluation.
在本发明一可选实施方式中,所述判断单元205,还用于:In an optional implementation manner of the present invention, the judging unit 205 is further configured to:
将第四自变量数值xk分别分配到编号位置hk-1+1至编号位置hk;assigning the fourth independent variable value x k to numbering position h k-1 +1 to numbering position h k respectively ;
将所述新的自变量数值分别分配到编号位置hk+1至编号位置h,assigning said new independent variable values to numbered position h k +1 to numbered position h respectively,
其中,k、hk-1、hk以及h均表示常数。Among them, k, h k-1 , h k and h all represent constants.
对于本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优装置中还涉及的具体细节已在本发明一实施例提供的融合布谷鸟搜索算法和狼群算法的测试函数寻优方法中作了详细的描述,在此不再赘述。For the specific details involved in the test function optimization device integrating the cuckoo search algorithm and the wolf pack algorithm provided by an embodiment of the present invention, the test function of the fusion cuckoo search algorithm and the wolf pack algorithm provided by an embodiment of the present invention The optimization method has been described in detail, and will not be repeated here.
应当注意的是,在本发明的系统的各个部件中,根据其要实现的功能而对其中的部件进行了逻辑划分,但是,本发明不受限于此,可以根据需要对各个部件进行重新划分或者组合,例如,可以将一些部件组合为单个部件,或者可以将一些部件进一步分解为更多的子部件。It should be noted that among the various components of the system of the present invention, the components are logically divided according to the functions to be realized, but the present invention is not limited thereto, and each component can be re-divided as required Or combined, for example, some components can be combined into a single component, or some components can be further broken down into more subcomponents.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the system according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
以上实施方式仅适于说明本发明,而并非对本发明的限制,有关技术领域的普通技术人员,在不脱离本发明的精神和范围的情况下,还可以做出各种变化和变型,因此所有等同的技术方案也属于本发明的范畴,本发明的专利保护范围应由权利要求限定。The above embodiments are only suitable for illustrating the present invention, rather than limiting the present invention. Those of ordinary skill in the relevant technical fields can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, all Equivalent technical solutions also belong to the category of the present invention, and the scope of patent protection of the present invention should be defined by the claims.
Claims (10)
- A kind of 1. test function optimization method for merging cuckoo searching algorithm and wolf pack algorithm, it is characterised in that methods described Comprise the following steps:S1, generate n the first independent variable numerical value at random according to the independent variable span of the test function, and by the n First independent variable numerical value substitutes into the test function respectively, obtains the first test function corresponding to every one first independent variable numerical value Value;S2, fly mechanics are tieed up according to Lay the n the first independent variable numerical value are updated respectively, obtained second corresponding to n Independent variable numerical value, and the n the second independent variable numerical value are substituted into the test function respectively, obtain every one second independent variable number Second test function value corresponding to value;S3, the second survey by the first test function value corresponding to every one first independent variable numerical value with corresponding second independent variable numerical value Trial function value is compared, and independent variable numerical value corresponding to reservation functional value smaller, obtains n the 3rd independent variable numerical value;S4, according to default probability of detection the n the 3rd independent variable numerical value are updated respectively, obtain n four selfs and become Numerical quantity;S5, judge whether iterations reaches default iterations;If it is not, then perform step S6;If so, then perform step S7;S6, according to the n four selfs variable values respectively corresponding to the 4th test function value from the n four selfs variable numbers M four selfs variable values are selected in value, assessments is weighted to the m four selfs variable values, obtain one it is new certainly Variable value, and the m four selfs variable values and the new independent variable numerical value are respectively allocated to numbered positions, and will Comprising the m four selfs variable values after distribution and n independent variable numerical value of the new independent variable numerical value as n individual the One independent variable numerical value, and return to step S1, wherein, n and m are respectively constant;Four selfs variable value corresponding to 4th test function value of the 4th minimum test function value of S7, output and minimum.
- 2. the test function optimization method of fusion cuckoo searching algorithm according to claim 1 and wolf pack algorithm, it is special Sign is, described that the n the first independent variable numerical value are updated respectively according to Lay dimension fly mechanics, obtains corresponding to n Second independent variable numerical value, including:The n the first independent variable numerical value are updated according to below equation one respectively:Wherein, t represents current iteration number, xi (t+1)Represent i-th of second independent variable numerical value after renewal, xi tRepresent currently I-th of first independent variable numerical value, α represent the control parameter of cuckoo searching route,Dot-product is represented, levy (λ) represents cloth Paddy bird flying random search path.
- 3. the test function optimization method of fusion cuckoo searching algorithm according to claim 1 and wolf pack algorithm, it is special Sign is, step S4, further comprises:Using probability of detection of the equally distributed random number r ∈ [0,1] of obedience as the 3rd independent variable numerical value;By the random number r compared with default probability of detection, comparative result is obtained;In the case where judging that the random number r is more than the default distribution probability according to the comparative result, randomly update The 3rd independent variable numerical value;By the 3rd independent variable numerical value substitution test function after renewal, corresponding to the 3rd independent variable numerical value after being updated Test function value;By the survey corresponding with the 3rd independent variable numerical value after renewal of the 3rd test function value corresponding to the 3rd independent variable numerical value Trial function value is compared, and independent variable numerical value corresponding to reservation functional value smaller, obtains four selfs variable value.
- 4. the test function optimization method of fusion cuckoo searching algorithm according to claim 1 and wolf pack algorithm, it is special Sign is that the 4th test function value according to corresponding to the n four selfs variable values difference becomes from the n four selfs M four selfs variable values are selected in numerical quantity, are further comprised:By the n four selfs variable values, corresponding 4th test function value is arranged by order from small to large respectively, Obtain rank results;Four selfs variable value corresponding to m less 4th test function values difference before being selected according to the rank results, from And realize and m four selfs variable values are selected from the n four selfs variable values,Wherein, m is the constant less than or equal to n.
- 5. the test function optimization method of fusion cuckoo searching algorithm according to claim 1 and wolf pack algorithm, it is special Sign is, described to be weighted assessment to the m four selfs variable values, obtains a new independent variable numerical value, further Including:Assessed according to the weighting of below equation two and obtain the new independent variable numerical value:Wherein, xnewNew independent variable numerical value is represented, m represents constant, x1,x2,...,xmFour selfs variable value is represented respectively, and x1,x2,...,xmThe 4th test function value increases successively corresponding to respectively, λ1,λ2,...,λmFour selfs variable value is represented respectively x1,x2,...,xmThe shared proportion in weighting is assessed.
- 6. the test function optimization method of fusion cuckoo searching algorithm according to claim 1 and wolf pack algorithm, it is special Sign is, described that the m four selfs variable values and the new independent variable numerical value are respectively allocated into numbered positions, enters one Step includes:By four selfs variable value xkIt is separately dispensed into numbered positions hk-1+ 1 to numbered positions hk;The new independent variable numerical value is separately dispensed into numbered positions hk+ 1 to numbered positionsh, wherein, k, hk-1、hkAnd h is equal Represent constant.
- A kind of 7. test function optimization device for merging cuckoo searching algorithm and wolf pack algorithm, it is characterised in that described device Including:Random generation unit, for generating n the first independent variable numbers at random according to the independent variable span of the test function Value, and the n the first independent variable numerical value are substituted into the test function respectively, obtain corresponding to every one first independent variable numerical value First test function value;First updating block, the n the first independent variable numerical value are updated respectively for tieing up fly mechanics according to Lay, obtained Second independent variable numerical value corresponding to n, and the n the second independent variable numerical value are substituted into the test function respectively, obtain every Second test function value corresponding to one second independent variable numerical value;Comparing unit, for by the first test function value corresponding to every one first independent variable numerical value and corresponding second independent variable number Second test function value of value is compared, and independent variable numerical value corresponding to reservation functional value smaller, obtains n the 3rd independents variable Numerical value;Second updating block, for being updated respectively to the n the 3rd independent variable numerical value according to default probability of detection, obtain To n four selfs variable values;Judging unit, for judging whether iterations reaches default iterations, if it is not, then according to the n four selfs The 4th test function value selects m four selfs variable numbers from the n four selfs variable values corresponding to variable value difference Value, assessment is weighted to the m four selfs variable values, obtains a new independent variable numerical value, and by the m the 4th Independent variable numerical value and the new independent variable numerical value are respectively allocated to numbered positions, and will include the m the 4th after distribution N independent variable numerical value of independent variable numerical value and the new independent variable numerical value is as n the first independent variable numerical value, and return to step S1, wherein, n and m are respectively constant, if so, then exporting the 4th test function value of minimum and the 4th minimum test function value Corresponding four selfs variable value.
- 8. the test function optimization device of fusion cuckoo searching algorithm according to claim 7 and wolf pack algorithm, it is special Sign is, the judging unit, is specifically used for:By the n four selfs variable values, corresponding 4th test function value is arranged by order from small to large respectively, Obtain rank results;Four selfs variable value corresponding to m less 4th test function values difference before being selected according to the rank results, from And realize and m four selfs variable values are selected from the n four selfs variable values,Wherein, m is the constant less than or equal to n.
- 9. the test function optimization device of fusion cuckoo searching algorithm according to claim 7 and wolf pack algorithm, it is special Sign is, the judging unit, is additionally operable to:Assessed according to the weighting of below equation two and obtain the new independent variable numerical value:Wherein, xnewNew independent variable numerical value is represented, m represents constant, x1,x2,...,xmFour selfs variable value is represented respectively, and x1,x2,...,xmThe 4th test function value increases successively corresponding to respectively, λ1,λ2,...,λmFour selfs variable value is represented respectively x1,x2,...,xmThe shared proportion in weighting is assessed.
- 10. the test function optimization device of fusion cuckoo searching algorithm according to claim 7 and wolf pack algorithm, it is special Sign is, the judging unit, is additionally operable to:By four selfs variable value xkIt is separately dispensed into numbered positions hk-1+ 1 to numbered positions hk;The new independent variable numerical value is separately dispensed into numbered positions hk+ 1 to numbered positions h,Wherein, k, hk-1、hkAnd h represents constant.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610819414.6A CN107818365A (en) | 2016-09-12 | 2016-09-12 | Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610819414.6A CN107818365A (en) | 2016-09-12 | 2016-09-12 | Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107818365A true CN107818365A (en) | 2018-03-20 |
Family
ID=61601189
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610819414.6A Pending CN107818365A (en) | 2016-09-12 | 2016-09-12 | Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107818365A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20230289562A1 (en) * | 2018-11-05 | 2023-09-14 | Incucomm, Inc. | System and method for adaptive optimization |
-
2016
- 2016-09-12 CN CN201610819414.6A patent/CN107818365A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20230289562A1 (en) * | 2018-11-05 | 2023-09-14 | Incucomm, Inc. | System and method for adaptive optimization |
| US12430539B2 (en) * | 2018-11-05 | 2025-09-30 | Incucomm, Inc. | System and method for adaptive optimization |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11907821B2 (en) | Population-based training of machine learning models | |
| US10832163B2 (en) | Memory facilitation using directed acyclic graphs | |
| US20190130277A1 (en) | Ensembling of neural network models | |
| US10496436B2 (en) | Method and apparatus for automatically scheduling jobs in computer numerical control machines using machine learning approaches | |
| CN107247973A (en) | A kind of preferred Parallel Particle Swarm Optimization optimization method of SVMs parameter based on spark | |
| JP2018045516A (en) | Classification device, classification method, and program | |
| CN112699045A (en) | Software test case generation method based on multi-population genetic algorithm | |
| CN112668706A (en) | Performing genetic algorithms on a low power controller | |
| WO2021220775A1 (en) | System for estimating characteristic value of material | |
| WO2020169182A1 (en) | Method and apparatus for allocating tasks | |
| CN107818365A (en) | Merge test function optimization method, the device of cuckoo searching algorithm and wolf pack algorithm | |
| CN113110605A (en) | Multi-unmanned aerial vehicle collaborative search method and device in urban environment | |
| JP6500698B2 (en) | Event sequence construction of event driven software by combinational calculation | |
| Sancı et al. | A parallel algorithm for UAV flight route planning on GPU | |
| Jankowski et al. | Seeds buffering for information spreading processes | |
| Ahmad et al. | A prediction framework for fast sparse triangular solves | |
| WO2015110867A1 (en) | A pattern based configuration method for minimizing the impact of component failures | |
| GB2507048A (en) | System testing algorithm and apparatus | |
| US11928562B2 (en) | Framework for providing improved predictive model | |
| Akhmedova et al. | Co-operation of biology related algorithms for multi-objective binary optimization | |
| Onal et al. | GAT-Steiner: Rectilinear Steiner Minimal Tree Prediction Using GNNs | |
| KR102111396B1 (en) | Apparatus for training neural networks and operating method thereof | |
| US20250363410A1 (en) | Model generation system and model generation method | |
| WO2021064881A1 (en) | Personnel arrangement device, arrangement method, and program | |
| De Luca et al. | Proconsul: Probabilistic exploration of connectivity significance patterns for disease module discovery |
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 | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180320 |