多目标遗传算法 ------ 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> ...
随机推荐
- PHP专业开发IDE——Zend Studio 10.5预览版发布
Zend Studio是新一代的PHP IDE,高效的开发和维护PHP代码是它的核心.Zend公司目前已发布了Zend Studio 10.5预览版,预览版中提高了快速响应能力和时时误差检查.因此使用 ...
- 用jQuery的ajax的功能实现输入自动提示的功能
注意事项:要使用jQuery首先要把它的包引用进来( <script type="text/javascript" language="javascript&quo ...
- leetcode[94] Unique Binary Search Trees
给定n,那么从1,2,3...n总共可以构成多少种二叉查找数呢.例如给定3 Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ ...
- wcf实例模型(随记)
-----------------------------------------实例模型: 1.InstanceContentextMode: -------PerCall(单调):无状态,每次调用 ...
- 使用response实现文件下载功能
response.setContentType("text/html;charset=utf-8"); response.setCharacterEncoding("u ...
- OpenGl绘制螺旋线
/** * 缓冲区工具类 */public class BufferUtil { /** * 将浮点数组转换成字节缓冲区 */ public static ByteBuffer arr2ByteB ...
- 数据结构栈的java实现
近来复习数据结构,自己动手实现了栈.栈是一种限制插入和删除只能在一个位置上的表.最基本的操作是进栈和出栈,因此,又被叫作“先进后出”表. 实现方式是这样的:首先定义了一个接口,然后通过这个接口实现了线 ...
- 使用指定格式的字符串变量格式化日期字符串,DateAndTime取时间间隔
private void btn_GetTime_Click(object sender, EventArgs e) { lab_time.Text = DateTime.Now.ToString(& ...
- c#二进制、十进制、16进制之间的转换
//十进制转二进制 Console.WriteLine(Convert.ToString(69, 2)); //十进制转八进制 Console.WriteLine(Convert.ToString(6 ...
- java使用javamail读取邮箱(收件箱为例)
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import ...