多目标遗传算法 ------ 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> ...
随机推荐
- js 文字预写匹配
效果图: demo如下: <!DOCTYPE html> <html> <head> <title>文字预写</title> </he ...
- How do I create an IIS application and application pool using InnoSetup script
Create an IIS application. Create a new IIS application pool and set it's .NET version to 4. Set the ...
- LINUX SCP 远程 文件 复制
首先,以确保直接两个机器IP可以在每个ping通过 然后使用SCP命令从第一台主机向第二台主机复制文件 scp src chiwei@192.168.8.144:/home/chiwei/mydisk ...
- Smarty从配置文件读取的变量
从配置文件读取的变量 配置文件中的变量需要通过用两个"#"或者是smarty的保留变量 $smarty.config.来调用(下节将讲到) 第二种语法在变量作为属性值并被引号括住的 ...
- Ecological Premium - UVa10300
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva10300.html 题目描述 Pr ...
- 正则表达式测试分析工具Expresso
正则表达式测试分析工具Expresso 一个正则表达式的小工具--myRegexHelper 把以前做的一个功能抽取出来做成一个小的正则表达式测试工具.没什么特色,有两点功能: 一.方便的测试正则 ...
- 浅谈DevExpress<三>:在GridView中加载动态图片
今天的演示效果如下:在GridView中的下拉框中选中一种颜色,则后面的加载相应的图片,如下图: 1.
- MongoDB:利用官方驱动改装为EF代码风格的MongoDB.Repository框架 六:支持多数据库操作
本次主要内容:修正MongoDB.Repository框架对多数据库的支持. 在之前的五篇文章中对MongoDB.Repository框架做了简单的介绍是实现思路.之前是考虑MongoDB.Repos ...
- 模块化开发AraeRegistration
.NET/ASP.NET MVC(模块化开发AraeRegistration) 阅读目录: 1.开篇介绍 2.AreaRegistration注册路由(传递路由上下文进行模块化注册) 1]开篇介绍 A ...
- OAuth的一个.NET开源实现
从编译DotNetOpenAuth中学到的程序集强签名知识 OAuth的一个.NET开源实现,官方网站:http://dotnetopenauth.net/ . 从GitHub签出DotNetOpen ...