资源简介
WFG多目标测试函数测试集,用于测试多目标性能,
代码片段和文件信息
#include “wfg.h“
static void trimLine(char line[])
{
int i = 0;
while(line[i] != ‘\0‘)
{
if (line[i] == ‘\r‘ || line[i] == ‘\n‘)
{
line[i] = ‘\0‘;
break;
}
i++;
}
}
void printContents(FILECONTENTS *f)
{
for (int i = 0; i < f->nFronts; i++)
{
printf(“Front %d:\n“ i+1);
for (int j = 0; j < f->fronts[i].nPoints; j++)
{
printf(“\t“);
for (int k = 0; k < f->fronts[i].n; k++)
{
printf(“%f “ f->fronts[i].points[j].objectives[k]);
}
printf(“\n“);
}
printf(“\n“);
}
}
FILECONTENTS *readFile(char filename[])
{
FILE *fp;
char line[BUFSIZ];
int front = 0 point = 0 objective = 0;
FILECONTENTS *fc = malloc(sizeof(FILECONTENTS));
fc->nFronts = 0;
fc->fronts = NULL;
fp = fopen(filename “r“);
if (fp == NULL)
{
fprintf(stderr “File %s could not be opened\n“ filename);
exit(EXIT_FAILURE);
}
while(fgets(line sizeof line fp) != NULL)
{
trimLine(line);
if (strcmp(line “#“) == 0)
{
front = fc->nFronts;
fc->nFronts++;
fc->fronts = realloc(fc->fronts sizeof(FRONT) * fc->nFronts);
fc->fronts[front].nPoints = 0;
fc->fronts[front].points = NULL;
}
else
{
FRONT *f = &fc->fronts[front];
point = f->nPoints;
f->nPoints++;
f->points = realloc(f->points sizeof(POINT) * f->nPoints);
f->n = 0;
f->points[point].objectives = NULL;
char *tok = strtok(line “ \t\n“);
do
{
POINT *p = &f->points[point];
objective = f->n;
f->n++;
p->objectives = realloc(p->objectives sizeof(objectIVE) * f->n);
p->objectives[objective] = atof(tok);
} while ((tok = strtok(NULL “ \t\n“)) != NULL);
}
}
fc->nFronts--;
// for (int i = 0; i < fc->nFronts; i++) fc->fronts[i].n = fc->fronts[i].points[0].nobjectives;
fclose(fp);
/* printf(“Read %d fronts\n“ fc->nFronts);
printContents(fc); */
return fc;
}
- 上一篇:Snake主动轮廓模型
- 下一篇:攻击图技术应用研究综述
相关资源
- SpringBoot+H2+mybatis-plus59130
- 登录注册界面.zip48872
- 数字华容道
- SSM+Shiro+redis实现单点登陆
- jstl-api-1.2和jstl-impl-1.2
- 基于MVC模式的会员管理系统
- 国内一家大型软件公司内部的正规软
- 仿windows记事本
- GUI银行管理系统
- 背景差分法 多目标跟踪
- 超市收银系统eclipse access大学课程设计
- 模拟ATM柜员机系统--连接数据库
- A*算法的2D演示(带源码)
- 代码审查表和代码审查实例
- 仿126 网易 163 邮箱 界面
- Tomcat6.x
- 简单的行编辑器
- 扫雷(MVC架构)
- 302 Found
- window ping命令加时间并记录日志
- springboot+rabbitmq项目demo(亲测可正常运
- 多目标跟踪MOT16_Benchmark数据集链接
- jxbrowser 所有版本通用的破解包
- 2017年-传智播客-张志君老师-SpringBoo
- Blob.js+Export2Excel.js
- 机会路由源代码+仿真工具(SCORP)
- POI中文帮助文档附带api手册.zip
- 2018双十一阿里供应链服务平台讲座
- 原银在线信贷平台概要设计说明书v
- office_word_api 开发文档
评论
共有 条评论