首页 分享 智能优化算法:食肉植物算法

智能优化算法:食肉植物算法

来源:花匠小妙招 时间:2025-01-01 05:15

智能优化算法:食肉植物算法

1.金豺优化算法简介

食肉植物算法(Carnivorous plant algorithm,CPA)是2022年由Ong Kok Meng等人提出的,该算法模拟了食肉植物在恶劣环境中如何适应和生存的行为能力,如猎食昆虫作为食物和授粉以进行繁殖。

2.金豺优化算法基本原理

2.1 初始化

在食肉植物算法中, 食肉植物种群可以用以下种群矩阵表示:
P o p = [  Individual  1 , 1  Individual  1 , 2 ⋯ ⋯  Individual  1 , d  Individual  2 , 1  Individual  ⋯ ⋯  Individual  2 , d ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮  Individual  1 , d  Individual  2 , d ⋯ ⋯  Individual  n , d ] (1) P_{o p}=left[ Individual 1,1 Individual 1,2⋯⋯ Individual 1,d Individual 2,1 Individual ⋯⋯ Individual 2,d⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮ Individual 1,d Individual 2,d⋯⋯ Individual n,d

right] tag{1} Pop​=⎣

⎡​ Individual 1,1​ Individual 2,1​⋮⋮ Individual 1,d​​ Individual 1,2​ Individual ⋮⋮ Individual 2,d​​⋯⋯⋮⋮⋯​⋯⋯⋮⋮⋯​ Individual 1,d​ Individual 2,d​⋮⋮ Individual n,d​​⎦

⎤​(1)
式中: P O P P O P POP 为食肉植物的种群矩阵; N N N 为食肉植物的种群数量; d d d 为求解问题的维度。
食肉植物种群初始化数学描述如下:
 Individual  i , j = L b j + ( U b j − L b j ) ×  rand  (2) text { Individual }_{i, j}=L b_{j}+left(U b_{j}-L b_{j}right) times text { rand } tag{2}  Individual i,j​=Lbj​+(Ubj​−Lbj​)× rand (2)
式中: Individual i , j { }_{i, j} i,j​ 为第 i i i 个食肉植物的第 j j j 维的位置; rand 是 [ 0 , 1 ] [0,1] [0,1] 范围内的随机数; U b j U b_{j} Ubj​ 和 L b j L b_{j} Lbj​ 分别是求解问题的第 j j j 维的上下边界。

在食肉植物算法中,求解问题的目标函数可以用来计算食肉植物的适应度值;食肉植物种群的适应度值可以用适应度值向量表示:
F i t = [ f (  Individual  1 , 1  Individual  1 , 2 ⋯ ⋯  Individual  1 , d ) f  Individual  2 , 1  Individual  … ⋯  Individual  2 , d ) ⋮ ⋯ ⋮ f (  Individual  1 , d  Individual  2 , d ⋯ ⋯  Individual  n , d ) ] (3) F i t=left[f( Individual 1,1 Individual 1,2⋯⋯ Individual 1,d)f Individual 2,1 Individual …⋯ Individual 2,d)⋮⋯⋮f( Individual 1,d Individual 2,d⋯⋯ Individual n,d)

right] tag{3} Fit=⎣

⎡​f( Individual 1,1​f Individual 2,1​⋮f( Individual 1,d​​ Individual 1,2​ Individual ⋯⋮ Individual 2,d​​⋯…⋯​⋯⋯⋯​ Individual 1,d​) Individual 2,d​) Individual n,d​)​⎦

⎤​(3)
式中: Fit 为食肉植物种群的适应度值向量; f (  Individual  ) i f(text { Individual })_{i} f( Individual )i​ 为第 i i i 个食肉植物的适应度值。

2.2 分类与分组

接下来,将公式(1)中每个食肉植物个体,根据其适应度值的大小,按照升序排序(考 虑最小化问题)。选择种群中前 nCPlant 个候选解作为食肉植物(CP),种群中余下的 n n n Prey 侯选解作为猎物(Prey)。适应度排序矩阵和种群总体排序矩阵可以公式(4)和(5)来描 术。
S o r t e d _ F i t = [ f C P ( 1 ) f C P ( 2 ) ⋮ f C P ( n  CPlant  ) f Prey  ( n  CPlant  + 1 ) f Prey  ( n  CPlant  + 2 ) ⋮ f Prey (nCPlant  + n p r e y ) ] (4) {Sorted_Fit }=left[fCP(1)fCP(2)⋮fCP(n CPlant )fPrey (n CPlant +1)fPrey (n CPlant +2)⋮fPrey (nCPlant +nprey)

right] tag{4} Sorted_Fit=⎣

