资源简介
多目标算法性能评价,基本上包括了所有的评价方法,有MATLAB和C++两个版本。
代码片段和文件信息
// GD.cpp : Defines the entry point for the console application.
//
#include “mex.h“
double epsilon(double* b double* a int m1 int m int dim)
{
//‘m1‘ is the length of front
//‘m‘ is the length of trueParetoFront;
int i j k;
double eps eps_j = 0.0 eps_k = 0.0 eps_temp;
int dim_ = dim;
int method_ = 0;//addtion
int* obj_ = new int[dim_];
for (i = 0; i < dim_; i++) {
obj_[i] = 0;
}
if (method_ == 0)
eps = -1.0e300;
else
eps = 0;
for (i = 0; i < m; i++) {
for (j = 0; j < m1; j++) {
for (k = 0; k < dim_; k++) {
switch (method_) {
case 0:
if (obj_[k] == 0)
eps_temp = b[j * dim +k] - a[i* dim + k];
// eps_temp = b[j * dim_ + k] - a[i * dim_ + k];
else
eps_temp = a[i* dim + k] - b[j * dim +k];
// eps_temp = a[i * dim_ + k] - b[j * dim_ + k];
break;
default:
if ((a[i* dim + k] < 0 && b[j * dim +k] > 0)
|| (a[i* dim + k] > 0 && b[j * dim +k] < 0)
|| (a[i* dim + k] == 0 || b[j * dim +k] == 0)) {
// if ( (a[i * dim_ + k] < 0 && b[j * dim_ + k] > 0)
// ||
// (a[i * dim_ + k] > 0 && b[j * dim_ + k] < 0) ||
// (a[i * dim_ + k] == 0 || b[j * dim_ + k] == 0)) {
printf(“error in data file\n“);
return 0.0;
}
if (obj_[k] == 0)
eps_temp = b[j * dim +k] / a[i* dim + k];
// eps_temp = b[j * dim_ + k] / a[i * dim_ + k];
else
eps_temp = a[i* dim + k] / b[j * dim +k];
// eps_temp = a[i * dim_ + k] / b[j * dim_ + k];
break;
}
if (k == 0)
eps_k = eps_temp;
else if (eps_k < eps_temp)
eps_k = eps_temp;
}
if (j == 0)
eps_j = eps_k;
else if (eps_j > eps_k)
eps_j = eps_k;
}
if (i == 0)
eps = eps_j;
else if (eps < eps_j)
eps = eps_j;
}
return eps;
} // epsilon
/* The gateway routine */
void mexFunction(int nlhs mxArray *plhs[]
int nrhs const mxArray *prhs[])
{
double *P;
double *Ptrue;
int Prows Pcols n; //n is the number of objs
int Ptruerows;
P= 0;
Prows = Pcols = n = 0;
Ptruerows = 0;
/* Check for proper number of arguments. */
//if (nrhs < 2 || nrhs >3 || nlhs != 1) mexErrMsgTxt(“Usage: Hypervolume = HV(PF*n)“);
/* Create pointers to the input matrix S Q and C */
P = mxGetPr(prhs[0]);
Prows = mxGetM(prhs[0]);
Pcols = mxGetN(prhs[0]);
Ptrue = mxGetPr(prhs[1]); //get the true pareto front;
Ptruerows = mxGetM(prhs[1]); //get the rows of true pareto front;
n = mxGetScalar(prhs[2]);
//printf(“%d %d %d \n“ n Prows Pcols);
//the martrix is different for C(first row second row) and matlab(first col second col)
double *PP = new double[Prows * Pcols];
int i j it jt;
for(i = 0; i < Prows; i++){
for(j = 0; j < Pcols; j++){
it = (i * Pcols + j) % Prows;
jt = (i * Pcols + j) / Prows;
PP[it * Pcols + jt] = P[i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-07 11:56 MOPmetrics-matlab\
文件 4756 2014-01-09 16:40 MOPmetrics-matlab\2Dimension.mat
文件 4753 2013-07-08 09:38 MOPmetrics-matlab\3Dimension.mat
文件 4650 2014-01-08 22:14 MOPmetrics-matlab\4Dimension.mat
文件 3589 2010-05-16 12:38 MOPmetrics-matlab\epsilon.cpp
文件 411 2014-01-10 16:14 MOPmetrics-matlab\epsilon_matlab.m
文件 4243 2010-05-16 09:50 MOPmetrics-matlab\GD.cpp
文件 733 2014-01-08 18:54 MOPmetrics-matlab\GD_matlab.m
文件 7544 2014-01-08 17:41 MOPmetrics-matlab\GeneralizedSpread.cpp
文件 1681 2014-01-10 16:13 MOPmetrics-matlab\GeneralizedSpread_matlab.m
文件 796 2015-12-22 15:05 MOPmetrics-matlab\getSymmetricPF.m
文件 1716 2015-12-22 15:05 MOPmetrics-matlab\getTruePF.m
文件 1225 2015-12-22 10:00 MOPmetrics-matlab\getUniformWeight.m
文件 601 2014-01-10 15:31 MOPmetrics-matlab\hvByl.m
文件 3333 2013-05-23 09:43 MOPmetrics-matlab\hypeIndicatorExact8.m
文件 6733 2010-05-28 12:45 MOPmetrics-matlab\Hypervolume.cpp
文件 4272 2010-05-16 10:03 MOPmetrics-matlab\IGD.cpp
文件 740 2014-01-08 18:54 MOPmetrics-matlab\IGD_matlab.m
文件 8520 2014-01-14 16:25 MOPmetrics-matlab\MetricsComparison.m
文件 3192 2015-12-22 15:05 MOPmetrics-matlab\pal.m
文件 462 2014-01-10 15:23 MOPmetrics-matlab\readme.txt
文件 6910 2010-05-17 13:34 MOPmetrics-matlab\Spread.cpp
文件 1382 2014-01-10 15:29 MOPmetrics-matlab\Spread_matlab.m
文件 798 2014-01-10 15:27 MOPmetrics-matlab\trialHV.m
评论
共有 条评论