/* Routine for mergeing two populations */

 # include <stdio.h>
# include <stdlib.h>
# include <math.h> # include "global.h"
# include "rand.h" /* Routine to merge two populations into one */
void merge(population *pop1, population *pop2, population *pop3)
{
int i, k;
for (i=; i<popsize; i++)
{
copy_ind (&(pop1->ind[i]), &(pop3->ind[i]));
}
for (i=, k=popsize; i<popsize; i++, k++)
{
copy_ind (&(pop2->ind[i]), &(pop3->ind[k]));
}
return;
} /* Routine to copy an individual 'ind1' into another individual 'ind2' */
void copy_ind (individual *ind1, individual *ind2)
{
int i, j;
ind2->rank = ind1->rank;
ind2->constr_violation = ind1->constr_violation;
ind2->crowd_dist = ind1->crowd_dist;
if (nreal!=)
{
for (i=; i<nreal; i++)
{
ind2->xreal[i] = ind1->xreal[i];
}
}
if (nbin!=)
{
for (i=; i<nbin; i++)
{
ind2->xbin[i] = ind1->xbin[i];
for (j=; j<nbits[i]; j++)
{
ind2->gene[i][j] = ind1->gene[i][j];
}
}
}
for (i=; i<nobj; i++)
{
ind2->obj[i] = ind1->obj[i];
}
if (ncon!=)
{
for (i=; i<ncon; i++)
{
ind2->constr[i] = ind1->constr[i];
}
}
return;
}
copy_ind  具体进行两个个体 内容拷贝的函数。
29     ind2->rank = ind1->rank;
30 ind2->constr_violation = ind1->constr_violation;
31 ind2->crowd_dist = ind1->crowd_dist; 复制个体的 支配层 排序值。
复制个体的  限制条件  的超出值, 大于等于0未超出, 小于0为超出限制。
复制个体的  拥挤距离 。

判断个体的编码, 把个体的具体编码值 复制。
复制个体的  各个  目标函数的数值。
复制个体的  各个限制条件的  数值, 所有限制条件的数值之和等于 constr_violation
												

多目标遗传算法 ------ NSGA-II (部分源码解析)父、子种群合并 merge.c的更多相关文章

  1. 多目标遗传算法 ------ NSGA-II (部分源码解析) 临时种群生成新父代种群 fillnds.c

    /* Nond-domination based selection routines */ # include <stdio.h> # include <stdlib.h> ...

  2. 多目标遗传算法 ------ NSGA-II (部分源码解析)介绍

    NSGA(非支配排序遗传算法).NSGA-II(带精英策略的快速非支配排序遗传算法),都是基于遗传算法的多目标优化算法,是基于pareto最优解讨论的多目标优化. 在官网: http://www.ii ...

  3. 多目标遗传算法 ------ NSGA-II (部分源码解析) 交叉操作 crossover.c

    遗传算法中的交叉操作是 对NSGA-II  源码分析的  最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的  函数模块. 这里,首先提一下,遗传算法的  交叉操作.变异操作都 ...

  4. 多目标遗传算法 ------ NSGA-II (部分源码解析)目标函数 problemdef.c

    /* Test problem definitions */ # include <stdio.h> # include <stdlib.h> # include <ma ...

  5. 多目标遗传算法 ------ NSGA-II (部分源码解析)状态报告 打印 report.c

    /* Routines for storing population data into files */ # include <stdio.h> # include <stdlib ...

  6. 多目标遗传算法 ------ NSGA-II (部分源码解析) 拥挤距离计算 crowddist.c

    /* Crowding distance computation routines */ # include <stdio.h> # include <stdlib.h> # ...

  7. 多目标遗传算法 ------ NSGA-II (部分源码解析)README 算法的部分英文解释

    This is the Readme file for NSGA-II code. About the Algorithm--------------------------------------- ...

  8. 多目标遗传算法 ------ NSGA-II (部分源码解析) 实数、二进制编码的变异操作 mutation.c

    遗传算法的变异操作 /* Mutation routines */ # include <stdio.h> # include <stdlib.h> # include < ...

  9. 多目标遗传算法 ------ NSGA-II (部分源码解析)两个个体支配判断 dominance.c

    /* Domination checking routines */ # include <stdio.h> # include <stdlib.h> # include &l ...

  10. 多目标遗传算法 ------ NSGA-II (部分源码解析)二元锦标赛选择 tourselect.c

    tourselect.c  文件中共有两个函数: selection (population *old_pop, population *new_pop) individual* tournament ...

随机推荐

  1. 利用ss-redir加速服务器上国外服务的访问

    https://blog.microdog.me/2016/06/28/Speed-Up-Network-Accessing-To-Overseas-Services-On-Your-Server/

  2. FreeMarker has_content等价于StringUtils.isNotNullOrEmpty

    has_content It is true if the variable exists (and isn't Java null) and is not "empty", ot ...

  3. HTML 5 Canvas vs. SVG

    pick up from http://www.w3school.com.cn/html5/html_5_canvas_vs_svg.asp Canvas 与 SVG 的比较 下表列出了 canvas ...

  4. Java的Spring内实现的mini版内存"计数器"功能

    工期紧急,不让用Redis,自己实现了一个Spring内的mini版内存"计数器"功能,很简陋,和业务耦合太紧密,需要改进. public Long getCreationCoun ...

  5. vuex最简单、最详细的入门文档

    如果你在使用 vue.js , 那么我想你可能会对 vue 组件之间的通信感到崩溃 . 我在使用基于 vue.js 2.0 的UI框架 ElementUI 开发网站的时候 , 就遇到了这种问题 : 一 ...

  6. Qt__CMakeLists.txt

    cmake_minimum_required(VERSION 3.1.0) project (Project) if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FL ...

  7. Java之StringBuffer使用方法

    package basic; //StringBuffer的使用方法,用于保存频繁修改的字符串 public class StringBufferDemo { public static void m ...

  8. Ubuntu 16.04安装Maven

    此篇为http://www.cnblogs.com/EasonJim/p/7139275.html的分支页. 前提:必须正确安装JDK. 一.通过二进制包(tar.gz)安装 下载: 进入下载列表:h ...

  9. BZOJ4200 NOI2015小园丁与老司机(动态规划+上下界网络流)

    一看上去就是一个二合一的题.那么先解决第一部分求最优路线(及所有可能在最优路线上的线段). 由于不能往下走,可以以y坐标作为阶段.对于y坐标不同的点,我们将可以直接到达的两点连边,显然这样的边的个数是 ...

  10. 看完让你彻底理解 WebSocket 原理,附完整的实战代码(包含前端和后端)

    1.前言 最近有同学问我有没有做过在线咨询功能.同时,公司也刚好让我接手一个 IM 项目.所以今天抽时间记录一下最近学习的内容.本文主要剖析了 WebSocket 的原理,以及附上一个完整的聊天室实战 ...