多目标遗传算法 ------ 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> ...
随机推荐
- Selenium IDE 宏 试用 一例
本质是宏(Macro)理念 Marco概念的广泛应用: 1.Office的Excel里的任何操作的 可以都可以用VBA编程记录下宏,然后把记录的宏,可以回放.当然也可以生成代码,比如给Excel设置单 ...
- U 盘安装 CentOS的方法
1. 刻录U盘 我使用的工具是 UltralISO 2. 打开ISO 3. 使用<启动>-<写入磁盘映像> 根据U盘的性能 可能好事 5min-15min左右 4.找到想要安装 ...
- 转帖 Oracle 主键的处理方法 http://www.cnblogs.com/Richardzhu/p/3470929.html
Oracle之主键的创建.添加.删除操作 一.创建表的同时创建主键约束 1.1.无命名 SQL> create table jack (id int primary key not null ...
- 《ERP系统修正数据的sql文件》
第一 1.修正销售客户创建者的sql脚本: UPDATE e_sales_customers sc SET sc.user_id = ( SELECT tmp.user_id FROM ( SELEC ...
- Test Scenarios for Filter Criteria
1 User should be able to filter results using all parameters on the page2 refine search functionalit ...
- codeforces659B
Qualifying Contest CodeForces - 659B Very soon Berland will hold a School Team Programming Olympiad. ...
- 捕捉JDialog的关闭事件
捕捉JDialog的关闭事件 http://xxqn.iteye.com/blog/431190 public class EditJDialog extends javax.swing.JDialo ...
- 【题解】Hanoi双塔问题
题目描述 给定A,B,C三根足够长的细柱,在A柱上放有2n个中间有空的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的(下图为n=3的情形).现要将这些圆盘移到C柱上, ...
- jQuery之制作简单的轮播图效果
[源代码] 链接:https://pan.baidu.com/s/1XpZ66D9fmSwWX3pCnGBqjA 密码:w104 [整体构思] 这个轮播图使用的是jQuery,所以Js的整体代量比较少 ...
- matplotlib极坐标方法详解
一.极坐标 在平面内取一个定点O,叫极点,引一条射线Ox,叫做极轴,再选定一个长度单位和角度的正方向(通常取逆时针方向).对于平面内任何一点M,用ρ表示线段OM的长度(有时也用r表示),θ表示从Ox到 ...