Nelder-Mead Simplex Optimization Algorithm¶
-
template<int N>
struct NelderMeadOptions¶ Configuration for Nelder-Mead simplex algorithm.
Controls convergence criteria and simplex transformation coefficients. Default values work well for most problems.
- Template Parameters:
N – Number of optimization variables
Public Members
-
int max_iterations = -1¶
Maximum iterations (-1 = 200*N)
-
type_real tol_f = 1.0e-4¶
Tolerance on function value spread.
-
type_real tol_x = 1.0e-4¶
Tolerance on simplex diameter.
-
type_real reflection = 1.0¶
Reflection coefficient.
-
type_real expansion = 2.0¶
Expansion coefficient.
-
type_real contraction = 0.5¶
Contraction coefficient.
-
type_real shrink = 0.5¶
Shrink coefficient.
-
template<int N, typename Func>
OptimizationResult<N> specfem::optimization::optimize(NelderMeadSimplex, Func &&objective, NelderMeadOptions<N> options)¶ Nelder-Mead downhill simplex minimization.
Derivative-free optimization using \(N+1\) simplex vertices in \(N\)-dimensional space. Iteratively applies reflection, expansion, contraction, and shrink operations to locate a local minimum.
Convergence occurs when both:
Function value spread < tol_f
Simplex diameter < tol_x
// Minimize (x-1)^2 + (y-2)^2 auto f = [](auto x) { return (x(0)-1)*(x(0)-1) + (x(1)-2)*(x(1)-2); }; Kokkos::View<type_real[2], Kokkos::LayoutRight, Kokkos::HostSpace> x0("x0"); x0(0) = 0.0; x0(1) = 0.0; NelderMeadOptions<2> opts{x0}; auto result = optimize(NelderMeadSimplex{}, f, opts); // result.x(0) ≈ 1.0, result.x(1) ≈ 2.0
- Template Parameters:
N – Problem dimension
Func – Callable with signature: type_real(View<type_real[N]>)
- Parameters:
tag – Algorithm selector (NelderMeadSimplex{})
objective – Function to minimize
options – Configuration with initial guess and tolerances
- Returns:
OptimizationResult with solution, value, iterations, and convergence flag