多目标遗传算法 ------ 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> ...
随机推荐
- 用jQuery的ajax的功能实现输入自动提示的功能
注意事项:要使用jQuery首先要把它的包引用进来( <script type="text/javascript" language="javascript&quo ...
- Andorid类似Fragment更换布置方法
public void replaceRightView(View v) { int f = LinearLayout.LayoutParams.MATCH_PARENT; LinearLayout. ...
- 【转】【Android工具】被忽略的UI检视利器:Hierarchy Viewer
原文:http://blog.csdn.net/ddna/article/details/5527072 Hierarchy Viewer是随AndroidSDK发布的工具,位置在tools文件夹下, ...
- asp.net mvc 中 tempdata、viewdata、viewbag生命周期(转载)
TempData ViewData ViewBag都可以用来保存数据,它们之间的区别如下: TempData保存在Session中,Controller每次执行请求的时候,会 ...
- jquery简单异步读取xml文件
$.ajax({ url: '../XmlFiles/Sm.xml', async: true, cache: false, ...
- beanutils中Lazy
public class LazyBean { // public static void main(String[] args) {// DynaBean dynaBean=ne ...
- 多线程中lock用法的经典实例
多线程中lock用法的经典实例 一.Lock定义 lock 关键字可以用来确保代码块完成运行,而不会被其他线程中断.它可以把一段代码定义为互斥段(critical section),互斥段在一 ...
- Windows Live Writer 完成开源并推出开源分支
原文:Announcing Open Live Writer - An Open Source Fork of Windows Live Writer Windows Live Writer是一款发布 ...
- MFC双缓冲和裁剪问题导致闪烁
问题描述: 应用场景:在对话框中,自定义一个MFC图形控件(为了描述方便,暂定为HSPaintControl),控件覆盖整个对话框的客户区,属于最底层的控件,在这之上放置了很多其他的小图形控件. 问题 ...
- 开发框架(OrchardNoCMS)--BootStrap
基于ASP.NET MVC的热插拔模块式开发框架(OrchardNoCMS)--BootStrap 按照几个月之前的计划,也应该写一个使用Bootstrap作为OrchardNoCMS的UI库.之前这 ...