/* 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. git工具使用包括上传本地代码到服务器

    我是参考这个的 https://www.cnblogs.com/tonycheng93/p/4460052.html

  2. Lucene源码

    看Lucene源码必须知道的基本概念 终于有时间总结点Lucene,虽然是大周末的,已经感觉是对自己的奖励,毕竟只是喜欢,现在的工作中用不到的.自己看源码比较快,看英文原著的技术书也很快.都和语言有很 ...

  3. hadoop伪分布式安装之Linux环境准备

    Hadoop伪分布式安装之Linux环境准备 一.软件版本 VMare Workstation Pro 14 CentOS 7 32/64位 二.实现Linux服务器联网功能 网络适配器双击选择VMn ...

  4. String系列-----String

    jdk源码学习之String,手动实现一个String package com.amazing.jdk.string_2017_12_31; import java.io.Serializable; ...

  5. js返回值 数组去重

    function myfun(arr){ var arr1 = new Array(); var len = arr.length; ;i <len ;i++){ ) { arr1.push(a ...

  6. VS Code 的常用快捷键和插件

    VS Code 的常用快捷键和插件 一.vs code 的常用快捷键 1.注释: a) 单行注释:[ctrl+k,ctrl+c] 或 ctrl+/ b) 取消单行注释:[ctrl+k,ctrl+u] ...

  7. Linux 改变文件属性与权限

    常用的修改文件组或文件的命令有三个:chgrp.chown.chmod. 1 chgrp 改变文件所属的用户组 改变一个文件的用户组直接以chgrp来改变即可,这个命令时change group 的简 ...

  8. [转帖]从1G到5G

    一文看懂无线通信:从1G到5G 投递人 itwriter 发布于 2019-02-03 15:25 评论(2) 有280人阅读 [收藏] « » 文/老和山下的小学僧 最近太邪乎,先引用一个马克思政治 ...

  9. 搭建Spark所遇过的坑

    一.经验 1.Spark Streaming包含三种计算模式:nonstate .stateful .window 2.kafka可通过配置文件使用自带的zookeeper集群 3.Spark一切操作 ...

  10. Nginx referer防盗链模块

    L75 referer模块 ngx_http_referer_module 默认编译进nginx valid_referers 指令 Syntax: valid_referers none | blo ...