/* 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. 第三个spring冲刺总结(附团队贡献分)

    基于调查需求下完成的四则运算,我们完成了主要的3大功能. 第一,普通的填空题运算,这个是传统的运算练习方式,团队都认为这个选项是必要的,好的传统要留下来,在个人经历中,填空练习是一个不错的选择. 第二 ...

  2. octave基本指令5

    octave基本指令5 控制语句 for >> v=zreos(5,1) v = 0 0 0 0 0 >> for i=1:10, > v(i) = 2^i; > ...

  3. vue-devtools 的安装和使用

    vue-devtools的安装与使用 一.在github上下载压缩包,github下载地址:https://github.com/vuejs/vue-devtools 二.解压到本地的某盘 三.用你的 ...

  4. 常见的HTTP报头(头参数)

    本内容摘抄自<RESTful WebServices> 中文译本附录C '常见的HTTP报头'. 原文作者:Leonard Ricbardson & Sam Ruby 翻译:徐涵. ...

  5. html DOM 方法和屬性

    html利用javascript對節點執行動作: 每一個節點是一個節點對象,對節點的動作是通過方法和屬性接口實現的: 方法:就是執行的動作: 屬性就是節點的屬性(包括設置和獲取): 常見方法和作用: ...

  6. BZOJ3419[POI2013]taxis——贪心

    题目大意: 一条线段有三个点,0为初始位置,d为出租车总部位置,m为家的位置,人要叫车,有n辆车可以提供,每辆车有一个路程上限,并且都从车站出发,叫的车行驶之后不必须回到车站,问最少叫几辆车. 一定能 ...

  7. AC自动机-HDU3065-简单题

    http://acm.hdu.edu.cn/showproblem.php?pid=3065 需要记录匹配情况的AC自动机,没有清空一些数组导致wa了几发. /*------------------- ...

  8. 如何修改可运行Jar包,如何反编译Jar包

    将可运行Jar包,反编译成项目,修改代码,再次编译,打包. 需要工具:jd-gui.myeclipse 具体步骤: 1.使用jd-gui打开原始的Jar包,选择File-->Save All  ...

  9. Hdoj 1009.FatMouse' Trade 题解

    Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding th ...

  10. 自学Aruba2.2-Aruba Web UI --Monitoring面板介绍

    点击返回:自学Aruba之路 自学Aruba2.2-Aruba Web UI --Monitoring面板介绍 1. Monitoring面板-NETWORK Network Summary      ...