Go最全蚁群算法(Ant Colony Optimization)(2),2024年最新泪目

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

# 选择下一个城市
def __choice_next_city(self):

    next_city = -1
    select_citys_prob = [0.0 for i in range(city_num)]  #存储去下个城市的概率
    total_prob = 0.0

    # 获取去下一个城市的概率
    for i in range(city_num):
        if self.open_table_city[i]:
            try :
                # 计算概率:与信息素浓度成正比,与距离成反比
                select_citys_prob[i] = pow(pheromone_graph[self.current_city][i], ALPHA) * pow((1.0/distance_graph[self.current_city][i]), BETA)
                total_prob += select_citys_prob[i]
            except ZeroDivisionError as e:
                print ('Ant ID: {ID}, current city: {current}, target city: {target}'.format(ID = self.ID, current = self.current_city, target = i))
                sys.exit(1)

    # 轮盘选择城市
    if total_prob > 0.0:
        # 产生一个随机概率,0.0-total_prob
        temp_prob = random.uniform(0.0, total_prob)
        for i in range(city_num):
            if self.open_table_city[i]:
                # 轮次相减
                temp_prob -= se
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值