Guys, I might have found something. The matlab code has been modified due to someone writing in and saying they reckon they have a better method. The code is different in the matlab for the initial simplex:
matlab:
Code:
% Continue setting up the initial simplex.
% Following improvement suggested by L.Pfeffer at Stanford
usual_delta = 0.05; % 5 percent deltas for non-zero terms
zero_term_delta = 0.00025; % Even smaller delta for zero elements of x
for j = 1:n
y = xin;
if y(j) ~= 0
y(j) = (1 + usual_delta)*y(j);
else
y(j) = zero_term_delta;
end
v(:,j+1) = y;
x(:) = y; f = funfcn(x,varargin{:});
fv(1,j+1) = f;
end
C:
Code:
static void initial_simplex(dbl *xinit, dbl length)
{
int i, j;
dbl a, d1, d2, *v;
a = nvar + 1;
d1 = (sqrt(a) + nvar - 1)/sqrt(2.00)/nvar;
d2 = (sqrt(a) - 1)/sqrt(2.00)/nvar;
v = simp[0];
for (j=0; j<nvar; j++) v[j] = 0.00;
for (i=1; i<=nvar; i++) {
v = simp[i];
for (j=0; j<nvar; j++) {
v[j] = d2;
}
v[i-1] = d1;
}
for (i=0; i<=nvar; i++) {
v = simp[i];
scalarvector(nvar, v, length, v);
vectoradd(nvar, v, xinit, v);
}
}
the matlab uses a 5% measurement in each direction, although I cant quite read what the C is doing.
Everything else is then deterministic i think