Computes the size.
ssize = optimsimplex_size(opt, [method])
The current simplex object of TSIMPLEX type (tlist).
The method to use to compute the size (optional).
The available methods are the following:
"sigmaplus". This is the default.
The sigmaplus size is the maximum 2-norm length of the vector from each vertex to the first vertex. It requires one loop over the vertices.
"sigmaminus".
The sigmaminus size is the minimum 2-norm length of the vector from each vertex to the first vertex. It requires on loop over the vertices.
"Nash".
The Nash size is the sum of the norm of the norm-1 length of the vector form the given vertex to the first vertex. It requires one loop over the vertices.
"diameter".
The diameter size is the maximum norm-2 length of all the edges of the simplex. It requires 2 nested loops over the vertices.
A scalar.
The optimsimplex_size
function returns the size of the simplex.
function y=rosenbrock(x) y = 100*(x(2)-x(1)^2)^2 + (1-x(1))^2; endfunction simplex = [... 0. 0. 1. 0. 0. 2. ]; s1 = optimsimplex_new(); s1 = optimsimplex_setn ( s1 , 2 ); s1 = optimsimplex_setnbve ( s1 , 3 ); s1 = optimsimplex_setallx ( s1 , simplex ); // Method = "Nash" ssize = optimsimplex_size ( s1 , "Nash" ); disp(ssize) // Method = "diameter" ssize = optimsimplex_size ( s1 , "diameter" ); disp(ssize) // Method = "sigmaplus" ssize = optimsimplex_size ( s1 , "sigmaplus" ); disp(ssize) // Method = "sigmaminus" ssize = optimsimplex_size ( s1 , "sigmaminus" ); disp(ssize) s1 = optimsimplex_destroy(s1); | ![]() | ![]() |