多目标遗传算法 ------ NSGA-II (部分源码解析)介绍
NSGA(非支配排序遗传算法)、NSGA-II(带精英策略的快速非支配排序遗传算法),都是基于遗传算法的多目标优化算法,是基于pareto最优解讨论的多目标优化。
在官网:
http://www.iitk.ac.in/kangal/codes.shtml
可以下载到 NSGA-II 的C语言版源码,下载最新版后打开如下:

其中,nsga2r.c 为主文件,打开后找到核心代码,如下:
for (i=; i<=ngen; i++)
{
selection (parent_pop, child_pop);
mutation_pop (child_pop);
decode_pop(child_pop);
evaluate_pop(child_pop);
merge (parent_pop, child_pop, mixed_pop);
fill_nondominated_sort (mixed_pop, parent_pop);
/* Comment following three lines if information for all
generations is not desired, it will speed up the execution */
fprintf(fpt4,"# gen = %d\n",i);
report_pop(parent_pop,fpt4);
fflush(fpt4);
printf("\n gen = %d",i);
fflush(stdout);
}
由第1行代码可知,初始化生成代码为第一代,其后的操作为第 2 代到设定的迭代次数 ngen
由第3行代码可知,selection 函数 (二元锦标赛选择,SBX交叉)等功能的实现包装在一起。
由第4行代码可知, mutation_pop 函数 对新种群( child_pop ) 进行变异操作。
由第5行代码可知,decode_pop 函数 为对二进制编码的遗传个体进行解码操作。
由第6行代码可知,evaluate_pop 函数 是对新种群( child_pop ) 进行多目标函数值的计算。
由第7行代码可知,merge 函数 将 父种群 和 子种群 合并成临时种群(mixed_pop)。
由第8行代码可知,fill_nondominated_sort 对临时种群(mixed_pop) 非支配排序,拥挤距离判断。
由第12行代码可知, report_pop 对 父种群(parent_pop)中的个体的多目标函数值,支配层,拥挤距离,个体编码进行打印。
多目标遗传算法 ------ NSGA-II (部分源码解析)介绍的更多相关文章
- 多目标遗传算法 ------ NSGA-II (部分源码解析) 交叉操作 crossover.c
遗传算法中的交叉操作是 对NSGA-II 源码分析的 最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的 函数模块. 这里,首先提一下,遗传算法的 交叉操作.变异操作都 ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析)目标函数 problemdef.c
/* Test problem definitions */ # include <stdio.h> # include <stdlib.h> # include <ma ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析)状态报告 打印 report.c
/* Routines for storing population data into files */ # include <stdio.h> # include <stdlib ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析) 拥挤距离计算 crowddist.c
/* Crowding distance computation routines */ # include <stdio.h> # include <stdlib.h> # ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析)README 算法的部分英文解释
This is the Readme file for NSGA-II code. About the Algorithm--------------------------------------- ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析) 实数、二进制编码的变异操作 mutation.c
遗传算法的变异操作 /* Mutation routines */ # include <stdio.h> # include <stdlib.h> # include < ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析)两个个体支配判断 dominance.c
/* Domination checking routines */ # include <stdio.h> # include <stdlib.h> # include &l ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析)二元锦标赛选择 tourselect.c
tourselect.c 文件中共有两个函数: selection (population *old_pop, population *new_pop) individual* tournament ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析) 临时种群生成新父代种群 fillnds.c
/* Nond-domination based selection routines */ # include <stdio.h> # include <stdlib.h> ...
随机推荐
- Java集合之Stack 源码分析
1.简介 栈是数据结构中一种很重要的数据结构类型,因为栈的后进先出功能是实际的开发中有很多的应用场景.Java API中提供了栈(Stacck)的实现,简单使用如下所示 package com.tes ...
- 如何使用AdvancedInstaller在安装包中运行一个.bat文件
原文:如何使用AdvancedInstaller在安装包中运行一个.bat文件 1, 首先要保证你的Files and Folders模块下的Application Folder文件夹下包含你要运行 ...
- Scala 的 Web 框架 Lift 开始 3.0 版本开发
Scala 的 Web 框架 Lift 开始 3.0 版本开发 http://demo.liftweb.net/ http://liftweb.net/download Lift 框架在不断的成长和改 ...
- SQL Server 2005中设置Reporting Services发布web报表的匿名访问
原文:SQL Server 2005中设置Reporting Services发布web报表的匿名访问 一位朋友提出个问题:集成到SQL Server 2005中的Reporting Services ...
- SQL Server 增删改
--use用来设置当前使用哪个数据库use StudentDb--go批处理go --T-SQL中不区分大小写,数据库表中的数据是区分大小写的--例如:insert与INSERT不区分大小写,数据库表 ...
- robotlegs2.0框架实例源码带注释
robotlegs2.0框架实例源码带注释 Robotlegs2的Starling扩展 有个老外写了robotleges2的starling扩展,地址是 https://github.com/brea ...
- 于快速创建 IEqualityComparer<T> 实例的类 Equality<T>
于快速创建 IEqualityComparer<T> 实例的类 Equality<T> 原文中的 Equality<T> 实现如下: 1 2 3 4 5 6 7 8 ...
- android通过程序收起通知栏
1. 添加权限 <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> 2. ...
- windows phone 8环境搭建
windows phone 8 开发系列(一)环境搭建 一:前奏说明 本人一名普通的neter,对新玩意有点小兴趣,之前wp7出来的时候,折腾学习过点wp7开发,后来也没怎么用到(主要对微软抛弃w ...
- DDD社区官网
DDD社区官网上一篇关于聚合设计的几个原则的简单讨论: 聚合是用来封装真正的不变性,而不是简单的将对象组合在一起 聚合应尽量设计的小 聚合之间通过ID关联 聚合内强一致性,聚合之间最终一致性 从聚合和 ...