-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLangermann.m
More file actions
30 lines (29 loc) · 794 Bytes
/
Langermann.m
File metadata and controls
30 lines (29 loc) · 794 Bytes
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
classdef Langermann < Problem
properties(Constant)
LB = [0 0];
UB = [10 10];
m = 5;
c = [1, 2, 5, 2, 3];
A = [3, 5; 5, 2; 2, 1; 1, 4; 7, 9];
end
methods
function obj = Langermann()
obj = obj@Problem("Langermann");
end
function out = evaluate(obj, x)
d = length(x);
outer = 0;
for ii = 1:obj.m
inner = 0;
for jj = 1:d
xj = x(jj);
Aij = obj.A(ii,jj);
inner = inner + (xj-Aij)^2;
end
new = obj.c(ii) * exp(-inner/pi) * cos(pi*inner);
outer = outer + new;
end
out = outer;
end
end
end