/* 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. JAVA面对对象(三)——Super、static、final关键字

    Super 使用super关键字可以直接调用父类中的构造方法.属性.普通方法 super调用父类构造方法的操作,与this调用构造方法一样,语句必须放在子类构造方法的首行 public class P ...

  2. 『编程题全队』Beta 阶段冲刺博客一

    1.提供当天站立式会议照片一张 2.每个人的工作 (有work item 的ID) (1) 昨天已完成的工作 孙志威: 1.讨论并制定了Beta阶段的计划 孙慧君: 1.Beta阶段任务的认领 黄华林 ...

  3. PHP和JavaScript将字符串转换为数字string2int

    在看廖雪峰的JavaScript教程时,里面有一个题就是利用reduce()将string转换为int,我看评论中贴出的方法,当时觉得挺意外了,以为他只用了一行代码,即下面这行代码 var str=& ...

  4. JS判断浏览器种类

    function myBrowser() {                        var userAgent = navigator.userAgent; //取得浏览器的userAgent ...

  5. [转帖]super-inspire

    quickStart/快速开始 访问临时服务器地址, 你可以在这里选择一个喜欢的系统, 然后系统将自动创建该系统的容器, 并自动打开新的网页进入 web shell 交互. 目前支持 Ubuntu14 ...

  6. [转帖] ASP ASPX 等知识

    asp.asp.net..aspx..ascx..ashx的简单说明 https://www.cnblogs.com/jhcelue/p/6736147.html ASP是动态server页面(Act ...

  7. [转帖]git命令参考手册

                      git init                                                  # 初始化本地git仓库(创建新仓库) git ...

  8. linux_查看磁盘与目录容量

    一.查看磁盘容量命令df(report file system disk space usage) 终端运行 $ df 输出结果 我的物理主机上的 /dev/sda5 是对应着主机硬盘的分区,字母 a ...

  9. CSS 居中(拿来主义自用)

    居中是我们使用css来布局时常遇到的情况.使用css来进行居中时,有时一个属性就能搞定,有时则需要一定的技巧才能兼容到所有浏览器,本文就居中的一些常用方法做个简单的介绍. 注:本文所讲方法除了特别说明 ...

  10. TensorFlow中的优化算法

    搭建好网络后,常使用梯度下降类优化算法进行模型参数求解,模型越复杂我们在训练神经网络的过程上花的时间就越多,为了解决这一问题,我们就需要找一些优化算法来提高训练速度,TF的tf.train模块中提供了 ...