野狗优化算法

野狗搜索算法

一、理论基础

野狗优化算法(Dingo Optimization Algorithm,DOA)是于2021年提出的一种新型智能优化算法,该算法灵感来源于野狗的狩猎策略,即迫害攻击、分组策略和食腐行为。具有寻优能力强,收敛速度快等特点。

1、策略一:集体攻击

x i → ( t + 1 ) = β i ∑ k = 1 n a ∣ φ k ( t ) → − x i ( t → ) ∣ n a − x ∗ → ( t + 1 ) \overrightarrow {{\rm{xi}}} (t + 1) = \beta i\sum\limits_{k = 1}^{na} {{{\left| {\overrightarrow {\varphi k(t)} - \overrightarrow {xi(t} )} \right|} \over {na}} - } \overrightarrow {{\rm{x*}}} (t + 1) xi (t+1)=βik=1nana φk(t) xi(t ) x (t+1)
其中, x i → ( t + 1 ) \overrightarrow {{\rm{xi}}} (t + 1) xi (t+1)是搜索代理的新位置(表示野狗的移动);na是在[2,SizePop/2]的逆序中生成的随机整数,其中SizePop 是野狗种群的规模; φ k ( t ) → {\overrightarrow {\varphi k(t)} } φk(t) 是搜索代理(将攻击的野狗)的子集,其中 x i ( t ) → {\overrightarrow {xi(t)} } xi(t) 是当前搜索代理; x ∗ → ( t + 1 ) \overrightarrow {{\rm{x*}}} (t + 1) x (t+1)是上一次迭代中发现的最佳搜索代理; β i \beta i βi是[−2,2]内均匀生成的随机数,它是一个比例因子,可改变野狗轨迹的大小。

2、策略二:迫害

野狗通常捕猎小猎物,直到单独捕获为止。式(3)模拟了这种行为:
x i → ( t + 1 ) = x ∗ → ( t + 1 ) + β 1 ∗ e β 2 ∗ ( x r 1 → ( t ) − x i → ( t ) ) \overrightarrow {{\rm{xi}}} (t + 1) = \overrightarrow {{\rm{x*}}} (t + 1) + \beta 1*{e^{\beta 2}}*(\overrightarrow {{\rm{xr1}}} (t) - \overrightarrow {{\rm{xi}}} (t)) xi (t+1)=x (t+1)+β1eβ2(xr1 (t)xi (t))
其中, x i → ( t + 1 ) \overrightarrow {{\rm{xi}}} (t + 1) xi (t+1)是也够的新位置, x i → ( t ) \overrightarrow {{\rm{xi}}} (t) xi (t)是上一次的最佳位置, β 2 {\beta 2} β2是在[-1,1]区间内均匀生成的随机数,ri是在从1到最大搜索代理大小的区间内生成的随机数, x r 1 → ( t ) \overrightarrow {{\rm{xr1}}} (t) xr1 (t)是随机生成的r1个野狗,其中i≠r1

3、策略三:食腐

清扫即为野狗在它们的生活地随意行走时找到腐肉吃的行为.
x i → ( t + 1 ) = 1 2 [ e β 2 ∗ x r 1 → ( t ) − ( − 1 ) σ ∗ x i → ( t ) ] \overrightarrow {{\rm{xi}}} (t + 1) = {1 \over 2}[{e^{\beta 2}}*\overrightarrow {{\rm{xr1}}} (t) - {( - 1)^\sigma }*\overrightarrow {{\rm{xi}}} (t)] xi (t+1)=21[eβ2xr1 (t)(1)σxi (t)]
其中,σ是随机生成的二进制数,σ∈(0,1)

4、策略四:野狗的存活率