⎡​fCP(1)​fCP(2)​⋮fCP(n CPlant )​fPrey (n CPlant +1)​fPrey (n CPlant +2)​⋮fPrey (nCPlant +nprey)​​⎦

⎤​(4)
Sorted_Pop
= [ C P 1 , 1 C P 1 , 2 ⋯ ⋯ C P 1 , d C P 2 , 1 C P 2 , 2 ⋯ ⋯ C P 2 , d ⋮ ⋮ ⋮ ⋮ ⋮ C P n C P l a n t , 1 C P n C P l a n t , 2 ⋯ ⋯ C P n C P l a n t , d  Prey  n  CPlant  + 1 , 1  Prey  n C  Plant  + 1 , 2 ⋯ ⋯  Prey  n C P l a n t + 1 , d  Prey  n  CPlant  + 2 , 1  Prey  n  CPlant  + 2 , 2 ⋯ ⋯  Prey  n C  Clant  + 2 , d ⋮ ⋮ ⋮ ⋮ ⋮  Prey  n C  Clant  + n  Prey  , 1  Prey  n C  Plant  + n  Prey  , 2 ⋯ ⋯  Prey  n C P l a n t + n  Prey  , d ] (5) =left[CP1,1CP1,2⋯⋯CP1,dCP2,1CP2,2⋯⋯CP2,d⋮⋮⋮⋮⋮CPnCPlant,1CPnCPlant,2⋯⋯CPnCPlant,d Prey n CPlant +1,1 Prey nC Plant +1,2⋯⋯ Prey nCPlant+1,d Prey n CPlant +2,1 Prey n CPlant +2,2⋯⋯ Prey nC Clant +2,d⋮⋮⋮⋮⋮ Prey nC Clant +n Prey ,1 Prey nC Plant +n Prey ,2⋯⋯ Prey nCPlant+n Prey ,dright]tag{5} =⎣

⎡​CP1,1​CP2,1​⋮CPnCPlant,1​ Prey n CPlant +1,1​ Prey n CPlant +2,1​⋮ Prey nC Clant +n Prey ,1​​CP1,2​CP2,2​⋮CPnCPlant,2​ Prey nC Plant +1,2​ Prey n CPlant +2,2​⋮ Prey nC Plant +n Prey ,2​​⋯⋯⋮⋯⋯⋯⋮⋯​⋯⋯⋮⋯⋯⋯⋮⋯​CP1,d​CP2,d​⋮CPnCPlant,d​ Prey nCPlant+1,d​ Prey nC Clant +2,d​⋮ Prey nCPlant+n Prey ,d​​⎦

⎤​(5)
分组的过程需要模拟每一个食肉植物及其猎物的环境。在分组过程中,将最优适应度值的猎物分配给排名第一的食肉植物。同样地,排名第二和第三的猎物分别分配到排名第二和第三的食肉植物。这个过程不断重复,直到排名第nCPlant的猎物分配到排名第nCPlant的食肉植物。然后,将排名第nCPlant+1的猎物分配为排名第一的食肉植物,以此类推。这种分组是至关重要的,可以减少捕食许多劣质猎物的可能性,这将有助于食肉植物的生长。

2.3 生长(勘探阶段)

由于土壤营养不良,食肉植物会吸引、诱捕和消化猎物以供它们生长。猎物会被食肉植物的甜味引诱到,但它们可能会间歇性地成功地逃脱食肉性植物的控制。在这里,引入一个吸引率的概念。

对于每一分组,我们都会随机选择一个个体作为猎物。如果吸引率大于一个随机产生的数,猎物就会被食肉植物捕获并消化以促进生长。这种新的食肉植物的生长模型如下:
 New  C P i , j =  growth  × C P i , j + ( 1 −  growth  ) ×  Prey  v , j (6) text { New } C P_{i, j}=text { growth } times C P_{i, j}+(1-text { growth }) times text { Prey }_{v, j} tag{6}  New CPi,j​= growth ×CPi,j​+(1− growth )× Prey v,j​(6)

 growth  growth   rate  ×  rand  i , j (7)  growth growth  rate × rand i,j

tag{7} ​ growth growth  rate × rand i,j​​(7)

