-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ackley.m
32 lines (23 loc) · 913 Bytes
/
Ackley.m
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
classdef Ackley
%UNTITLED4 Summary of this class goes here
% Detailed explanation goes here
properties
dim
end
methods
function y = eval(obj,x)
%UNTITLED4 Construct an instance of this class
% Detailed explanation goes here
y = -20*exp(-0.2*sqrt(sum(x.^2)/obj.dim)) - exp(sum(cos(2*pi*x))/obj.dim)+20+exp(1);
end
function output = grad(obj,x)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
output= -4*x*exp(-0.2*sqrt(sum(x.^2)/obj.dim))/(sqrt(sum(x.^2)/obj.dim)*obj.dim+0.1^(15));
output = output +exp(sum(cos(2*pi*x))/obj.dim)*2*pi*sin(2*pi*x)/obj.dim;
end
function output =function_name(obj)
output = 'Acley';
end
end
end