澳大利亚野狗面临灭绝的危险,主要是因为非法狩猎。在DOA中,野狗的存活率值由式(5)给出:
s u r v i v a l ( i ) = f i t n e s s max ⁡ − f i t n e s s ( i ) f i t n e s s max ⁡ − f i t n e s s min ⁡ survival(i) = {{fitness\max - fitness(i)} \over {fitness\max - fitness\min }} survival(i)=fitnessmaxfitnessminfitnessmaxfitness(i)
其中, f i t n e s s max ⁡ {fitness\max } fitnessmax f i t n e s s min ⁡ {fitness\min } fitnessmin分别是当代中最差和最佳的适应度值,而 f i t n e s s ( i ) {fitness(i)} fitness(i)是第i个搜索代理的当前适应度值。式中的生存向量包含[0,1]区间内的归一化。下式通过策略三应用于低生存率,例如,生存率值等于或小于0.3。
x i → ( t + 1 ) = x ∗ → ( t ) + 1 2 [ x r 1 → ( t ) − ( − 1 ) σ ∗ x r 2 → ( t ) ] \overrightarrow {{\rm{xi}}} (t + 1) = \overrightarrow {{\rm{x*}}} (t) + {1 \over 2}[\overrightarrow {{\rm{xr1}}} (t) - {( - 1)^\sigma }*\overrightarrow {{\rm{xr2}}} (t)] xi (t+1)=x (t)+21[xr1 (t)(1)σxr2 (t)]
其中,r1和r2是从1到搜索代理最大大小区间生成的随机数,r1≠r2, x r 1 → ( t ) \overrightarrow {{\rm{xr1}}} (t) xr1 (t) x r 2 → ( t ) \overrightarrow {{\rm{xr2}}} (t) xr2 (t)是随机生成的第r1r2个野狗, x ∗ → ( t ) \overrightarrow {{\rm{x*}}} (t) x (t)是上一代野狗的最佳位置,σ 是算法随机生成的二进制数,σ ∈ { 0,1 }

二、实验仿真

![Alt]在这里插入图片描述

三、参考文献

[1] Hernán Peraza-Vázquez, Adrián F. Peña-Delgado, Gustavo Echavarría-Castillo, et al. A Bio-Inspired Method for Engineering Design Optimization Inspired by Dingoes Hunting Strategies[J]. Mathematical Problems in Engineering, 2021, 2021: 9107547.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
野狗优化算法是一种基于种群的全局优化算法,其灵感来源于野狗捕食时的行为。这种算法的主要特点是通过不断的迭代和自适应调整来找到最优解。下面是野狗优化算法的Python代码示例: ```python import numpy as np class WOA: def __init__(self, func, dim, max_iter=100, lb=-100, ub=100, population=10): self.func = func self.dim = dim self.max_iter = max_iter self.lb = lb self.ub = ub self.population = population def init_population(self): return np.random.uniform(low=self.lb, high=self.ub, size=(self.population, self.dim)) def get_fitness(self, population): fitness = np.zeros(self.population) for i in range(self.population): fitness[i] = self.func(population[i]) return fitness def update_position(self, population, leader_pos): a = 2 - 2 * np.linspace(0, 1, self.max_iter) ** 2 r1 = np.random.rand(self.population, self.dim) r2 = np.random.rand(self.population, self.dim) A = 2 * a * r1 - population) new_population = leader_pos - A * D return new_population def run(self): population = self.init_population() fitness = self.get_fitness(population) best_index = np.argmin(fitness) best_fitness = fitness[best_index] best_position = population[best_index] for i in range(self.max_iter): a = 2 - 2 * (i / (self.max_iter - 1)) ** 2 A = 2 * a * np.random.rand(self.dim) - a C = 2 * np.random.rand(self.dim) b = 1 l = (a - 1) * np.random.rand() + 1 p = np.random.rand() if p < 0.5: if np.abs(A) < 1: new_population = self.update_position(population, best_position) else: rand_leader_index = np.random.randint(0, self.population) rand_leader_pos = population[rand_leader_index] new_population = self.update_position(population, rand_leader_pos) else: distance_to_leader = np.abs(C * best_position - population) new_population = distance_to_leader * np.exp(b * l) * np.cos(2 * np.pi * l) + best_position new_population[new_population < self.lb] = self.lb new_population[new_population > self.ub] = self.ub new_fitness = self.get_fitness(new_population) new_best_index = np.argmin(new_fitness) if new_fitness[new_best_index] < best_fitness: best_fitness = new_fitness[new_best_index] best_position = new_population[new_best_index] population = new_population fitness = new_fitness return best_position, best_fitness ``` 以上是一个简单的野狗优化算法的Python实现,需要提供目标函数、维度、最大迭代次数、上下界和种群大小等参数。在`run()`方法中进行算法的迭代,并返回最优解及其对应的函数值。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昨日与你1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值