式中: C P i , j C P_{i, j} CPi,j​ 为排名第 r ˙ dot{r} r˙ 个食肉植物的位置; P r e y v , j P r e y_{v, j} Preyv,j​ 为随机选择猎物的位置; growth_rate 为预先定义的值; rand 是 [ 0 , 1 ] [0,1] [0,1] 范围内的随机数; 在 CPA 算法中, 在每一分组中只有一个食 肉植物, 而猎物的数量必须超过 2 个。在大多数情况下, CPA 算法的吸引率设为 0.8 0.8 0.8 。
 NewPrey  Pi,j  =  growth  ×  Prey  u , j + ( 1 −  growth  ) ×  Prey  v , j , u ≠ v (8) text { NewPrey } text { Pi,j }=text { growth } times text { Prey }_{u, j}+left(1-text { growth } )times text { Prey }_{v, j}, quad u neq vright. tag{8}  NewPrey  Pi,j = growth × Prey u,j​+(1− growth )× Prey v,j​,u=v(8)

g r o w t h = { g r o w t h _ r a t e × r a n d i , j , f ( P r e y v ) < f ( P r e y u ) 1 − g r o w t h _ r a t e × r a n d i , j , f ( P r e y v ) > f ( P r e y u ) (9) growth={growth_rate×randi,j,f(Preyv)<f(Preyu)1−growth_rate×randi,j,f(Preyv)>f(Preyu)

tag{9} growth={growth_rate×randi,j​,f(Preyv​)<f(Preyu​)1−growth_rate×randi,j​,f(Preyv​)>f(Preyu​)​(9)

式中: Prey y u , j y_{u, j} yu,j​ 为另一个在第 im个分组中随机选择猎物的位置; 食肉植物和猎物的生长过程不断重复, 直到达到一个预定义的迭代次数, group_itep。

2.4 开发阶段

食肉植物吸收猎物体内的营养物质, 并利用这些营养物质进行生长和繁殖。对于繁殖, 只有排名第一的食肉植物, 即种群中最好的解决方案, 才被允许繁殖。这是为了确保在 CPA 算法的开发阶段, 只关注最优的解决方案。可以避免对其他解决方案的非必要的利用, 从而 节省了计算成本。排名第一的食肉植物的繁殖过程建模为:
 New  C P i , j =  growth  × C P i , j + ( 1 −  growth  ) ×  Prey  v , j (10) text { New } C P_{i, j}=text { growth } times C P_{i, j}+(1-text { growth }) times text { Prey }_{v, j}tag{10}  New CPi,j​= growth ×CPi,j​+(1− growth )× Prey v,j​(10)

 growth  = g r o w t h _ r a t e ×  rand  i , j (11)  growth =growth_rate× rand i,j

tag{11}  growth =growth_rate× rand i,j​​(11)

式中: C P 1 , j C P_{1, j} CP1,j​ 为排名第 1 的食肉植物的位置, 即最优解; C P v , j C P_{v, j} CPv,j​ 为随机选择猎物的食肉植物的位置; Reproduction_rate 为开发阶段预先定义的值。该过程重复 ncPrant次。在繁殖过程中, 根据第 j mathrm{j} j 个个维度随机重新选择 v mathrm{v} v 食肉植物。在生长过程中, 猎物是随机重新选择的, 而不管第 j mathrm{j} j 个维度。

2.5 适应度值更新与整合

新产生的食肉植物和猎物与之前的种群结合,形成了一个具有[n+nCPlant(group_iter)+nCPlant]×d维度的新种群。更具体地说,n个个体、nCPlant(group_iter)个个体和nCPlant个个体分别是来自原始种群、生长过程和繁殖过程的个体。随后,根据新一组个体的适应度值按升序排序。然后从这一组中选择排名前n名的个体作为新的候选解。因此,这种精英选择策略确保了适合的方案被选择,并在下一代繁殖。

请添加图片描述

3.实验结果

请添加图片描述

4.参考文献

[1] Ong K M , Ong P , Sia C K . A carnivorous plant algorithm for solving global optimization problems[J]. Applied Soft Computing, 2020, 98(April):106833.

5.Matlab代码

相关知识

机器学习算法应用于智能农业植物病虫害检测.pptx
花授粉优化算法及代码实现
拉普拉斯特征映射算法参数优化研究
适应性花朵授粉算法研究
基于递归神经网络算法的电子物流配送系统配送路径优化
基于机器学习算法的农作物病虫害智能诊断与防治研究
智能分类算法在植物分类中的应用研究
整数规划的花授粉算法
花朵授粉算法【记录】
鲜花分类算法

网址: 智能优化算法:食肉植物算法 https://www.huajiangbk.com/newsview1392208.html

所属分类:花卉
上一篇: 雅思OGtest7阅读passa
下一篇: 认识食肉植物

推荐分享