forked from qzcwx/CEC2010SS-LSGO-Benchmarks-CPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathF1.cpp
61 lines (48 loc) · 1.3 KB
/
F1.cpp
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
#include "F1.h"
/**
* Shifted Elliptic Function
*
* as defined in "Benchmark Functions for the CEC'2010 Special Session
* and Competition on Large-Scale Global Optimization" by Ke Tang,
* Xiaodong Li, P. N. Suganthan, Zhenyu Yang, and Thomas Weise
* published as technical report on January 8, 2010 at Nature Inspired
* Computation and Applications Laboratory (NICAL), School of Computer
* Science and Technology, University of Science and Technology of China,
* Hefei, Anhui, China.
*/
F1::F1():Benchmarks(){
m_havenextGaussian=0;
Ovector = NULL;
minX = -100;
maxX = 100;
ID = 1;
lookup = lookupprepare(dimension);
}
F1::~F1(){
delete[] Ovector;
delete[] lookup;
}
double F1::compute(double* x) {
double result;
int i;
if(Ovector == NULL) {
Ovector = createShiftVector(dimension,minX,maxX);
}
for(i = dimension - 1; i >= 0; i--) {
anotherz[i] = x[i] - Ovector[i];
}
result = elliptic(anotherz,dimension);
return(result);
}
double F1::compute(vector<double> x){
double result;
int i;
if(Ovector == NULL) {
Ovector = createShiftVector(dimension,minX,maxX);
}
for(i = dimension - 1; i >= 0; i--) {
anotherz[i] = x[i] - Ovector[i];
}
result = elliptic(anotherz,dimension);
return(result);
}