多目标遗传算法 ------ NSGA-II (部分源码解析)辅助变量 双链表操作 list.c
/* 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的更多相关文章
- 多目标遗传算法    ------    NSGA-II  (部分源码解析)介绍
		
NSGA(非支配排序遗传算法).NSGA-II(带精英策略的快速非支配排序遗传算法),都是基于遗传算法的多目标优化算法,是基于pareto最优解讨论的多目标优化. 在官网: http://www.ii ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析) 交叉操作   crossover.c
		
遗传算法中的交叉操作是 对NSGA-II 源码分析的 最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的 函数模块. 这里,首先提一下,遗传算法的 交叉操作.变异操作都 ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析)目标函数  problemdef.c
		
/* Test problem definitions */ # include <stdio.h> # include <stdlib.h> # include <ma ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析)状态报告 打印    report.c
		
/* Routines for storing population data into files */ # include <stdio.h> # include <stdlib ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析) 拥挤距离计算  crowddist.c
		
/* Crowding distance computation routines */ # include <stdio.h> # include <stdlib.h> # ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析)README  算法的部分英文解释
		
This is the Readme file for NSGA-II code. About the Algorithm--------------------------------------- ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析) 实数、二进制编码的变异操作  mutation.c
		
遗传算法的变异操作 /* Mutation routines */ # include <stdio.h> # include <stdlib.h> # include < ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析)两个个体支配判断  dominance.c
		
/* Domination checking routines */ # include <stdio.h> # include <stdlib.h> # include &l ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析)二元锦标赛选择  tourselect.c
		
tourselect.c 文件中共有两个函数: selection (population *old_pop, population *new_pop) individual* tournament ...
 - 多目标遗传算法 ------ NSGA-II (部分源码解析) 临时种群生成新父代种群  fillnds.c
		
/* Nond-domination based selection routines */ # include <stdio.h> # include <stdlib.h> ...
 
随机推荐
- 在Windows下查看Java的JRE路径
			
java -showversionecho %JAVA_HOME%path 这个方法可以确认当前java.exe的版本,但是并不能确定输出JRE的具体路径. JAVA_HOME的路径,也不一定就是当前 ...
 - Mybatis Update statement Date null
			
Mybatis Update statement Date null 只要在Model里把字段置为java的null即可.
 - socketserver及相关的类  (处理socket服务端)+ event事件的使用
			
编写简单的套接字服务器并不难,然而,如果要创建的并非简单服务器,还要求助于服务器模块. 模块SocketServer是标准库提供的服务器框架的基石,这个框架包括好多服务器,他们基本服务器的基础上添加了 ...
 - 关于ArcGIS常用功能的实现
			
关于ArcGIS中常见的一些功能的总结,一般首先在前台中放置地图,代码如下所示: <esri:Map Grid.Row="0" Grid.Column="0&quo ...
 - JavaScript——DOM树的增查改删总结
			
对HTML DOM的操作是前端JavaScript编程时必备的技能,本文是我自己对DOM树操作的总结,主要是方法的罗列,原理性的讲述较少,适合大家用于理清思路或是温习 一.什么是HTML DOM? 是 ...
 - JavaScript——AJAX
			
AJAX技术是网页构建的必备技能之一,本文希望能帮助大家轻松的学习这项技术 一.什么是ajax? ajax(异步javascript xml) 能够刷新局部网页数据而不是重新加载整个网页. 二.如何使 ...
 - windows部分常用命令
			
dir 查看内容 md 新建目录 copy 复制 del 删文件 cls 清屏 tasklist 查看运行进程 taskkill /pid xxx 杀死进程xxx taskmgr 打开任务管理器 ms ...
 - 聪聪和可可 HYSBZ - 1415(概率 + spfa + 记忆化dp)
			
Input 数据的第1行为两个整数N和E,以空格分隔,分别表示森林中的景点数和连接相邻景点的路的条数. 第2行包含两个整数C和M,以空格分隔,分别表示初始时聪聪和可可所在的景点的编号. 接下来E行,每 ...
 - HDU - 1160 (FatMouse's Speed )最长上升子序列
			
题意:一个元素有两个属性 w 和 sp 求在w严格递增的情况下 sp严格递减 用结构体 定义三个参数 w sp ix , ix是在输入时的顺序 因为我们要排序 之后把结构体数组 按从小到大排序 ...
 - HDU - 1260 (Tickets)
			
题意: 买票 一个人要么自己买 要么和前面的人一起买 这两种情况分别有一个买票所花费的时间 求总的花费时间最小 解析: dp[i] 表示前i个人买票总的花费时间 v[i]表示第i个人买 ...