-
Notifications
You must be signed in to change notification settings - Fork 0
/
problem.h
113 lines (98 loc) · 4.09 KB
/
problem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef _PROBLEM_H
#define _PROBLEM_H
#include "cec09.h"
// *********************** CEC 2009 ************************************
void CEC09_F1(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -1.0 + 2.0*X[i];
CEC09::UF1(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F2(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -1.0 + 2.0*X[i];
CEC09::UF2(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F3(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
CEC09::UF3(&(*(X.begin())), &(*(F.begin())), X.size());
}
void CEC09_F4(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -2.0 + 4.0*X[i];
CEC09::UF4(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F5(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -1.0 + 2.0*X[i];
CEC09::UF5(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F6(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -1.0 + 2.0*X[i];
CEC09::UF6(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F7(std::vector< double >& F, std::vector< double >& X)
{
F.resize(2);
std::vector<double> XX(X);
for(unsigned int i=1; i<X.size(); i++) XX[i] = -1.0 + 2.0*X[i];
CEC09::UF7(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F8(std::vector< double >& F, std::vector< double >& X)
{
F.resize(3);
std::vector<double> XX(X);
for(unsigned int i=2; i<X.size(); i++) XX[i] = -2.0 + 4.0*X[i];
CEC09::UF8(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F9(std::vector< double >& F, std::vector< double >& X)
{
F.resize(3);
std::vector<double> XX(X);
for(unsigned int i=2; i<X.size(); i++) XX[i] = -2.0 + 4.0*X[i];
CEC09::UF9(&(*(XX.begin())), &(*(F.begin())), X.size());
}
void CEC09_F10(std::vector< double >& F, std::vector< double >& X)
{
F.resize(3);
std::vector<double> XX(X);
for(unsigned int i=2; i<X.size(); i++) XX[i] = -2.0 + 4.0*X[i];
CEC09::UF10(&(*(XX.begin())), &(*(F.begin())), X.size());
}
// ---------------- 5 objective test instances ------------------
void CEC09_R2_DTLZ2_M5(std::vector< double >& F, std::vector< double >& X)
{
F.resize(5);
std::vector<double> XX(X);
double low30[] = {-1.773, -1.846, -1.053, -2.370, -1.603, -1.878, -1.677, -0.935, -1.891, -0.964, -0.885, -1.690, -2.235, -1.541, -0.720, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000};
double upp30[] = {1.403, 1.562, 2.009, 0.976, 1.490, 1.334, 1.074, 2.354, 1.462, 2.372, 2.267, 1.309, 0.842, 1.665, 2.476, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000};
for(unsigned int i=0; i<X.size(); i++) XX[i] = low30[i] + X[i]*(upp30[i] - low30[i]);
CEC09::R2_DTLZ2_M5(&(*(XX.begin())), &(*(F.begin())), X.size(), nobj);
}
void CEC09_R2_DTLZ3_M5(std::vector< double >& F, std::vector< double >& X)
{
F.resize(5);
std::vector<double> XX(X);
double low30[] = {-1.773, -1.846, -1.053, -2.370, -1.603, -1.878, -1.677, -0.935, -1.891, -0.964, -0.885, -1.690, -2.235, -1.541, -0.720, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000};
double upp30[] = {1.403, 1.562, 2.009, 0.976, 1.490, 1.334, 1.074, 2.354, 1.462, 2.372, 2.267, 1.309, 0.842, 1.665, 2.476, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000};
for(unsigned int i=0; i<X.size(); i++) XX[i] = low30[i] + X[i]*(upp30[i] - low30[i]);
CEC09::R2_DTLZ3_M5(&(*(XX.begin())), &(*(F.begin())), X.size(), nobj);
}
void CEC09_WFG1_M5(std::vector< double >& F, std::vector< double >& X)
{
F.resize(5);
std::vector<double> XX(X);
CEC09::WFG1_M5(&(*(XX.begin())), &(*(F.begin())), X.size(), nobj);
}
#endif