Matlab derivation of a summation index

Hi all!
I am trying to compute ZDT1 function using matlab ( http://people.ee.ethz.ch/~sop/download/supplementary/testproblems/zdt1/index.php ). Then, I need to compute the gradient of both f1 and f2.
Can anyone tell me how to compute the gradient of f1 and (especially) f2 using matlab? I have encountered a lot of problems here.
I appreciate all your efforts.
KC

 Accepted Answer

I can’t determine if f1 is a scalar or vector, only that it is on the interval [0,1], or if the expression for x2 is a recursion relation that applies to all, i.e. x(n+1)=1-sqrt(x(n)). That determines what g is (vector or matrix), and what f2 is. I’ll leave that to you.
You can compute the gradients of vectors and matrices using the gradient core MATLAB function.

2 Comments

x1,...,xn are scalars. With that f1 and f2 are scalar. g is also scalar. I tried using gradient but I cannot input the summation part into matlab. I tried to google but I could not find any solution.
I read some of the paper (in which this corresponds essentially to Eq. 7), but the paper doesn’t amplify on the details of the function, or even what the objective is that they would be optimised for. My impression is the this is a test function for various evolutionary algorithms (EA), and has no practical import beyond that.
I assume that the x-vector is input from the EA, and the function evaluates it and returns a fitness value (likely a scalar). It is not obvious to me what that fitness value is. The plot is a bit mystifying, since I get the impression from it that x(1) is an arbitrary starting value from which other x-values are calculated and evaluated. However that doesn’t fit the context of the rest of the function, at least as I understand it.
The summation seems fairly straightforward. You have to choose a vector of x values (each a scalar ranging in value from 0 to 1). Assuming you have 100 of them, this is how I would do it:
x = linspace(0,1,100);
f = zeros(size(x));
for n = 2:size(x,2)
g(n) = 1 + (9/(n-1)) * sum(x(2:n));
end
f1 = x(1);
f = g .* (1 - sqrt(f1./g));
f(1) = x(1);
h = 1 - sqrt(f(1)./g);
I am not certain I understand the need for the gradient for this, since evolutionary algorithms do not use a gradient-descent approach for optimisation. (I may be missing something in scanning the paper rather than reading it in detail.) I doubt these functions could be defined in that context. In any event, the gradient is numerically defined in the optimisation functions, or you can calculate the analytic Jacobian, but I don’t see how you could do that with these functions.
It seems that the fitness functions for various methods are specified in Eq 14 - 19 as distance metrics that seem to use the relative change from generaton-to-generation as the convergence criterion. It is still not obvious to me how this and the other test functions would be implemented as functions or what the arguments or outputs are. Those details would be necessary to use them in your code.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 11 Aug 2014

Commented:

on 11 Aug 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!