/* A custom doubly linked list implemenation */

 # include <stdio.h>
# include <stdlib.h>
# include <math.h> # include "global.h"
# include "rand.h" /* Insert an element X into the list at location specified by NODE */
void insert (list *node, int x)
{
list *temp;
if (node==NULL)
{
printf("\n Error!! asked to enter after a NULL pointer, hence exiting \n");
exit();
}
temp = (list *)malloc(sizeof(list));
temp->index = x;
temp->child = node->child;
temp->parent = node;
if (node->child != NULL)
{
node->child->parent = temp;
}
node->child = temp;
return;
} /* Delete the node NODE from the list */
list* del (list *node)
{
list *temp;
if (node==NULL)
{
printf("\n Error!! asked to delete a NULL pointer, hence exiting \n");
exit();
}
temp = node->parent;
temp->child = node->child;
if (temp->child!=NULL)
{
temp->child->parent = temp;
}
free (node);
return (temp);
}
typedef struct lists
{
int index;
struct lists *parent;
struct lists *child;
} list;

list  结构体中有两个指针,可构成双向链表,数值空间存放   索引序号  。

insert  函数

申请一块新的内存空间,放在在 list  指针   指向的空间之后。

del  函数

将  list  指向 的个体空间释放。

以上两个操作在插入,删除操作后都有修改指针操作,保证原有链表 的  上下链接正常。

多目标遗传算法 ------ NSGA-II (部分源码解析)辅助变量 双链表操作 list.c的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

随机推荐

  1. JHipster - Generate your Spring Boot + Angular/React applications!

    JHipster - Generate your Spring Boot + Angular/React applications!https://www.jhipster.tech/

  2. JavaScript两数相加(踩坑)记录

    Adding two numbers concatenates them instead of calculating the sum JavaScript里两个变量 var a = 2: var b ...

  3. JMX configuration for Tomcat

    Window下执行步骤: D:\apache-tomcat-7.0.57\bin\catalina.bat set CATALINA_OPTS=-Dcom.sun.management.jmxremo ...

  4. 测试 多线程 实现 callable 带返回值

    package threadTest; import java.util.ArrayList; import java.util.Date; import java.util.concurrent.C ...

  5. 使用Hexo搭建Github静态博客

    1. 环境环境 1.1 安装Git 默认配置就好 1.2 安装node.js 下载:http://nodejs.org/download/ 安装时直接保持默认配置即可. 2. 配置Github 1.1 ...

  6. PSP(4.20——4.26)以及周记录

    1.PSP 4.20 8:45 9:25 10 30 Cordova A Y min 13:00 17:00 65 175 Cordova A Y min 4.21 9:00 17:00 125 35 ...

  7. python学习笔记五——数据结构

    4 . python的数据结构 数据结构是用来存储数据的逻辑结构,合理使用数据结构才能编写出优秀的代码.python提供的几种内置数据结构——元组.列表.字典和序列.内置数据结构是Python语言的精 ...

  8. CSS实现水平居中的5种思路

    前面的话 水平居中是经常遇到的问题.看似方法较多,条条大路通罗马.但系统梳理下,其实都围绕着几个思路展开.本文将介绍关于水平居中的5种思路 text-align [思路一]:在父元素中设置text-a ...

  9. 一本通1548【例 2】A Simple Problem with Integers

    1548:[例 2]A Simple Problem with Integers 题目描述 这是一道模板题. 给定数列 a[1],a[2],…,a[n],你需要依次进行 q 个操作,操作有两类: 1 ...

  10. BZOJ1415[Noi2005]聪聪和可可——记忆化搜索+期望dp

    题目描述 输入 数据的第1行为两个整数N和E,以空格分隔,分别表示森林中的景点数和连接相邻景点的路的条数. 第2行包含两个整数C和M,以空格分隔,分别表示初始时聪聪和可可所在的景点的编号. 接下来E行 ...